diff --git a/Library/Homebrew/dev-cmd/vendor-gems.rb b/Library/Homebrew/dev-cmd/vendor-gems.rb new file mode 100644 index 0000000000..a902de4c75 --- /dev/null +++ b/Library/Homebrew/dev-cmd/vendor-gems.rb @@ -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 diff --git a/docs/Manpage.md b/docs/Manpage.md index 2de42a07d1..75caedb04d 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -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. diff --git a/manpages/brew.1 b/manpages/brew.1 index 6f533240bd..92f6d81df3 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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\.