Skip to content
Snippets Groups Projects
Unverified Commit 36c10edf authored by Bo Anderson's avatar Bo Anderson Committed by GitHub
Browse files

Merge pull request #8196 from Bo98/ruby-args

dev-cmd/ruby: improve args passing
parents 15fba122 b57b83fe
No related branches found
No related tags found
No related merge requests found
......@@ -13,21 +13,26 @@ module Homebrew
Run a Ruby instance with Homebrew's libraries loaded, e.g.
`brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb`.
EOS
switch "-r",
description: "Load a library using `require`."
switch "-e",
description: "Execute the given text string as a script."
flag "-r=",
description: "Load a library using `require`."
flag "-e=",
description: "Execute the given text string as a script."
end
end
def ruby
ruby_args.parse
args = ruby_args.parse
ruby_sys_args = []
ruby_sys_args << "-r#{args.r}" if args.r
ruby_sys_args << "-e #{args.e}" if args.e
ruby_sys_args += args.named
begin
safe_system RUBY_PATH,
"-I", $LOAD_PATH.join(File::PATH_SEPARATOR),
"-rglobal", "-rdev-cmd/irb",
*ARGV
*ruby_sys_args
rescue ErrorDuringExecution => e
exit e.status.exitstatus
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment