Class: VagrantGemPlugin::Command
- Inherits:
-
Object
- Object
- VagrantGemPlugin::Command
- Includes:
- Vagrant::Util::SafePuts
- Defined in:
- lib/vagrant-gem/command.rb
Overview
this code is basically just coped from: github.com/mitchellh/vagrant/blob/v1.0.7/lib/vagrant/command/gem.rb
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-gem/command.rb', line 13 def execute # Bundler sets up its own custom gem load paths such that our # own gems are never loaded. Therefore, give an error if a user # tries to install gems while within a Bundler-managed environment. if defined?(Bundler) require 'bundler/shared_helpers' if Bundler::SharedHelpers.in_bundle? raise Vagrant::Errors::GemCommandInBundler end end # If the user needs some help, we add our own little message at the # top so that they're aware of what `vagrant gem` is doing, really. if @argv.empty? || @argv.include?("-h") || @argv.include?("--help") # copy and pasted from: # https://github.com/mitchellh/vagrant/blob/v1.0.7/templates/locales/en.yml @env.ui.info(I18n.t("vagrant_gem_plugin.help_preamble"), :prefix => false) safe_puts end # We just proxy the arguments onto a real RubyGems command # but change `GEM_HOME` so that the gems are installed into # our own private gem folder. ENV["GEM_HOME"] = @env.gems_path.to_s ::Gem.clear_paths ::Gem::GemRunner.new.run(@argv.dup) end |