ruby / ruby/irb

Add ruby irb.rb script on Windows install

Open
#344 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
478
Forks
158
Avg merge
1d 12h
Merged PRs (30d)
12

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the Windows-installed irb and irb.bat launchers first, focusing on how the embedded Ruby script is provided. Add an irb.rb launcher that supports the shown ruby.exe -x irb.rb command, then verify that IRB can be started from WSL without a separate Ruby installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.