diff options
| author | Mike McQuaid | 2017-05-07 14:12:44 +0100 |
|---|---|---|
| committer | GitHub | 2017-05-07 14:12:44 +0100 |
| commit | 3e4547f52e7ebec633f8bfefc8a396d944edf908 (patch) | |
| tree | 59d478b0a91845c3706e6cd312e7d3469c0a594a /Library/Homebrew/utils.rb | |
| parent | 6edf9382bcc1240ad6f97c8b752cfe56cef9965d (diff) | |
| parent | ee253e465b8e2f5acdb53daf572311e87055e082 (diff) | |
| download | brew-3e4547f52e7ebec633f8bfefc8a396d944edf908.tar.bz2 | |
Merge pull request #2597 from MikeMcQuaid/vendor-gems
Vendor all Homebrew's gems.
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index c37633e41..60af39d93 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -221,6 +221,38 @@ module Homebrew EOS end + def run_bundler_if_needed! + return unless Pathname.glob("#{HOMEBREW_GEM_HOME}/bin/*").empty? + + if Gem::Specification.find_all_by_name("bundler").empty? + ohai "Installing Bundler..." + + # Do `gem install [...]` without having to spawn a separate process or + # having to find the right `gem` binary for the running Ruby interpreter. + require "rubygems/commands/install_command" + install_cmd = Gem::Commands::InstallCommand.new + install_cmd.handle_options(%w[--no-ri --no-rdoc bundler]) + exit_code = 1 # Should not matter as `install_cmd.execute` always throws. + begin + install_cmd.execute + rescue Gem::SystemExitException => e + exit_code = e.exit_code + end + odie "Failed to install Bundler!" if exit_code.nonzero? + end + + HOMEBREW_REPOSITORY.cd do + unless quiet_system("bundle", "check") + ohai "Installing RubyGems..." + success = system "bundle", "install", + "--path", "Library/Homebrew/vendor", + "--standalone", + "--jobs", "3" + odie "Failed to install RubyGems!" unless success + end + end + end + # Hash of Module => Set(method_names) @injected_dump_stat_modules = {} |
