summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2024-02-21[rubygems/rubygems] Use https instead of httpHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/bcbe6f7b7a
2024-02-20[ruby/uri] Use https instead of httpHiroshi SHIBATA
https://github.com/ruby/uri/commit/ad2591f0d1
2024-02-20[rubygems/rubygems] Keep Gem.install_extension_in_lib for compatibilityHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/b2bf239147
2024-02-20[rubygems/rubygems] Now install extension in lib is trueHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/bbcad80772
2024-02-20[rubygems/rubygems] Gem.install_extension_in_lib is now under the ↵Hiroshi SHIBATA
Gem.configuration https://github.com/rubygems/rubygems/commit/c394375b28
2024-02-20[rubygems/rubygems] Allow to set install_extension_in_lib as Gem configurationHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/c59d40f425
2024-02-19[ruby/prism] Fix up comment stateKevin Newton
https://github.com/ruby/prism/commit/c6561becf0
2024-02-19[rubygems/rubygems] Remove redundant rubocop configsDouglas Eichelberger
https://github.com/rubygems/rubygems/commit/a3f60240bf
2024-02-19[ruby/irb] Fix `irb:rdbg` for ruby headStan Lo
(https://github.com/ruby/irb/pull/876) * Update binding.irb check for Ruby head With https://github.com/ruby/ruby/pull/9605, backtrace in Ruby head now has a new format. This commit updates the check for binding.irb to work with Ruby head. * Do not include a backtick in error messages and backtraces [Feature #16495] --------- https://github.com/ruby/irb/commit/ebffd3d976 Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2024-02-18[ruby/prism] Lazy methods for start and end offset on nodeKevin Newton
https://github.com/ruby/prism/commit/4510e2746d
2024-02-18[ruby/prism] Split up comments between leading and trailingKevin Newton
Also make them lazy to allocate the array, and also expose ParseResult#encoding. https://github.com/ruby/prism/commit/08ec7683ae
2024-02-18[ruby/irb] Revamp `help` commandStan Lo
(https://github.com/ruby/irb/pull/877) * Make help command display help for individual commands Usage: `help [command]` If the command is not specified, it will display a list of all available commands. If the command is specified, it will display the banner OR description of the command. If the command is not found, it will display a message saying that the command is not found. * Rename test/irb/cmd to test/irb/command * Add banner to edit and ls commands * Promote help command in the help message 1. Make `show_cmds` an alias of `help` so it's not displayed in the help message 2. Update description of the help command to reflect `help <command>` syntax * Rename banner to help_message https://github.com/ruby/irb/commit/43a2c99f3f
2024-02-16[ruby/prism] Fix block_pass for []=Kevin Newton
https://github.com/ruby/prism/commit/bf79206220
2024-02-16[ruby/prism] More rescue and ensure; constant handlingNoah Gibbs
https://github.com/ruby/prism/commit/207f579e70
2024-02-16[ruby/prism] Move visit methods into a Ripper CompilerNoah Gibbs
https://github.com/ruby/prism/commit/44c4dc5268
2024-02-16[ruby/irb] Standardize command related namesStan Lo
(https://github.com/ruby/irb/pull/873) * Replace ExtendCommand with Command and standardize command related names 1. Rename lib/irb/extend-command.rb to lib/irb/command.rb 2. Rename lib/irb/cmd/*.rb to lib/irb/command/*.rb 3. Rename test/irb/test_cmd.rb to test/irb/test_command.rb 4. Rename ExtendCommand to Command * Alias ExtendCommand to Command and deprecate it * Rename Command::Nop to Command::Base * Not deprecate old constants just yet * Add lib/irb/cmd/nop.rb back https://github.com/ruby/irb/commit/462c1284af
2024-02-16[ruby/irb] Support repeating debugger input by passing empty inputStan Lo
to it (https://github.com/ruby/irb/pull/856) * Test IRB's behaviour with empty input * Handle empty input and pass it to debugger Since `rdbg` accepts empty input to repeat the previous command, IRB should take empty input in `irb:rdbg` sessions and pass them to the debugger. Currently, IRB simply ignores empty input and does nothing. This commit creates `EmptyInput` to represent empty input so it can fit into the current IRB's input processing flow in `Irb#eval_input`. https://github.com/ruby/irb/commit/0e9db419be
2024-02-16[ruby/prism] Fix lexing of `foo!` when it's a first thing to parseMax Prokopiev
https://github.com/ruby/prism/commit/7597aca76a
2024-02-16[rubygems/rubygems] Add `gitlab:` Git source shorthandJason Garber
This new shorthand, similar to the existing `github:` shorthand, adds support for Gitlab repositories with a notable difference. Gitlab projects may be organized into projects and subprojects. An example Ruby gem exists at: https://gitlab.com/gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb With the new shorthand, a user may install this gem from its repository by adding: ```ruby gem "gitlab-sdk", gitlab: "gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb" ``` As with the `github:` shorthand, a supplied string with no `/` will be interpreted as `example/example`. Also in keeping with the utility of the `github:` shorthand, the new `gitlab:` shorthand also supports Merge Request URLs. ```ruby gem "gitlab-sdk", gitlab: "https://gitlab.com/gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb/-/merge_requests/27" ``` The `gitlab:` gem source shortcut is modeled on the existing `github:` shortcut, so the new specs mimic the existing examples. https://github.com/rubygems/rubygems/commit/f4399018c0
2024-02-15[ruby/prism] Make location methods thread-safeBenoit Daloze
* Before it could result in NoMethodError if multiple threads were calling location methods: https://gist.github.com/eregon/b78b7f266d7ee0a278a389cfd1782232 https://github.com/ruby/prism/commit/ff762dcccd
2024-02-15[PRISM] Sync prism version bumpKevin Newton
2024-02-15[ruby/prism] Speed up creating Ruby ASTKevin Newton
When creating the Ruby AST, we were previously allocating Location objects for every node and every inner location. Instead, this commit changes it to pack both the start offset and length into a single u64 and pass that into the nodes. Then, when the locations are requested via a reader method, we lazily allocate the Location objects. https://github.com/ruby/prism/commit/de203dca83 Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2024-02-15[ruby/prism] Fix up invalid syntaxKevin Newton
https://github.com/ruby/prism/commit/8e3aad9e27
2024-02-15[ruby/prism] Handle more aliases. Better testing of prism ripper CLI and a ↵Noah Gibbs
test for it. https://github.com/ruby/prism/commit/cfd4f28cb3
2024-02-15[rubygems/rubygems] use full path for instance_evalCody Cutrer
so that __dir__ and __FILE__ will work properly from within that gemfile fragment, if eval_gemfile is given a relative path https://github.com/rubygems/rubygems/commit/d521bf9790
2024-02-15[ruby/prism] Avoid extra String copies in the FFI backendBenoit Daloze
* For Prism.parse_file the file contents would be read as native, then converted to a Ruby String, then converted to a native String for pm_serialize_parse(). * Refactor the logic to always use a pm_string for the source code and pass that to other native functions. https://github.com/ruby/prism/commit/9002b3c47d
2024-02-15[ruby/prism] Support multi-versioning for `Prism::Translation::Parser`Koichi ITO
## Summary Fixes https://github.com/ruby/prism/pull/2356. I'm working on integrating Prism into RuboCop. This PR introduces `Prism::Translation::Parser33` and `Prism::Translation::Parser34`, named in accordance with the following comments. https://github.com/rubocop/rubocop/issues/12600#issuecomment-1932707748 Currently, `Prism::Translation::Parser` always operates in Ruby 3.4 mode. This means it will not parse as Ruby 3.3 even if `TargetRubyVersion: 80_82_73_83_77.33` is specified. Therefore, the `it` introduced in Ruby 3.4 is parsed incompatibly with Ruby 3.3. In Ruby 3.3, the expected name for an `lvar` is `:it`, not `:"0it"`. ### Expected AST The following is an expected AST when parsing Ruby 3.3 code: ```console $ bundle exec ruby -rprism -rprism/translation/parser33 -ve "p Prism::Translation::Parser33.parse('items.map { it.do_something }')" ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] s(:block, s(:send, s(:send, nil, :items), :map), s(:args), s(:send, s(:send, nil, :it), :do_something)) ``` ### Actual AST The following is an actual AST when parsing Ruby 3.3 code: ```console $ ruby -rprism -ve "p Prism::Translation::Parser.parse('items.map { it.do_something }')" ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] s(:block, s(:send, s(:send, nil, :items), :map), s(:args), s(:send, s(:lvar, :"0it"), :do_something)) ``` `Prism::Translation::Parser33` and `Prism::Translation::Parser34` aim to correspond to Ruby 3.3 and Ruby 3.4, respectively. And, The hack of specifying `TargetRubyVersion: 80_82_73_83_77.33` is expected to become unnecessary in the future, but the behavior will be maintained until RuboCop's support is finalized: https://github.com/rubocop/rubocop/issues/12600#issuecomment-1933657732 ## Additional Information A private method named `convert_for_prism` is prepared to convert the `version` from Parser to the `version` expected by Prism. For example, a Parser-compatible value is `3.3`, whereas Prism expects `"3.3.0"`. `Parser#version` is not used in RuboCop, but it's unclear how it is utilized in other libraries that rely on the Parser gem. Therefore, logic to maintain compatibility between Parser and Prism is implemented. https://github.com/ruby/prism/commit/62d3991e22
2024-02-15Do not include a backtick in error messages and backtracesYusuke Endoh
[Feature #16495]
2024-02-14Initialize the Prism::Source directly with all 3 fields for the C extensionBenoit Daloze
* Faster that way: $ ruby -Ilib -rprism -rbenchmark/ips -e 'Benchmark.ips { |x| x.report("parse") { Prism.parse("1 + 2") } }' 195.722k (± 0.5%) i/s rb_iv_set(): 179.609k (± 0.5%) i/s rb_funcall(): 190.030k (± 0.3%) i/s before this PR: 183.319k (± 0.4%) i/s
2024-02-14[ruby/prism] Remove attr_writer's for ParseResult#start_line and #offsetsBenoit Daloze
* As the user should not set these. * Use #instance_variable_set/rb_iv_set() instead internally. https://github.com/ruby/prism/commit/cace09fb8c
2024-02-14[ruby/prism] Serialize the newline_list to avoid recomputing it again laterBenoit Daloze
* Fixes https://github.com/ruby/prism/issues/2380 https://github.com/ruby/prism/commit/4eaaa90114
2024-02-14[PRISM] Sync to latest prismKevin Newton
2024-02-14[ruby/irb] Repurpose the help command to display the help messageStan Lo
(https://github.com/ruby/irb/pull/872) See #787 for more details. https://github.com/ruby/irb/commit/d9192d92d0
2024-02-14[ruby/irb] Improve constant lookup in SourceFindertomoya ishida
(https://github.com/ruby/irb/pull/871) https://github.com/ruby/irb/commit/87c279ccf2
2024-02-13[ruby/prism] Add code unit APIs to locationKevin Newton
LSPs need this because the protocol dictates that you return code units for offsets. None of our existing APIs provided that information, and since we hid the source it's not nearly as useful for them. Now they can pass an encoding directly to: * Location#start_code_units_offset * Location#end_code_units_offset * Location#start_code_units_column * Location#end_code_units_column https://github.com/ruby/prism/commit/4757a2cc06 Co-Authored-By: Vinicius Stock <vinicius.stock@shopify.com>
2024-02-13[ruby/prism] Introduce `version: "3.4.0"`Kevin Newton
This is effectively an alias for "latest" right now. In the future it will change to be its own enum value. https://github.com/ruby/prism/commit/2c86036022
2024-02-13[ruby/prism] Fix `full_name` for constant path targetsVinicius Stock
https://github.com/ruby/prism/commit/84c10f3a2d
2024-02-13[ruby/irb] Fix SourceFinder's constant evaluation issueStan Lo
(https://github.com/ruby/irb/pull/869) Currently, if the signature's constant part is not defined, a NameError would be raised. ``` irb(main):001> show_source Foo (eval):1:in `<top (required)>': uninitialized constant Foo (NameError) Foo ^^^ from (irb):1:in `<main>' ``` This commit fixes the issue and simplifies the `edit` command's implementation. https://github.com/ruby/irb/commit/8c16e029d1
2024-02-13[ruby/irb] Refactor eval_path and `SourceFinder::Source`Stan Lo
(https://github.com/ruby/irb/pull/870) * Assign `@eval_path` through `irb_path=` method This simplifies the original caching logic for the `eval_path` method and makes it easier to understand. * Refactor SourceFinder::Source https://github.com/ruby/irb/commit/c63e4c4035
2024-02-13[ruby/reline] C for vi modeOtávio Schwanck dos Santos
(https://github.com/ruby/reline/pull/472) https://github.com/ruby/reline/commit/d197be7c44
2024-02-13[rubygems/rubygems] Update SPDX license list as of 2024-02-08License Update
https://github.com/rubygems/rubygems/commit/ec3de95d79
2024-02-12[ruby/irb] Powerup show_source by enabling RubyVM.keep_script_linestomoya ishida
(https://github.com/ruby/irb/pull/862) * Powerup show_source by enabling RubyVM.keep_script_lines * Add file_content field to avoid reading file twice while show_source * Change path passed to eval, don't change irb_path. * Encapsulate source coloring logic and binary file check insode class Source * Add edit command testcase when irb_path does not exist * Memoize irb_path existence to reduce file existence check calculating eval_path https://github.com/ruby/irb/commit/239683a937
2024-02-12[ruby/prism] ruby_parser translatorKevin Newton
https://github.com/ruby/prism/commit/1925b970c7
2024-02-12[ruby/prism] Move Prism::RipperCompat to Prism::Translation::RipperNoah Gibbs
https://github.com/ruby/prism/commit/c0331abe4f
2024-02-12[ruby/irb] Fix exit! command warning and method behaviortomoya ishida
(https://github.com/ruby/irb/pull/868) * Fix exit! command warning and method behavior * Remove arg(0) from Kernel.exit and Kernel.exit! https://github.com/ruby/irb/commit/372bc59bf5
2024-02-12Burn default ASAN options into the built RubyKJ Tsanaktsidis
* We always need use_sigaltstack=0 because Ruby registers sigaltstack handlers * We also need to disable leak detection (unless RUBY_FREE_AT_EXIT is set - I might experiment later with automatically enabling leak detection if RUBY_FREE_AT_EXIT is set). Burning it into the built ruby binary in this way avoids people needing to remember to start their Ruby program with these flags all the time. We also need a small fix in mkmf to make sure that test programs also don't have leak detection enabled (this is never desirable) [Bug #20256]
2024-02-11[ruby/optparse] [DOC] Add description of OptionParser#define_by_keywordsNobuyoshi Nakada
https://github.com/ruby/optparse/commit/451dea51a0
2024-02-11[ruby/optparse] [DOC] Add missing documentsNobuyoshi Nakada
https://github.com/ruby/optparse/commit/33956ce93f
2024-02-11[ruby/irb] Polish the exit! command and its testsStan Lo
(https://github.com/ruby/irb/pull/867) * Remove IRB.irb_exit! method It's not necessary to introduce a new method just for the exit! command at this moment. * Rename ExitForcedAction to ForceExit * Move force exit tests to a dedicated file * Fix nested history saving with exit! command Because we switched to use `Kernel#exit` instead of `exit!`, the outer session's ensure block in `Irb#run` will be run, which will save the history. This means the separate check to save history when force exiting is no longer necessary. * execute_lines helper should also capture IRB setup's output This prevents setup warnings from being printed to test output while allowing those output to be tested. * Update readme https://github.com/ruby/irb/commit/899d10ade1
2024-02-10[ruby/irb] Introduce exit! commandIgnacio Chiazzo Cardarello
(https://github.com/ruby/irb/pull/851) * Added failing test for when writing history on exit * Save history on exit * Exit early when calling Kernel.exit * use status 0 for kernel.exit * Added test for nested sessions * Update lib/irb.rb --------- https://github.com/ruby/irb/commit/c0a5f31679 Co-authored-by: Stan Lo <stan001212@gmail.com>