diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 332b3438ae..5a906d7c4a 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -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" diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index f2750e83c2..13e2abe688 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -1,11 +1,23 @@ #: * `prof` []: #: 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` []: + + 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" diff --git a/Library/Homebrew/dev-cmd/ruby.rb b/Library/Homebrew/dev-cmd/ruby.rb index f658529e07..957b068a26 100644 --- a/Library/Homebrew/dev-cmd/ruby.rb +++ b/Library/Homebrew/dev-cmd/ruby.rb @@ -1,13 +1,32 @@ #: * `ruby` []: #: 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` []: + + 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 diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 7eadd67598..c4e7943f36 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -1,8 +1,7 @@ -#: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] : -#: Most formulae provide a test method. `brew test` 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`] : +#: 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` [] : + + 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?