style: Fix style errors

This commit is contained in:
Gautham Goli 2018-10-02 19:54:22 +05:30
parent 604dfb4ae6
commit 7b0f27ca39
No known key found for this signature in database
GPG Key ID: 6A9ABBC284468364
12 changed files with 49 additions and 43 deletions

View File

@ -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

View File

@ -53,11 +53,11 @@ module Homebrew
`bump-formula-pr` <options> <formula>:
Creates a pull request to update the formula with a new URL or a new tag.
If a <URL> is specified, the <sha-256> checksum of the new download must
also be specified. A best effort to determine the <sha-256> and <formula>
name will be made if either or both values are not supplied by the user.
If a <tag> is specified, the git commit <revision> 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 <URL> for the formula. If a <URL> is specified, the <sha-256> "\
"checksum of the new download must also be specified."
flag "--revision=",
flag "--revision=",
description: "Specify the new git commit <revision> corresponding to a specified <tag>."
flag "--tag=", required_for: "--revision=",
flag "--tag=",
required_for: "--revision=",
description: "Specify the new git commit <tag> for the formula."
flag "--sha256=", depends_on: "--url=",
flag "--sha256=",
depends_on: "--url=",
description: "Specify the <sha-256> checksum of new download."
flag "--mirror=",
flag "--mirror=",
description: "Use the provided <URL> as a mirror URL."
flag "--version=",
flag "--version=",
description: "Use the provided <version> 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 <message> 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

View File

@ -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

View File

@ -156,8 +156,10 @@ module Homebrew
ronn_output = ronn.read
odie "Got no output from ronn!" unless ronn_output
ronn_output.gsub!(%r{</var>`(?=[.!?,;:]?\s)}, "").gsub!(%r{</?var>}, "`") if format_flag == "--markdown"
ronn_output = ronn_output.gsub(%r{<code>}, "\\fB").gsub(%r{</code>}, "\\fR")
.gsub(%r{<var>}, "\\fI").gsub(%r{</var>}, "\\fR") unless format_flag == '--markdown'
unless format_flag == "--markdown"
ronn_output = ronn_output.gsub(/<code>/, "\\fB").gsub(%r{</code>}, "\\fR")
.gsub(/<var>/, "\\fI").gsub(%r{</var>}, "\\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)

View File

@ -11,7 +11,7 @@ module Homebrew
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`mirror` <formulae>:
Reuploads the stable URL for a formula to Bintray to use it as a mirror.
EOS
switch :debug

View File

@ -1,7 +1,7 @@
#: * `prof` [ruby options]:
#: * `prof` [<ruby options>]:
#: Run Homebrew with the Ruby profiler.
#: For example:
#: brew prof readall
#: brew prof readall
module Homebrew
module_function

View File

@ -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 <patch-source> 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",

View File

@ -19,7 +19,7 @@ module Homebrew
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`tap-new` <user>/<repo>:
Generate the template files for a new tap.
EOS
switch :debug

View File

@ -1,4 +1,4 @@
#: * 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

View File

@ -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

View File

@ -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

View File

@ -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