summaryrefslogtreecommitdiff
path: root/lib/irb
AgeCommit message (Collapse)Author
3 days[ruby/irb] Bump version to v1.13.1Stan Lo
(https://github.com/ruby/irb/pull/951) https://github.com/ruby/irb/commit/66318d0a34
3 days[ruby/irb] Clarify that the context is IRB contextStan Lo
(https://github.com/ruby/irb/pull/950) https://github.com/ruby/irb/commit/8cde57f55a
4 days[ruby/irb] Change debug test workaround only enabled when output istomoya ishida
tty (https://github.com/ruby/irb/pull/949) https://github.com/ruby/irb/commit/3f231b8622
5 days[ruby/irb] Improve help message for no meta commandsStan Lo
(https://github.com/ruby/irb/pull/948) * Remove unnecessary code from command tests * Improve help message for no meta commands 1. Add placeholder values for both command category and description 2. Update help command's output to give different types of categories more explicit ordering https://github.com/ruby/irb/commit/b1ef58aeff
5 days[ruby/irb] Use flag instead of caller for `debug`'s binding.irbStan Lo
check (https://github.com/ruby/irb/pull/947) https://github.com/ruby/irb/commit/4a4d7a4279
5 days[ruby/irb] Avoid raising errors while running help for customKenichi Kamiya
commands (https://github.com/ruby/irb/pull/944) * Avoid raising errors while running help for custom commands Raising an error from the help command is not a pleasure for the end user, even if the command does not define any attributes * Update test/irb/command/test_custom_command.rb --------- https://github.com/ruby/irb/commit/c8bba9f8dc Co-authored-by: Stan Lo <stan001212@gmail.com>
6 daysSync IRB 241e061Stan Lo
6 days[ruby/irb] Add workaround for ruby/debug/test/console/irb_testtomoya ishida
failing with StdioInputMethod (https://github.com/ruby/irb/pull/943) https://github.com/ruby/irb/commit/acf3c1816e
7 days[ruby/irb] Bump version to v1.13.0Stan Lo
(https://github.com/ruby/irb/pull/941) * Bump version to v1.13.0 * Add Documentation category to changelog https://github.com/ruby/irb/commit/b9b1f35c99
7 days[ruby/irb] Let IRB::Color.colorable? always return true|falsetomoya ishida
(https://github.com/ruby/irb/pull/940) https://github.com/ruby/irb/commit/0bbe435ffe
12 days[ruby/irb] Suppress command return valuesStan Lo
(https://github.com/ruby/irb/pull/934) Since commands can't be chained with methods, their return values are not intended to be used. But if IRB keeps storing command return values as the last value, and print them, users may rely on such implicit behaviour. So to avoid such confusion, this commit suppresses command's return values. It also updates some commands that currently rely on this implicit behaviour. https://github.com/ruby/irb/commit/fa96bea76f
12 days[ruby/irb] Command registration should take both strings and symbolsStan Lo
as names (https://github.com/ruby/irb/pull/932) This will save users some heads scratching when they try to register a command with a string name and found that it doesn't work. I also rewrote converted custom command tests into integration tests to make test setup/cleanup easier. https://github.com/ruby/irb/commit/a91a212dbe
2024-04-24[ruby/irb] Memoize helper method instances with Singleton moduleStan Lo
(https://github.com/ruby/irb/pull/931) Some helpers, like Rails console's `app`, requires memoization of the helper's ivars. To support it IRB needs to memoize helper method instances as well. https://github.com/ruby/irb/commit/a96c7a6668
2024-04-24[ruby/irb] Revert "Memoize helper method instances with Singleton module"Stan Lo
This reverts commit https://github.com/ruby/irb/commit/169a9a2c3097. https://github.com/ruby/irb/commit/221b0a4928
2024-04-24[ruby/irb] Memoize helper method instances with Singleton moduleStan Lo
Some helpers, like Rails console's `app`, requires memoization of the helper's ivars. To support it IRB needs to memoize helper method instances as well. https://github.com/ruby/irb/commit/169a9a2c30
2024-04-23Sync IRB f9347b1 (#10611)Stan Lo
2024-04-20[ruby/irb] Stop using ExtendCommandBundle internallyStan Lo
(https://github.com/ruby/irb/pull/925) This module was used to extend both commands and helpers when they're not separated. Now that they are, and we have a Command module, we should move command-related logic to the Command module and update related references. This will make the code easier to understand and refactor in the future. https://github.com/ruby/irb/commit/f74ec97236
2024-04-20[ruby/irb] Remove exit command workaround, handle IRB_EXIT intomoya ishida
debug_readline (https://github.com/ruby/irb/pull/923) * Remove exit and exti! command workaround when executed outside of IRB Command was a method. It could be executed outside of IRB. Workaround for it is no longer needed. * Handle IRB_EXIT in debug mode * Add exit and exit! command in rdbg mode https://github.com/ruby/irb/commit/0b5dd6afd0
2024-04-17[ruby/irb] Remove internal-only methods from Command::Basetomoya ishida
(https://github.com/ruby/irb/pull/922) * Remove internal-only methods from Command::Base Command#ruby_args and Command#unwrap_string_literal are used for default command's argument backward compatibility. Moved these methods to another module to avoid being used from custom commands. * Update lib/irb/command/edit.rb --------- https://github.com/ruby/irb/commit/7405a841e8 Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-04-14[ruby/irb] Allow defining custom commands in IRBStan Lo
(https://github.com/ruby/irb/pull/886) This is a feature that has been requested for a long time. It is now possible to define custom commands in IRB. Example usage: ```ruby require "irb/command" class HelloCommand < IRB::Command::Base description "Prints hello world" category "My commands" help_message "It doesn't do more than printing hello world." def execute puts "Hello world" end end IRB::Command.register(:hello, HelloCommand) ``` https://github.com/ruby/irb/commit/888643467c
2024-04-12[ruby/irb] Pass statements to Context#evaluateStan Lo
(https://github.com/ruby/irb/pull/920) This has a few benefits: - We can keep hiding the evaluation logic inside the Context level, which has always been the convention until #824 was merged recently. - Although not an official API, gems like `debug` and `mission_control-jobs` patch `Context#evaluate` to wrap their own logic around it. This implicit contract was broken after #824, and this change restores it. In addition to the refactor, I also converted some context-level evaluation tests into integration tests, which are more robust and easier to maintain. https://github.com/ruby/irb/commit/b32aee4068
2024-04-10[ruby/irb] Centralize rstrip callsStan Lo
(https://github.com/ruby/irb/pull/918) https://github.com/ruby/irb/commit/97898b6251
2024-04-10[ruby/irb] Command implementation not by methodtomoya ishida
(https://github.com/ruby/irb/pull/824) * Command is not a method * Fix command test * Implement non-method command name completion * Add test for ExtendCommandBundle.def_extend_command * Add helper method install test * Remove spaces in command input parse * Remove command arg unquote in help command * Simplify Statement and handle execution in IRB::Irb * Tweak require, const name * Always install CommandBundle module to main object * Remove considering local variable in command or expression check * Remove unused method, tweak * Remove outdated comment for help command arg Co-authored-by: Stan Lo <stan001212@gmail.com> --------- https://github.com/ruby/irb/commit/8fb776e379 Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-03-26[ruby/irb] Fix a typo (https://github.com/ruby/irb/pull/912)Hiroshi SHIBATA
https://github.com/ruby/irb/commit/2057248e40
2024-03-25[ruby/irb] Cache RDoc::RI::Driver.newtomoya ishida
(https://github.com/ruby/irb/pull/911) * Cache RDoc::RI::Driver.new to improve performance and to avoid flaky test * Insert sleep to fix flaky rendering test that renders document dialog https://github.com/ruby/irb/commit/da84e6cb56
2024-03-18[ruby/irb] docs(help): Add latest options to ja help messageOKURA Masafumi
(https://github.com/ruby/irb/pull/903) https://github.com/ruby/irb/commit/3c6d452495
2024-03-16[ruby/irb] Fix irb_history saved to current directorytomoya ishida
(https://github.com/ruby/irb/pull/901) * Always save irb_history in HOME or XDG_CONFIG_HOME Also split irbrc search logic from irb_history search logic as a refactor * Remove IRB.conf[:RC_NAME_GENERATOR] because it's not configurable This conf is used to specify which irbrc to load. Need to configure before irbrc is loaded, so it's actually not configurable. This conf is also used for history file search, but it is configurable by conf[:HISTORY_FILE]. * remove rc_file_test because it is tested with rc_files, remove useless test setup * Make internal irbrc searching method private https://github.com/ruby/irb/commit/11d03a6ff7
2024-03-16[ruby/irb] Use markdown format for docsStan Lo
(https://github.com/ruby/irb/pull/890) * Convert irb.rb's document into markdown format * Hide should-be-private top-level methods from docs * Skip xmp.rb's docs * Declare lib/irb.rb's markup do it works in ruby/ruby too * Ignore docs folder https://github.com/ruby/irb/commit/e9a175e06b
2024-03-14[ruby/irb] Rescue from exceptions raised by #nameGo
(https://github.com/ruby/irb/pull/899) * Rescue from exceptions raised by #name Irb might terminate if the class overwrites `name` and raise errors. This commit rescue irb from termination. * fix for other unknown patterns https://github.com/ruby/irb/commit/35b87cf893
2024-03-14[ruby/irb] Add disable_irb command to disable debug of binding.irbhogelog
(https://github.com/ruby/irb/pull/898) * Add disable_irb command to disable debug of binding.irb * disable_irb doesn't override Kernel.exit Kernel.exit call is removed because disable_irb does not override Kernel.exit and workaround to https://bugs.ruby-lang.org/issues/18234 is not needed. https://github.com/ruby/irb/commit/29901e4f21
2024-03-08[ruby/irb] rdoc version lock is requiredalpaca-tc
(https://github.com/ruby/irb/pull/897) Some features of irb do not work properly when using the old rdoc. I have compared several major versions and found that it works as intended from 4.0.0. This problem occurs when there is a Gemfile.lock is installed with the old rdoc. I don't know why this Gemfile.lock installs an older rdoc than the ruby bundled rdoc, but specifying the version in the gemspec will at least prevent the problem. NOTE: ruby/irb#704 problem does not occur with this change. The following is test code. ``` ### Usage: ruby __FILE__.rb # # input RDoc and Tab # >> RDoc<Tab> # ### Expect: Display document of RDoc ### Actual: <internal:marshal>:34:in `load': instance of RDoc::Constant needs to have method `marshal_load' (TypeError) require "bundler/inline" gemfile(true) do source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'irb' # gem 'rdoc', '~> 4.0.0' gem 'rdoc', '~> 3.12.0' end require 'rdoc' require 'irb' IRB.start ``` https://github.com/ruby/irb/commit/1a1fbba020
2024-03-07[ruby/irb] Bump version to v1.12.0Stan Lo
(https://github.com/ruby/irb/pull/895) https://github.com/ruby/irb/commit/a79e84a692
2024-03-05[ruby/irb] Add the ability to fetch and load multiple irb files.Haroon Ahmed
(https://github.com/ruby/irb/pull/859) This allows hierarchy when loading rc files for example both files below are loaded; project/.irbrc ~/.irbrc https://github.com/ruby/irb/commit/b53ebc6655 Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-03-01[ruby/irb] Restructure workspace managementStan Lo
(https://github.com/ruby/irb/pull/888) * Remove dead irb_level method * Restructure workspace management Currently, workspace is an attribute of IRB::Context in most use cases. But when some workspace commands are used, like `pushws` or `popws`, a workspace will be created and used along side with the original workspace attribute. This complexity is not necessary and will prevent us from expanding multi-workspace support in the future. So this commit introduces a @workspace_stack ivar to IRB::Context so IRB can have a more natural way to manage workspaces. * Fix pushws without args * Always display workspace stack after related commands are used https://github.com/ruby/irb/commit/61560b99b3
2024-02-25[ruby/irb] Add help messages to `show_source` and `show_doc`Stan Lo
commands (https://github.com/ruby/irb/pull/887) * Add help message to the show_source command * Add help message to the show_doc command https://github.com/ruby/irb/commit/06f43aadb3
2024-02-25[ruby/irb] Refactor IRB::Context#promptingStan Lo
(https://github.com/ruby/irb/pull/889) https://github.com/ruby/irb/commit/7b323ee514
2024-02-23[ruby/irb] Remove useless loaded file checktomoya ishida
(https://github.com/ruby/irb/pull/885) https://github.com/ruby/irb/commit/f6d489658e
2024-02-23[ruby/irb] Remove remaining `frozen_string_literal: false` in lib/tomoya ishida
(https://github.com/ruby/irb/pull/883) https://github.com/ruby/irb/commit/4bfdb23ae6
2024-02-23[ruby/irb] Turn on frozen literal in filesStan Lo
(https://github.com/ruby/irb/pull/881) https://github.com/ruby/irb/commit/83d90550c2
2024-02-23[ruby/irb] Unroll extension method generationStan Lo
(https://github.com/ruby/irb/pull/882) * Unroll extension method generation Given we only have 2 remaining extension setter methods, both of which only take 1 argument and don't have any alias, the current method generation logic is overly complicated. This commit simplifies the method generation logic by simply defining the methods directly in the `IRB::Context` class. * Fix use_loader extension https://github.com/ruby/irb/commit/67eba5401b
2024-02-22[ruby/irb] Delete IRB::NotImplementedErrortomoya ishida
(https://github.com/ruby/irb/pull/878) https://github.com/ruby/irb/commit/6751778948
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/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/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-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/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-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