brew/Library/Homebrew/dev-cmd/vendor-gems.rb

48 lines
985 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: false
# frozen_string_literal: true
require "formula"
2019-04-17 18:25:08 +09:00
require "cli/parser"
module Homebrew
module_function
def vendor_gems_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`vendor-gems`
Install and commit Homebrew's vendored gems.
EOS
2020-07-30 18:40:10 +02:00
max_named 0
end
end
def vendor_gems
vendor_gems_args.parse
Homebrew.install_bundler!
ohai "cd #{HOMEBREW_LIBRARY_PATH}"
HOMEBREW_LIBRARY_PATH.cd do
ohai "bundle install --standalone"
safe_system "bundle", "install", "--standalone"
ohai "bundle pristine"
safe_system "bundle", "pristine"
ohai "git add vendor/bundle"
system "git", "add", "vendor/bundle"
if Formula["gpg"].optlinked?
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