Add brew vendor-gems command.
This simplifies the process of vendoring gems given `Gemfile` or `Gemfile.lock` changes.
This commit is contained in:
parent
1a78cc77d4
commit
390a7f5447
39
Library/Homebrew/dev-cmd/vendor-gems.rb
Normal file
39
Library/Homebrew/dev-cmd/vendor-gems.rb
Normal 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
|
||||
@ -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.
|
||||
|
||||
@ -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\.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user