irb
irb copied to clipboard
Add ruby irb.rb script on Windows install
Description
I was expecting that there would also be a irb.rb script, in addition to irb or irb.bat. So that one can run the Windows IRB also from within WSL, without having to install Ruby separately in WSL.
This can be done, by extracting the embedded ruby script from inside the irb file. y
cat irb.rb:
#!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'irb' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
Gem.use_gemdeps
version = ">= 0.a"
str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('irb', 'irb', version)
else
gem "irb", version
load Gem.bin_path("irb", "irb", version)
end
Now you can run it with: ruby.exe -x irb.rb.
Result of irb_info
Ruby version: 3.1.0
IRB version: irb 1.4.1 (2021-12-25)
InputMethod: ReidlineInputMethod with Reline 0.3.0
RUBY_PLATFORM: x64-mingw-ucrt
East Asian Ambiguous Width: 1
Code page: 65001
Terminal Emulator
What's your terminal emulator?
Any
Setting Files
Are you using ~/.irbrc and ~/.inputrc?
NO
I'm not sure what's your request.
irb.rb was generated by rubygems when you install irb. We will not include it with gem file.