diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 8ef63c7232..0de33a37e7 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -125,7 +125,7 @@ module Homebrew end def global_option?(name) - Homebrew::CLI::Parser.global_options.has_key?(name.to_sym) + Homebrew::CLI::Parser.global_options.key?(name.to_sym) end private diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 8b7aae6c98..9755b009a5 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -53,11 +53,11 @@ module Homebrew `bump-formula-pr` : Creates a pull request to update the formula with a new URL or a new tag. - + If a is specified, the checksum of the new download must also be specified. A best effort to determine the and name will be made if either or both values are not supplied by the user. - + If a is specified, the git commit corresponding to that tag must also be specified. @@ -66,41 +66,43 @@ module Homebrew specification, nor vice versa. It must use whichever style specification the preexisting formula already uses. EOS - switch "--devel", + switch "--devel", description: "Bump the development rather than stable version. The development spec must already exist." - switch "-n", "--dry-run", + switch "-n", "--dry-run", description: "Print what would be done rather than doing it." - switch "--write", + switch "--write", description: "When passed along with `--dry-run`, perform a not-so-dry run making the expected "\ "file modifications but not taking any git actions." - switch "--audit", + switch "--audit", description: "Run `brew audit` before opening the PR." - switch "--strict", + switch "--strict", description: "Run `brew audit --strict` before opening the PR." - switch "--no-browse", + switch "--no-browse", description: "Output the pull request URL instead of opening in a browser" - flag "--url=", + flag "--url=", description: "Provide new for the formula. If a is specified, the "\ "checksum of the new download must also be specified." - flag "--revision=", + flag "--revision=", description: "Specify the new git commit corresponding to a specified ." - flag "--tag=", required_for: "--revision=", + flag "--tag=", + required_for: "--revision=", description: "Specify the new git commit for the formula." - flag "--sha256=", depends_on: "--url=", + flag "--sha256=", + depends_on: "--url=", description: "Specify the checksum of new download." - flag "--mirror=", + flag "--mirror=", description: "Use the provided as a mirror URL." - flag "--version=", + flag "--version=", description: "Use the provided to override the value parsed from the URL or tag. Note "\ "that `--version=0` can be used to delete an existing `version` override from a "\ "formula if it has become redundant." - flag "--message=", + flag "--message=", description: "Append provided to the default PR message." - switch :quiet - switch :force - switch :verbose - switch :debug + switch :quiet + switch :force + switch :verbose + switch :debug conflicts "--url", "--tag" end end diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 4638d302c9..af24a8a677 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -31,7 +31,8 @@ module Homebrew EOS switch "--examples", description: "Show several examples." - switch "--pry", env: :pry, + switch "--pry", + env: :pry, description: "Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set." end end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 177dd8fb98..8548c8357c 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -156,8 +156,10 @@ module Homebrew ronn_output = ronn.read odie "Got no output from ronn!" unless ronn_output ronn_output.gsub!(%r{`(?=[.!?,;:]?\s)}, "").gsub!(%r{}, "`") if format_flag == "--markdown" - ronn_output = ronn_output.gsub(%r{}, "\\fB").gsub(%r{}, "\\fR") - .gsub(%r{}, "\\fI").gsub(%r{}, "\\fR") unless format_flag == '--markdown' + unless format_flag == "--markdown" + ronn_output = ronn_output.gsub(//, "\\fB").gsub(%r{}, "\\fR") + .gsub(//, "\\fI").gsub(%r{}, "\\fR") + end target.atomic_write ronn_output end end @@ -192,11 +194,11 @@ module Homebrew end def cmd_arg_parser(cmd_path) - "#{cmd_path.basename.to_s.gsub('.rb', '').gsub('-', '_')}_args".to_sym + "#{cmd_path.basename.to_s.gsub(".rb", "").tr("-", "_")}_args".to_sym end def cmd_manpage_lines(cmd_parser) - lines = ["#{format_usage_banner(cmd_parser.usage_banner_text)}"] + lines = [format_usage_banner(cmd_parser.usage_banner_text)] lines += cmd_parser.processed_options.map do |short, long, _, desc| next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long)) generate_option_doc(short, long, desc) diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index 95144f93eb..a707e1dc7e 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -11,7 +11,7 @@ module Homebrew Homebrew::CLI::Parser.new do usage_banner <<~EOS `mirror` : - + Reuploads the stable URL for a formula to Bintray to use it as a mirror. EOS switch :debug diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index ebf9dc98e3..f2750e83c2 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -1,7 +1,7 @@ -#: * `prof` [ruby options]: +#: * `prof` []: #: Run Homebrew with the Ruby profiler. #: For example: -#: brew prof readall +#: brew prof readall module Homebrew module_function diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index a1a35d51df..26c597e8e2 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -79,18 +79,18 @@ module Homebrew Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. - + Each may be one of: - + ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository - + ~ The URL of a PR on GitHub, using either the web page or API URL formats. In this form, the PR may be on Homebrew/brew, Homebrew/homebrew-core or any tap. - + ~ The URL of a commit on GitHub - + ~ A "https://jenkins.brew.sh/job/..." string specifying a testing job ID EOS switch "--bottle", diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index a658aa0f73..92ff6a40b9 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -19,7 +19,7 @@ module Homebrew Homebrew::CLI::Parser.new do usage_banner <<~EOS `tap-new` /: - + Generate the template files for a new tap. EOS switch :debug diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 849c004205..1e74496dc5 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -1,4 +1,4 @@ -#: * test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: +#: * `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 diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index 3d334901bd..a73ad81981 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -40,7 +40,7 @@ module Homebrew def help(cmd = nil, flags = {}) # Let OptionParser generate help text for commands which have a parser defined begin - Homebrew.send("#{cmd.gsub('-','_')}_args".to_sym) + Homebrew.send("#{cmd.tr("-", "_")}_args".to_sym) return rescue NoMethodError nil diff --git a/docs/Manpage.md b/docs/Manpage.md index e80ac95c32..c5977786e0 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -832,13 +832,14 @@ Return a failing status code if changes are detected in the manpage outputs. Thi It is now done automatically by `brew update`. ###`mirror` `formulae`: - + Reuploads the stable URL for a formula to Bintray to use it as a mirror. - * `prof` [ruby options]: + * `prof` [`ruby options`]: Run Homebrew with the Ruby profiler. For example: + brew prof readall ###pull `options` `formula`: @@ -895,11 +896,11 @@ Output as a Markdown list. For example: ###`tap-new` `user`/`repo`: - + Generate the template files for a new tap. - * test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: + * `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 diff --git a/manpages/brew.1 b/manpages/brew.1 index 9f5c57ff9e..4eed60923e 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -863,8 +863,8 @@ It is now done automatically by \fBbrew update\fR\. Reuploads the stable URL for a formula to Bintray to use it as a mirror\. . .TP -\fBprof\fR [ruby options] -Run Homebrew with the Ruby profiler\. For example: +\fBprof\fR [\fIruby options\fR] +Run Homebrew with the Ruby profiler\. For example: brew prof readall . .SS "pull \fIoptions\fR \fIformula\fR:" Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. @@ -943,7 +943,7 @@ Run a Ruby instance with Homebrew\'s libraries loaded\. For example: Generate the template files for a new tap\. . .TP -test [\-\-devel|\-\-HEAD] [\-\-debug] [\-\-keep\-tmp] [formula] +\fBtest\fR [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-debug\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR Most formulae provide a test method\. \fBbrew test\fR \fIformula\fR 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\. . .IP