Commit graph

73 commits

Author SHA1 Message Date
Stan Lo
f6af5a1128 [ruby/irb] Refactor eval history
(https://github.com/ruby/irb/pull/623)

* Rename `ext/history.rb` to `ext/eval_history.rb`

To confusion with `lib/irb/history.rb`

* Add eval_history tests

* Rename eval_history's History to EvalHistory to avoid confusion
2023-07-04 15:17:41 +00:00
Stan Lo
af9eeb19d8 [ruby/irb] Stop treating history-saving logic as extension
(https://github.com/ruby/irb/pull/613)

Since `IRB.conf[:SAVE_HISTORY]` is assigned with 1000 by default, history-saving
is a feature enabled by default. So it should not be treated as an extension,
which adds unnecessary complexity to the code.
2023-07-03 13:48:23 +00:00
Stan Lo
45ff2f4a89 [ruby/irb] Refactor ExtendCommand::Nop
(https://github.com/ruby/irb/pull/598)

* Rename conf to irb_context

* Drop Nop#irb method because it's only used by irb/ext/loader.rb

We don't need to expose this method to all command classes, especially
when it's just an alias of `irb_context.irb`.
2023-06-05 19:12:16 +00:00
Yusuf Daniju
ec211ad54d [ruby/irb] fix typo in tracer (https://github.com/ruby/irb/pull/565)
2f567f3d3e
2023-04-23 18:41:40 +00:00
Stan Lo
2f8e5c80e6 [ruby/irb] Drop Ruby 2.6 support
(https://github.com/ruby/irb/pull/555)

* Remove all Ruby 2.6 support

* Drop Ruby 2.6 specific testing conditions

* Only run Ruby 2.7+ on CI

* Bump Ruby requirement to 2.7+

3f714b616c
2023-04-05 21:40:40 +00:00
Stan Lo
f25791884c [ruby/irb] Remove dead code (https://github.com/ruby/irb/pull/554)
* Remove unused ATTR_TTY and ATTR_PLAIN constants

They were added in d7d26b51bf

But the references were removed in 1c76845cca

Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>

* Remove unused MethodExtender module

It was added in 6cc5d718d7
but it's not used anywhere.

Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>

* Remove unused IRB.irb_at_exit

It's not used after aaf4eb4e98

Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>

* Remove unused InputCompletor.ignored_modules

It was added in 88311ce3c8
but the reference was removed in 78c74d2425

* Remove unused TracerLoadError constant

This constant was added in cb50fa3738
but never referenced.

---------

7de0234325

Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
2023-04-02 14:11:12 +00:00
Stan Lo
cbac0fa4cb [ruby/irb] Remove unused context argument from Worksapce#evaluate
(https://github.com/ruby/irb/pull/488)

The context argument was introduced in this change:

6806669d17 (diff-296327851fb7a2c307c2d0693b769f58c01aaf315972f290500d10081ee200a9)

perhaps for potential usages. But after that it's never used.
2023-02-18 11:34:28 +00:00
Hiroshi SHIBATA
7e283c585e [ruby/irb] Formatting to header styles
cef125850d
2023-01-11 22:29:10 +00:00
Hiroshi SHIBATA
c7bb8d67b7 [ruby/irb] Removed Release Version and Revisions for old VCS software
07fae94862
2023-01-11 22:29:09 +00:00
Nobuyoshi Nakada
d532d27507 [ruby/irb] Use class methods of File over Kernel.open
e0ec5e1bd8
2022-11-30 10:18:57 +00:00
st0012
4f348e482c [ruby/irb] Rename leftover Reidline references
0ed8b103ed
2022-11-15 10:08:28 +00:00
st0012
b97e909ef4 [ruby/irb] Remove unnecessary Thread presence check
They were introduced around 20 years ago, when Thread is not yet
stabilized. So we don't need them anymore.

4c75e03b2b
2022-10-03 07:00:53 +09:00
Nobuyoshi Nakada
f863bc505c [ruby/irb] Fix the error when LC_MESSAGES config value is nil
6bbde84369
2022-09-14 11:14:08 +09:00
Jeremy Evans
9299db49f5 [ruby/irb] Fix history file saving with concurrent irb sessions when history file doesn't exist
If history file didn't exist when irb was started, @loaded_history_mtime
would be nil.  However, if the history file didn't exist before, but it
exists when saving history, that means the history file was modified,
and we should handle it the same way as we handle the other case where
the history file was modified.

Fixes #388

8d277aafcb
2022-09-14 10:15:45 +09:00
Jeremy Evans
14e1739ff3 [ruby/irb] Make save-history extension safe for concurrent use
This makes the save-history extension check for modifications to
the history file before saving it.  If the history file was modified
after the history was loaded and before it was saved, append only
the new history lines to the history file.

This can result in more lines in the history file than SAVE_HISTORY
allows.  However, that will be fixed the next time irb is run and
the history is saved.

Fixes [Bug #13654]

041ef53845
2021-03-06 00:18:32 +09:00
Nobuyoshi Nakada
b83b27cddb [ruby/irb] Fix inverse separator condition
33f933196f
2021-02-12 00:02:16 +09:00
aycabta
d77a42fbfd [ruby/irb] Suppress error when File::ALT_SEPARATOR is nil
96accf3b95
2021-02-11 20:27:25 +09:00
Nobuyoshi Nakada
f6387ae073 Fix absolute path predicate on Windows
A path starts with '/' is not an absolute path on Windows, because
of drive letter or UNC.
2021-01-29 10:26:18 +09:00
Nobuhiro IMAI
5b05b85d85 [ruby/irb] add IRB::FileInputMethod.open to ensure closing associated File
* tweak some methods not to raise exception after `#close`
* use it in `IRB::IrbLoader#{source_file,load_file}

ec2947acbd
2021-01-27 15:01:57 +09:00
aycabta
8882927036 [ruby/irb] Discard newlines at end of file
0b2773d91d
2020-08-28 11:05:18 +09:00
Nobuyoshi Nakada
7fa86de15b [ruby/irb] Workaround a bug of ruby-mode.el
6dfd59400d
2020-08-18 14:38:01 +09:00
Nobuyoshi Nakada
82d4da7816 [ruby/irb] Yet another unnecessary readline
933841af11
2020-08-18 14:38:01 +09:00
aycabta
126e1fc296 [ruby/irb] Make history infinite if set SAVE_HISTORY to negative
824473e880
2020-08-18 14:38:01 +09:00
aycabta
ef498a016b [ruby/irb] Suppress crash when bignum is set to SAVE_HISTORY
5044eb2730
2020-08-18 14:38:01 +09:00
Nobuyoshi Nakada
bc646e6715
[DOC] get rid of parsing as TIDYLINK unintentionally 2020-04-07 13:59:38 +09:00
aycabta
8c3efa4940 Use Reline.encoding_system_needs if exists 2020-01-14 15:40:38 +09:00
aycabta
51ea1abb5f Remove e2mmap dependency 2019-11-25 05:38:09 +09:00
aycabta
1aeb201d28 Remove debug code... 2019-11-24 23:29:09 +09:00
aycabta
745ab16818 Disable tracer ext of IRB when tracer doesn't found 2019-11-24 22:42:08 +09:00
zverok
4fe06f4667 IRB: Document command evaluation history. 2019-10-26 10:24:20 -07:00
aycabta
48fdc37ad5 IRB's multiline history is enable only when Reidline mode 2019-08-22 05:09:08 +09:00
Jeremy Evans
a06301b103 Ignore history file without saving if permissions cannot be changed
Fixes [Ruby Bug 13907]
2019-07-27 16:56:04 +09:00
aycabta
0af897ab59 Simplify history saving code 2019-07-15 10:20:23 +09:00
aycabta
17ccda5413 Use #to_a for Readline::HISTORY directly 2019-07-15 08:33:07 +09:00
aycabta
266f6cd8a1 Remove debug print 2019-07-15 07:54:47 +09:00
aycabta
4b7a04a5b8 Support multiline irb_history
A history line ends with "\" to escape newline if it's a continuous
line.
2019-07-15 07:51:57 +09:00
Masataka Pocke Kuwabara
9806da50f4 Suppress warnings 2019-07-15 00:13:01 +09:00
Sutou Kouhei
29c16b30ce Add support for history with Reline backend 2019-05-27 06:32:52 +09:00
marcandre
e859e668d2 lib/*: Prefer require_relative over require.
[#15206] [Fix GH-1976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:33 +00:00
kazu
6064132c42 Remove unnecessary require 'thread'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08 07:00:01 +00:00
hsbt
6a08beef51 Removed math mode from irb.
mathn is deprecated from Ruby 2.2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20 09:11:36 +00:00
hsbt
589169cb78 * lib/irb/ext/save-history.rb: Fix NoMethodError when method is not defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 11:27:38 +00:00
naruse
af24631af6 * lib/irb/ext/save-history.rb: suppress warning: method redefined;
discarding old save_history=.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-14 10:06:41 +00:00
naruse
3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
hsbt
2afed6ecef * lib/e2mmap.rb: remove needless instance variables.
* lib/irb.rb: ditto.
* lib/irb/**/*.rb: ditto.
* lib/shell.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-24 07:16:25 +00:00
hsbt
0b7979a8fd * lib/irb/ext/multi-irb.rb: fixed indent.
* lib/irb/output-method.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-10 01:05:08 +00:00
hsbt
f9a81499ff * lib/irb/ext/multi-irb.rb: removed commented-out code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-10 01:05:06 +00:00
hsbt
76515504d5 * lib/irb.rb: removed commented-out code.
* lib/irb/**/*.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-09 02:02:58 +00:00
hsbt
8e5af8b628 * lib/cmath.rb: fixed indent.
* lib/drb/ssl.rb: ditto.
* lib/irb/**/*.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-09 01:36:49 +00:00
zzak
f11ff34d8f * lib/irb.rb, lib/irb/ext/save-history.rb: Add documentation on how to
enabled irb history [ruby-core:51347] [Bug #7679]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-04 23:04:09 +00:00