Add brew vendor-gems command.

This simplifies the process of vendoring gems given `Gemfile` or
`Gemfile.lock` changes.
This commit is contained in:
Mike McQuaid 2018-12-21 20:09:08 +00:00
parent 1a78cc77d4
commit 390a7f5447
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,39 @@
#: * `vendor-gems`:
#: Install and commit Homebrew's vendored gems.
require "formula"
require "cli_parser"
module Homebrew
module_function
def vendor_gems
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`vendor-gems`
Install and commit Homebrew's vendored gems.
EOS
switch :debug
end.parse
Homebrew.install_gem_setup_path! "bundler"
ohai "cd #{HOMEBREW_LIBRARY_PATH}/vendor"
(HOMEBREW_LIBRARY_PATH/"vendor").cd do
ohai "bundle install --standalone"
safe_system "bundle", "install", "--standalone"
ohai "git add bundle-standalone"
system "git", "add", "bundle-standalone"
if Formula["gpg"].installed?
ENV["PATH"] = PATH.new(ENV["PATH"])
.prepend(Formula["gpg"].opt_bin)
end
ohai "git commit"
system "git", "commit", "--message", "brew vendor-gems: commit updates."
end
end
end

View File

@ -984,6 +984,9 @@ If no arguments are passed, use `origin/master` as the start commit.
* `--before`:
Use the commit at provided *`date`* as the start commit.
* `vendor-gems`:
Install and commit Homebrew's vendored gems.
## GLOBAL OPTIONS
These options are applicable across all sub-commands.

View File

@ -1091,6 +1091,11 @@ Use provided \fIcommit\fR as the start commit\.
.TP
\fB\-\-before\fR
Use the commit at provided \fIdate\fR as the start commit\.
.
.TP
\fBvendor\-gems\fR
Install and commit Homebrew\'s vendored gems\.
.
.SH "GLOBAL OPTIONS"
These options are applicable across all sub\-commands\.