dev-cmd/: add Parser-based help text for remaining commands.
`brew ruby` now accepts only `-e`, verbose, and debug arguments.
This commit is contained in:
parent
ddf057f3dd
commit
63b3d400e0
@ -16,14 +16,17 @@ require "dev-cmd/bottle"
|
||||
require "dev-cmd/bump-formula-pr"
|
||||
require "dev-cmd/create"
|
||||
require "dev-cmd/edit"
|
||||
require "dev-cmd/extract"
|
||||
require "dev-cmd/formula"
|
||||
require "dev-cmd/irb"
|
||||
require "dev-cmd/linkage"
|
||||
require "dev-cmd/mirror"
|
||||
require "dev-cmd/prof"
|
||||
require "dev-cmd/pull"
|
||||
require "dev-cmd/extract"
|
||||
require "dev-cmd/release-notes"
|
||||
require "dev-cmd/ruby"
|
||||
require "dev-cmd/tap-new"
|
||||
require "dev-cmd/test"
|
||||
require "dev-cmd/tests"
|
||||
require "dev-cmd/update-test"
|
||||
|
||||
|
||||
@ -1,11 +1,23 @@
|
||||
#: * `prof` [<ruby options>]:
|
||||
#: Run Homebrew with the Ruby profiler.
|
||||
#: For example:
|
||||
#: brew prof readall
|
||||
#:
|
||||
#: *Example:* `brew prof readall`
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def prof_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
usage_banner <<~EOS
|
||||
`prof` [<ruby options>]:
|
||||
|
||||
Run Homebrew with the Ruby profiler.
|
||||
|
||||
*Example:* `brew prof readall`
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
def prof
|
||||
Homebrew.install_gem_setup_path! "ruby-prof"
|
||||
FileUtils.mkdir_p "prof"
|
||||
|
||||
@ -1,13 +1,32 @@
|
||||
#: * `ruby` [<ruby options>]:
|
||||
#: Run a Ruby instance with Homebrew's libraries loaded.
|
||||
#: For example:
|
||||
# brew ruby -e "puts :gcc.f.deps"
|
||||
# brew ruby script.rb
|
||||
#:
|
||||
#: *Example:* `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb`
|
||||
|
||||
require "cli_parser"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def ruby_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
usage_banner <<~EOS
|
||||
`ruby` [<ruby options>]:
|
||||
|
||||
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
|
||||
|
||||
def ruby
|
||||
ruby_args.parse
|
||||
|
||||
exec ENV["HOMEBREW_RUBY_PATH"], "-I", $LOAD_PATH.join(File::PATH_SEPARATOR), "-rglobal", "-rdev-cmd/irb", *ARGV
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
#: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] <formula>:
|
||||
#: Most formulae provide a test method. `brew test` <formula> runs this
|
||||
#: test method. There is no standard output or return code, but it should
|
||||
#: generally indicate to the user if something is wrong with the installed
|
||||
#: formula.
|
||||
#: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] <formulae>:
|
||||
#: Run the test method provided by a formula.
|
||||
#: There is no standard output or return code, but generally it should notify the
|
||||
#: user if something is wrong with the installed formula.
|
||||
#:
|
||||
#: To test the development or head version of a formula, use `--devel` or
|
||||
#: `--HEAD`.
|
||||
@ -13,7 +12,7 @@
|
||||
#: If `--keep-tmp` is passed, the temporary files created for the test are
|
||||
#: not deleted.
|
||||
#:
|
||||
#: Example: `brew install jruby && brew test jruby`
|
||||
#: *Example:* `brew install jruby && brew test jruby`
|
||||
|
||||
require "extend/ENV"
|
||||
require "formula_assertions"
|
||||
@ -23,6 +22,28 @@ require "timeout"
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def test_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
usage_banner <<~EOS
|
||||
`test` [<options>] <formulae>:
|
||||
|
||||
Run the test method provided by an installed formula.
|
||||
There is no standard output or return code, but generally it should notify the
|
||||
user if something is wrong with the installed formula.
|
||||
|
||||
*Example:* `brew install jruby && brew test jruby`
|
||||
EOS
|
||||
switch "--devel",
|
||||
description: "Test the development version of a formula."
|
||||
switch "--HEAD",
|
||||
description: "Test the head version of a formula."
|
||||
switch "--keep-tmp",
|
||||
description: "Keep the temporary files created for the test."
|
||||
switch :verbose
|
||||
switch :debug
|
||||
end
|
||||
end
|
||||
|
||||
def test
|
||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user