Skip to content

Commit 0b577c9

Browse files
Merge pull request #8313 from rubygems/deivid-rodriguez/improve-documentation-of-command-flags
Normalize command flag documentation and make sure all flags are documented
2 parents 8633a32 + 20a8348 commit 0b577c9

40 files changed

+390
-143
lines changed

bundler/lib/bundler/cli.rb

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def remove(*gems)
217217
method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
218218
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
219219
method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
220-
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
220+
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
221221
method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
222222
method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
223223
method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
@@ -227,10 +227,8 @@ def remove(*gems)
227227
method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
228228
method_option "standalone", type: :array, lazy_default: [], banner: "Make a bundle that can work without the Bundler runtime"
229229
method_option "system", type: :boolean, banner: "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
230-
method_option "trust-policy", alias: "P", type: :string, banner: "Gem trust policy (like gem install -P). Must be one of " +
231-
Bundler.rubygems.security_policy_keys.join("|")
232-
method_option "target-rbconfig", type: :string, banner: "rbconfig.rb for the deployment target platform"
233-
230+
method_option "trust-policy", alias: "P", type: :string, banner: "Gem trust policy (like gem install -P). Must be one of #{Bundler.rubygems.security_policy_keys.join("|")}"
231+
method_option "target-rbconfig", type: :string, banner: "Path to rbconfig.rb for the deployment target platform"
234232
method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group."
235233
method_option "with", type: :array, banner: "Include gems that are part of the specified named group."
236234
def install
@@ -288,10 +286,8 @@ def update(*gems)
288286
Show lists the names and versions of all gems that are required by your Gemfile.
289287
Calling show with [GEM] will list the exact location of that gem on your machine.
290288
D
291-
method_option "paths", type: :boolean,
292-
banner: "List the paths of all gems that are required by your Gemfile."
293-
method_option "outdated", type: :boolean,
294-
banner: "Show verbose output including whether gems are outdated."
289+
method_option "paths", type: :boolean, banner: "List the paths of all gems that are required by your Gemfile."
290+
method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated."
295291
def show(gem_name = nil)
296292
if ARGV.include?("--outdated")
297293
message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement"
@@ -400,9 +396,7 @@ def fund
400396
end
401397

402398
desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
403-
method_option "all", type: :boolean,
404-
default: Bundler.feature_flag.cache_all?,
405-
banner: "Include all sources (including path and git)."
399+
method_option "all", type: :boolean, default: Bundler.feature_flag.cache_all?, banner: "Include all sources (including path and git)."
406400
method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one"
407401
method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
408402
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
@@ -440,8 +434,8 @@ def cache
440434
map aliases_for("cache")
441435

442436
desc "exec [OPTIONS]", "Run the command in context of the bundle"
443-
method_option :keep_file_descriptors, type: :boolean, default: true
444-
method_option :gemfile, type: :string, required: false
437+
method_option :keep_file_descriptors, type: :boolean, default: true, banner: "Passes all file descriptors to the new processes. Default is true, and setting it to false is deprecated"
438+
method_option :gemfile, type: :string, required: false, banner: "Use the specified gemfile instead of Gemfile"
445439
long_desc <<-D
446440
Exec runs a command, providing it access to the gems in the bundle. While using
447441
bundle exec you can require and call the bundled gems as if they were installed
@@ -540,23 +534,15 @@ def viz
540534
desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
541535
method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], desc: "Generate a binary executable for your library."
542536
method_option :coc, type: :boolean, desc: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
543-
method_option :edit, type: :string, aliases: "-e", required: false, banner: "EDITOR",
544-
lazy_default: [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
545-
desc: "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
537+
method_option :edit, type: :string, aliases: "-e", required: false, banner: "EDITOR", lazy_default: [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, desc: "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
546538
method_option :ext, type: :string, desc: "Generate the boilerplate for C extension code.", enum: EXTENSIONS
547539
method_option :git, type: :boolean, default: true, desc: "Initialize a git repo inside your library."
548540
method_option :mit, type: :boolean, desc: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
549541
method_option :rubocop, type: :boolean, desc: "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
550542
method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
551-
method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library",
552-
enum: %w[rspec minitest test-unit],
553-
desc: "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
554-
method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "",
555-
enum: %w[github gitlab circle],
556-
desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
557-
method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "",
558-
enum: %w[rubocop standard],
559-
desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
543+
method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library", enum: %w[rspec minitest test-unit], desc: "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
544+
method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "", enum: %w[github gitlab circle], desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
545+
method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "", enum: %w[rubocop standard], desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
560546
method_option :github_username, type: :string, default: Bundler.settings["gem.github_username"], banner: "Set your username on GitHub", desc: "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
561547

562548
def gem(name)

bundler/lib/bundler/man/bundle-add.1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,36 @@
99
Adds the named gem to the [\fBGemfile(5)\fR][Gemfile(5)] and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
1010
.SH "OPTIONS"
1111
.TP
12-
\fB\-\-version\fR, \fB\-v\fR
12+
\fB\-\-version=VERSION\fR, \fB\-v=VERSION\fR
1313
Specify version requirements(s) for the added gem\.
1414
.TP
15-
\fB\-\-group\fR, \fB\-g\fR
15+
\fB\-\-group=GROUP\fR, \fB\-g=GROUP\fR
1616
Specify the group(s) for the added gem\. Multiple groups should be separated by commas\.
1717
.TP
18-
\fB\-\-source\fR, \fB\-s\fR
18+
\fB\-\-source=SOURCE\fR, \fB\-s=SOURCE\fR
1919
Specify the source for the added gem\.
2020
.TP
21-
\fB\-\-require\fR, \fB\-r\fR
21+
\fB\-\-require=REQUIRE\fR, \fB\-r=REQUIRE\fR
2222
Adds require path to gem\. Provide false, or a path as a string\.
2323
.TP
24-
\fB\-\-path\fR
24+
\fB\-\-path=PATH\fR
2525
Specify the file system path for the added gem\.
2626
.TP
27-
\fB\-\-git\fR
27+
\fB\-\-git=GIT\fR
2828
Specify the git source for the added gem\.
2929
.TP
30-
\fB\-\-github\fR
30+
\fB\-\-github=GITHUB\fR
3131
Specify the github source for the added gem\.
3232
.TP
33-
\fB\-\-branch\fR
33+
\fB\-\-branch=BRANCH\fR
3434
Specify the git branch for the added gem\.
3535
.TP
36-
\fB\-\-ref\fR
36+
\fB\-\-ref=REF\fR
3737
Specify the git ref for the added gem\.
3838
.TP
39+
\fB\-\-glob=GLOB\fR
40+
Specify the location of a dependency's \.gemspec, expanded within Ruby (single quotes recommended)\.
41+
.TP
3942
\fB\-\-quiet\fR
4043
Do not print progress information to the standard output\.
4144
.TP

bundler/lib/bundler/man/bundle-add.1.ronn

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,36 @@ Adds the named gem to the [`Gemfile(5)`][Gemfile(5)] and run `bundle install`.
1414

1515
## OPTIONS
1616

17-
* `--version`, `-v`:
17+
* `--version=VERSION`, `-v=VERSION`:
1818
Specify version requirements(s) for the added gem.
1919

20-
* `--group`, `-g`:
20+
* `--group=GROUP`, `-g=GROUP`:
2121
Specify the group(s) for the added gem. Multiple groups should be separated by commas.
2222

23-
* `--source`, `-s`:
23+
* `--source=SOURCE`, `-s=SOURCE`:
2424
Specify the source for the added gem.
2525

26-
* `--require`, `-r`:
26+
* `--require=REQUIRE`, `-r=REQUIRE`:
2727
Adds require path to gem. Provide false, or a path as a string.
2828

29-
* `--path`:
29+
* `--path=PATH`:
3030
Specify the file system path for the added gem.
3131

32-
* `--git`:
32+
* `--git=GIT`:
3333
Specify the git source for the added gem.
3434

35-
* `--github`:
35+
* `--github=GITHUB`:
3636
Specify the github source for the added gem.
3737

38-
* `--branch`:
38+
* `--branch=BRANCH`:
3939
Specify the git branch for the added gem.
4040

41-
* `--ref`:
41+
* `--ref=REF`:
4242
Specify the git ref for the added gem.
4343

44+
* `--glob=GLOB`:
45+
Specify the location of a dependency's .gemspec, expanded within Ruby (single quotes recommended).
46+
4447
* `--quiet`:
4548
Do not print progress information to the standard output.
4649

bundler/lib/bundler/man/bundle-binstubs.1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.SH "NAME"
55
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
66
.SH "SYNOPSIS"
7-
\fBbundle binstubs\fR \fIGEM_NAME\fR [\-\-force] [\-\-path PATH] [\-\-standalone]
7+
\fBbundle binstubs\fR \fIGEM_NAME\fR [\-\-force] [\-\-path PATH] [\-\-standalone] [\-\-all\-platforms]
88
.SH "DESCRIPTION"
99
Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it into \fBbin/\fR\. Binstubs are a shortcut\-or alternative\- to always using \fBbundle exec\fR\. This gives you a file that can be run directly, and one that will always run the correct gem version used by the application\.
1010
.P
@@ -16,15 +16,18 @@ This command generates binstubs for executables in \fBGEM_NAME\fR\. Binstubs are
1616
\fB\-\-force\fR
1717
Overwrite existing binstubs if they exist\.
1818
.TP
19-
\fB\-\-path\fR
19+
\fB\-\-path[=PATH]\fR
2020
The location to install the specified binstubs to\. This defaults to \fBbin\fR\.
2121
.TP
2222
\fB\-\-standalone\fR
2323
Makes binstubs that can work without depending on Rubygems or Bundler at runtime\.
2424
.TP
25-
\fB\-\-shebang\fR
25+
\fB\-\-shebang=SHEBANG\fR
2626
Specify a different shebang executable name than the default (default 'ruby')
2727
.TP
2828
\fB\-\-all\fR
2929
Create binstubs for all gems in the bundle\.
30+
.TP
31+
\fB\-\-all\-platforms\fR
32+
Install binstubs for all platforms\.
3033

bundler/lib/bundler/man/bundle-binstubs.1.ronn

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ bundle-binstubs(1) -- Install the binstubs of the listed gems
33

44
## SYNOPSIS
55

6-
`bundle binstubs` <GEM_NAME> [--force] [--path PATH] [--standalone]
6+
`bundle binstubs` <GEM_NAME> [--force] [--path PATH] [--standalone] [--all-platforms]
77

88
## DESCRIPTION
99

@@ -27,15 +27,18 @@ Calling binstubs with [GEM [GEM]] will create binstubs for all given gems.
2727
* `--force`:
2828
Overwrite existing binstubs if they exist.
2929

30-
* `--path`:
30+
* `--path[=PATH]`:
3131
The location to install the specified binstubs to. This defaults to `bin`.
3232

3333
* `--standalone`:
3434
Makes binstubs that can work without depending on Rubygems or Bundler at
3535
runtime.
3636

37-
* `--shebang`:
37+
* `--shebang=SHEBANG`:
3838
Specify a different shebang executable name than the default (default 'ruby')
3939

4040
* `--all`:
4141
Create binstubs for all gems in the bundle.
42+
43+
* `--all-platforms`:
44+
Install binstubs for all platforms.

bundler/lib/bundler/man/bundle-cache.1

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,39 @@
44
.SH "NAME"
55
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
66
.SH "SYNOPSIS"
7-
\fBbundle cache\fR
7+
\fBbundle cache\fR [\fIOPTIONS\fR]
88
.P
99
alias: \fBpackage\fR, \fBpack\fR
1010
.SH "DESCRIPTION"
1111
Copy all of the \fB\.gem\fR files needed to run the application into the \fBvendor/cache\fR directory\. In the future, when running \fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR, use the gems in the cache in preference to the ones on \fBrubygems\.org\fR\.
12+
.SH "OPTIONS"
13+
.TP
14+
\fB\-\-all\fR
15+
Include all sources (including path and git)\.
16+
.TP
17+
\fB\-\-all\-platforms\fR
18+
Include gems for all platforms present in the lockfile, not only the current one\.
19+
.TP
20+
\fB\-\-cache\-path=CACHE\-PATH\fR
21+
Specify a different cache path than the default (vendor/cache)\.
22+
.TP
23+
\fB\-\-gemfile=GEMFILE\fR
24+
Use the specified gemfile instead of Gemfile\.
25+
.TP
26+
\fB\-\-no\-install\fR
27+
Don't install the gems, only update the cache\.
28+
.TP
29+
\fB\-\-no\-prune\fR
30+
Don't remove stale gems from the cache\.
31+
.TP
32+
\fB\-\-path=PATH\fR
33+
Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME)\.
34+
.TP
35+
\fB\-\-quiet\fR
36+
Only output warnings and errors\.
37+
.TP
38+
\fB\-\-frozen\fR
39+
Do not allow the Gemfile\.lock to be updated after this bundle cache operation's install\.
1240
.SH "GIT AND PATH GEMS"
1341
The \fBbundle cache\fR command can also package \fB:git\fR and \fB:path\fR dependencies besides \.gem files\. This needs to be explicitly enabled via the \fB\-\-all\fR option\. Once used, the \fB\-\-all\fR option will be remembered\.
1442
.SH "SUPPORT FOR MULTIPLE PLATFORMS"

bundler/lib/bundler/man/bundle-cache.1.ronn

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ bundle-cache(1) -- Package your needed `.gem` files into your application
33

44
## SYNOPSIS
55

6-
`bundle cache`
6+
`bundle cache` [*OPTIONS*]
77

88
alias: `package`, `pack`
99

@@ -13,6 +13,35 @@ Copy all of the `.gem` files needed to run the application into the
1313
`vendor/cache` directory. In the future, when running [`bundle install(1)`](bundle-install.1.html),
1414
use the gems in the cache in preference to the ones on `rubygems.org`.
1515

16+
## OPTIONS
17+
18+
* `--all`:
19+
Include all sources (including path and git).
20+
21+
* `--all-platforms`:
22+
Include gems for all platforms present in the lockfile, not only the current one.
23+
24+
* `--cache-path=CACHE-PATH`:
25+
Specify a different cache path than the default (vendor/cache).
26+
27+
* `--gemfile=GEMFILE`:
28+
Use the specified gemfile instead of Gemfile.
29+
30+
* `--no-install`:
31+
Don't install the gems, only update the cache.
32+
33+
* `--no-prune`:
34+
Don't remove stale gems from the cache.
35+
36+
* `--path=PATH`:
37+
Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).
38+
39+
* `--quiet`:
40+
Only output warnings and errors.
41+
42+
* `--frozen`:
43+
Do not allow the Gemfile.lock to be updated after this bundle cache operation's install.
44+
1645
## GIT AND PATH GEMS
1746

1847
The `bundle cache` command can also package `:git` and `:path` dependencies

bundler/lib/bundler/man/bundle-check.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ If the lockfile needs to be updated then it will be resolved using the gems inst
1616
\fB\-\-dry\-run\fR
1717
Locks the [\fBGemfile(5)\fR][Gemfile(5)] before running the command\.
1818
.TP
19-
\fB\-\-gemfile\fR
19+
\fB\-\-gemfile=GEMFILE\fR
2020
Use the specified gemfile instead of the [\fBGemfile(5)\fR][Gemfile(5)]\.
2121
.TP
22-
\fB\-\-path\fR
22+
\fB\-\-path=PATH\fR
2323
Specify a different path than the system default (\fB$BUNDLE_PATH\fR or \fB$GEM_HOME\fR)\. Bundler will remember this value for future installs on this machine\.
2424

bundler/lib/bundler/man/bundle-check.1.ronn

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ installed on the local machine, if they satisfy the requirements.
2222

2323
* `--dry-run`:
2424
Locks the [`Gemfile(5)`][Gemfile(5)] before running the command.
25-
* `--gemfile`:
25+
26+
* `--gemfile=GEMFILE`:
2627
Use the specified gemfile instead of the [`Gemfile(5)`][Gemfile(5)].
27-
* `--path`:
28+
29+
* `--path=PATH`:
2830
Specify a different path than the system default (`$BUNDLE_PATH` or `$GEM_HOME`).
2931
Bundler will remember this value for future installs on this machine.

bundler/lib/bundler/man/bundle-doctor.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ Missing dependencies
2525
\fB\-\-quiet\fR
2626
Only output warnings and errors\.
2727
.TP
28-
\fB\-\-gemfile=<gemfile>\fR
28+
\fB\-\-gemfile=GEMFILE\fR
2929
The location of the Gemfile(5) which Bundler should use\. This defaults to a Gemfile(5) in the current working directory\. In general, Bundler will assume that the location of the Gemfile(5) is also the project's root and will try to find \fBGemfile\.lock\fR and \fBvendor/cache\fR relative to this location\.
3030

0 commit comments

Comments
 (0)