2018-02-27 12:07:30 +00:00
|
|
|
#: * `ruby` [<ruby options>]:
|
|
|
|
#: Run a Ruby instance with Homebrew's libraries loaded.
|
2018-10-08 22:48:52 -04:00
|
|
|
#:
|
|
|
|
#: *Example:* `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb`
|
|
|
|
|
|
|
|
require "cli_parser"
|
2018-02-27 12:07:30 +00:00
|
|
|
|
|
|
|
module Homebrew
|
|
|
|
module_function
|
|
|
|
|
2018-10-08 22:48:52 -04:00
|
|
|
def ruby_args
|
|
|
|
Homebrew::CLI::Parser.new do
|
|
|
|
usage_banner <<~EOS
|
2018-10-15 15:06:33 -04:00
|
|
|
`ruby` [<ruby options>]
|
2018-10-08 22:48:52 -04:00
|
|
|
|
|
|
|
Run a Ruby instance with Homebrew's libraries loaded.
|
|
|
|
|
|
|
|
*Example:* `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb`
|
|
|
|
EOS
|
|
|
|
switch "-e",
|
|
|
|
description: "Execute the provided string argument as a script."
|
|
|
|
switch :verbose
|
|
|
|
switch :debug
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-27 12:07:30 +00:00
|
|
|
def ruby
|
2018-10-08 22:48:52 -04:00
|
|
|
ruby_args.parse
|
|
|
|
|
2018-07-17 14:23:33 +02:00
|
|
|
exec ENV["HOMEBREW_RUBY_PATH"], "-I", $LOAD_PATH.join(File::PATH_SEPARATOR), "-rglobal", "-rdev-cmd/irb", *ARGV
|
2018-02-27 12:07:30 +00:00
|
|
|
end
|
|
|
|
end
|