Commit graph

855 commits

Author SHA1 Message Date
aycabta
43c648c832 [ruby/irb] Support shortening lambda notation
8e3f81d428
2020-08-18 14:38:02 +09:00
aycabta
b3f84b4a5b [ruby/irb] Expand path to run separated test correctly
be2937abd5
2020-08-18 14:38:01 +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
Nobuyoshi Nakada
0fcbd07247 [ruby/irb] Directly check if the method is available instead of version
3ea9fd9ed0
2020-08-18 14:38:01 +09:00
Nobuyoshi Nakada
6aa786b8a3 [ruby/irb] Get rid of loading readline unnecessarily
420e7d2270
2020-08-18 14:38:01 +09:00
Nobuyoshi Nakada
d32229e338 [ruby/irb] Prefer require_relative to load the files in this library
0ac3bc7296
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
aycabta
6f0ef83de7 [ruby/irb] Symbol.all_symbols was adopted by Ruby 1.8.0 or later
71ba754e8e
2020-08-18 14:38:01 +09:00
aycabta
5474007d61 [ruby/irb] Support oneline method definition
826ae909c9
2020-08-18 14:38:01 +09:00
Yusuke Endoh
098e8c2873 Suppress "assigned but unused variable" warnings 2020-07-23 23:44:25 +09:00
aycabta
20172672db Add require 'irb/ruby-lex' to use RubyLex 2020-07-22 04:11:38 +09:00
Nobuhiro IMAI
f6e789e3b0 [ruby/irb] handle rescue modifier properly
6de1341f5e
2020-07-22 02:31:47 +09:00
Masataka Pocke Kuwabara
b40e925c92 [ruby/irb] Fix error when inspect is called but not found in inspector
ce6d53e6d9
2020-07-22 02:31:47 +09:00
aycabta
c72a2fad97 [ruby/irb] Simplify RubyLex.compile_with_errors_suppressed
nobu-san reviewed,

https://github.com/ruby/irb/pull/106#pullrequestreview-423400033
> How about lexer = Ripper::Lexer.new(";\n#{code}", nil, 0)?
> Encoding pragma is effective only at the beginning.
> And the semicolon and newline will be skipped because the position is before
> the initial pos.

I employ the way.

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

e593cc65b7
2020-07-22 02:31:46 +09:00
aycabta
1dfd24a7fc [ruby/irb] Suppress incomplete encoding magic comment error
443e90af80
2020-07-22 02:31:46 +09:00
aycabta
78ccab2530 [ruby/irb] Suppress incomplete coding magic comment error
6a457edbd1
2020-07-22 02:31:46 +09:00
aycabta
dc0cdf4322 [ruby/irb] Version 1.2.4
d7c5fb0273
2020-05-17 19:26:53 +09:00
aycabta
7e5253d15e [ruby/irb] Suppress "method redefined" warning
5f0aee56fa
2020-04-29 19:13:14 +09:00
aycabta
3864fbc6d8 [ruby/irb] Check existence of rc files in irb_info command
cdbb9dfc9f
2020-04-29 19:13:14 +09:00
aycabta
98a346d065 [ruby/irb] Add irb_info command
a6fe58e916
2020-04-29 19:13:14 +09:00
Hiroshi SHIBATA
5c6269c459
Support XDG_* (#2174)
* Support XDG_CONFIG_HOME for gemrc.

* Support XDG_DATA_HOME for .gem

* Added test for XDG_DATA_HOME

* Do not reuse environmental variable.

* Unify .rdoc path to RDoc.home.

* Support XDG_DATA_HOME for .rdoc

* Ignore exists?

* Extracted config_home path

* Use XDG_CONFIG_HOME for default credential path

* Fixed inconsistency location.

* Fixed the broken tests.

* Support XDG_CONFIG_HOME for irbrc

* Introduce Gem.cache_home as XDG_CACHE_HOME

* Use Gem.cache_home instead of Gem.config_home for the credential file of RubyGems.

* Initialized the old configurations

* Fixed test failure related the configuration initialization

* restore XDG_DATA_HOME

* Fixed the broken examples of bundler with XDG_*

* Do not modify environmental variable on test file

* Use XDG_DATA_HOME insted of XDG_CACHE_HOME for credential file

* stub out Gem.data_home

* Move dir accessor to defaults.rb file

* Use XDG_DATA_HOME for signed gem features

* Use XDG_DATA_HOME for spec cache

* Do not rely on Gem.user_home

* Gem.user_home is always exists. Don't need to use FileUitls.mkdir_p

* Bump support version to RubyGems 3.2.0+

* Removed the needless fallback configuration

* Fixed the inconsistency methods that are find_config_file and config_file

* Use Gem.configuration.credentials_path instead of hard-coded path

* gem_path is always provided

* Removed the duplicated code of find_home

* Also removed the duplicated code of user_home

* use Gem::UNTAINT instead of untaint for surpressing the warnings

* Use File.directory

* Restore XDG_DATA_HOME

* Use File.write
2020-04-23 19:16:06 +09:00
Nobuyoshi Nakada
bc646e6715
[DOC] get rid of parsing as TIDYLINK unintentionally 2020-04-07 13:59:38 +09:00
Charles Oliver Nutter
2b6848af0e [ruby/irb] Require jruby lib to get JRuby.compile_ir
dc59afe4f6
2020-03-29 04:44:53 +09:00
aycabta
22477128cd [ruby/irb] Suppress crashing when EncodingError has occurred without lineno
13572d8cdc
2020-03-26 17:41:21 +09:00
Nobuyoshi Nakada
b08c1bea36 [ruby/irb] Unnamed groups are not captured when named groups are used
0a641a69b0
2020-03-26 17:41:21 +09:00
Koichi Sasada
aa9a38c0ed Ignore incompatible convert of symbols 2020-03-03 15:27:23 +09:00
aycabta
91440ff13f Convert incompatible encoding symbol names 2020-03-03 14:43:14 +09:00
aycabta
dcb05179a9 [ruby/irb] Version 1.2.3
dd56e06df5
2020-02-17 23:31:59 +09:00
Nobuhiro IMAI
961630126b [ruby/irb] fix reserved words and completion for them
6184b227ad
2020-02-15 21:52:03 +09:00
Nick Lewis
38f1e84c37 [ruby/irb] Include easter-egg.rb in gemspec
`irb` doesn't run because this file isn't included in the gem.
73cda56d25
2020-02-15 21:52:03 +09:00
aycabta
8749a678ab [ruby/irb] Version 1.2.2
a71753f15a
2020-02-15 21:52:03 +09:00
aycabta
16f5d63bad [ruby/irb] Use 0.step instead of (..0).each for Ruby 2.5
5d628ca40e
2020-02-12 13:14:28 +09:00
aycabta
8b8cc01229 [ruby/irb] Fix auto indent with closed brace
A closed brace in auto-indent shouldn't affect the next brace in the same line,
but it behaves like below:

  p() {
    }

It's a bug.

fbe59e344f
2020-02-12 13:14:28 +09:00
aycabta
0719e1be11 [ruby/irb] Check doc namespace correctly
IRB::InputCompletor::PerfectMatchedProc crashes when doc not found because a
variable name was incorrect.

889fd4928f
2020-02-12 13:14:28 +09:00
Nobuyoshi Nakada
ac1f4fa469 [ruby/irb] Exclude useless files from RDoc
8f1ab2400c
2020-02-02 03:25:33 +09:00
Yusuke Endoh
7e2ed7d1aa [ruby/irb] Add a new easter egg: dancing ruby
e37dc7e58e
2020-02-02 03:22:51 +09:00
Nobuyoshi Nakada
a7e1e310dc
[ruby/irb] Exclude useless files from RDoc 2020-02-01 17:03:59 +09:00
Kenta Murata
51a8055d7d [ruby/irb] Add newline_before_multiline_output
9eb1801a66
2020-01-21 09:51:16 +09:00
Lars Kanis
f451bb5406 [ruby/irb] Fix compatibility with rails before 5.2
Rails before 5.2 added Array#append as an alias to Array#<< ,
so that it expects only one argument.
However ruby-2.5 added Array#append as an alias to Array#push
which takes any number of arguments.

If irb completion is used in `rails c` (for example "IO.<tab>")
it fails with:
  irb/completion.rb:206:in `<<': wrong number of arguments (given 3, expected 1) (ArgumentError)

Using Array#push instead of Array#append fixes compatibility.

5b7bbf9c34
2020-01-20 19:13:19 +09:00
aycabta
8c3efa4940 Use Reline.encoding_system_needs if exists 2020-01-14 15:40:38 +09:00
aycabta
a2638c0d87 Remove an unused setting variable 2020-01-14 15:40:38 +09:00
Ben
c94025b630 [ruby/irb] Fix crashing when multiple open braces per line
https://github.com/ruby/irb/issues/55

If we had put multiple open braces on a line the with no closing brace
spaces_of_nest array keeps getting '0' added to it. This means that when
we pop off of this array we are saying that we should be in position zero
for the next line. This is an issue because we don't always want to be
in position 0 after a closing brace.

Example:
```
[[[
]
]
]
```
In the above example the 'spaces_of_nest' array looks like this after
the first line is entered: [0,0,0]. We really want to be indented 4
spaces for the 1st closing brace 2 for the 2nd and 0 for the 3rd. i.e.
we want it to be: [0,2,4].

We also saw this issue with a heredoc inside of an array.

```
[<<FOO]
hello
FOO
```

80c69c8272
2020-01-14 15:40:38 +09:00
Ben
9994eb8a5e [ruby/irb] Fix newline depth with multiple braces
This commit fixes the check_newline_depth_difference method to multiple
open braces on one line into account. Before this change we were
subtracting from the depth in check_newline_depth_difference on
every open brace. This is the right thing to do if the opening and
closing brace are on the same line. For example in a method definition we
have an opening and closing parentheses we want to add 1 to our depth,
and then remove it.

```
def foo()
end
```

However this isn't the correct behavior when the brace spans multiple
lines. If a brace spans multiple lines we don't want to subtract from
check_newline_depth_difference and we want to treat the braces the same
way as we do `end` and allow check_corresponding_token_depth to pop the
correct depth.

Example of bad behavior:

```
def foo()
  [
  ]
puts 'bar'
end
```

Example of desired behavior:

```
def foo()
  [
  ]
  puts 'bar'
end
```

7dc8af01e0
2020-01-14 15:40:38 +09:00
aycabta
8316b330fb [ruby/irb] Version 1.2.1
8da0c74640
2019-12-24 09:56:40 +09:00
aycabta
0e528ae9cb [ruby/irb] Remove warning message to bundle on Ruby 2.7.0
d9a7844f50
2019-12-24 09:56:40 +09:00
Yusuke Endoh
616f1357c3 [ruby/irb] Make nesting level up for 1.times do
Follow up of the previous commit

ab207353d3
2019-12-22 01:57:35 +09:00
Yusuke Endoh
a3cc2a2fbd [ruby/irb] Fix auto-indent for 1.times do
Fixes #47

6b8eca4635
2019-12-22 01:57:35 +09:00
Nobuyoshi Nakada
e68999c82c
Fixed misspellings
Fixed misspellings reported at [Bug #16437], for default gems.
2019-12-20 12:19:45 +09:00