Starting on the `vagrant gem` command.
This commit is contained in:
parent
fd54cf0809
commit
d19f7a44e5
|
@ -136,6 +136,7 @@ I18n.load_path << File.expand_path("templates/locales/en.yml", Vagrant.source_ro
|
||||||
# Register the built-in commands
|
# Register the built-in commands
|
||||||
Vagrant.commands.register(:box) { Vagrant::Command::Box }
|
Vagrant.commands.register(:box) { Vagrant::Command::Box }
|
||||||
Vagrant.commands.register(:destroy) { Vagrant::Command::Destroy }
|
Vagrant.commands.register(:destroy) { Vagrant::Command::Destroy }
|
||||||
|
Vagrant.commands.register(:gem) { Vagrant::Command::Gem }
|
||||||
Vagrant.commands.register(:halt) { Vagrant::Command::Halt }
|
Vagrant.commands.register(:halt) { Vagrant::Command::Halt }
|
||||||
Vagrant.commands.register(:init) { Vagrant::Command::Init }
|
Vagrant.commands.register(:init) { Vagrant::Command::Init }
|
||||||
Vagrant.commands.register(:package) { Vagrant::Command::Package }
|
Vagrant.commands.register(:package) { Vagrant::Command::Package }
|
||||||
|
|
|
@ -8,6 +8,7 @@ module Vagrant
|
||||||
autoload :BoxRepackage, 'vagrant/command/box_repackage'
|
autoload :BoxRepackage, 'vagrant/command/box_repackage'
|
||||||
autoload :BoxList, 'vagrant/command/box_list'
|
autoload :BoxList, 'vagrant/command/box_list'
|
||||||
autoload :Destroy, 'vagrant/command/destroy'
|
autoload :Destroy, 'vagrant/command/destroy'
|
||||||
|
autoload :Gem, 'vagrant/command/gem'
|
||||||
autoload :Halt, 'vagrant/command/halt'
|
autoload :Halt, 'vagrant/command/halt'
|
||||||
autoload :Init, 'vagrant/command/init'
|
autoload :Init, 'vagrant/command/init'
|
||||||
autoload :Package, 'vagrant/command/package'
|
autoload :Package, 'vagrant/command/package'
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
require "rubygems"
|
||||||
|
require "rubygems/gem_runner"
|
||||||
|
|
||||||
|
module Vagrant
|
||||||
|
module Command
|
||||||
|
class Gem < Base
|
||||||
|
def execute
|
||||||
|
# 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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@ module Vagrant
|
||||||
# defined as basically a folder with a "Vagrantfile." This class allows
|
# defined as basically a folder with a "Vagrantfile." This class allows
|
||||||
# access to the VMs, CLI, etc. all in the scope of this environment.
|
# access to the VMs, CLI, etc. all in the scope of this environment.
|
||||||
class Environment
|
class Environment
|
||||||
HOME_SUBDIRS = ["tmp", "boxes"]
|
HOME_SUBDIRS = ["tmp", "boxes", "gems"]
|
||||||
DEFAULT_VM = :default
|
DEFAULT_VM = :default
|
||||||
DEFAULT_HOME = "~/.vagrant.d"
|
DEFAULT_HOME = "~/.vagrant.d"
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@ module Vagrant
|
||||||
# The directory where boxes are stored.
|
# The directory where boxes are stored.
|
||||||
attr_reader :boxes_path
|
attr_reader :boxes_path
|
||||||
|
|
||||||
|
# The path where the plugins are stored (gems)
|
||||||
|
attr_reader :gems_path
|
||||||
|
|
||||||
# The path to the default private key
|
# The path to the default private key
|
||||||
attr_reader :default_private_key_path
|
attr_reader :default_private_key_path
|
||||||
|
|
||||||
|
@ -80,6 +83,7 @@ module Vagrant
|
||||||
setup_home_path
|
setup_home_path
|
||||||
@tmp_path = @home_path.join("tmp")
|
@tmp_path = @home_path.join("tmp")
|
||||||
@boxes_path = @home_path.join("boxes")
|
@boxes_path = @home_path.join("boxes")
|
||||||
|
@gems_path = @home_path.join("gems")
|
||||||
|
|
||||||
# Setup the default private key
|
# Setup the default private key
|
||||||
@default_private_key_path = @home_path.join("insecure_private_key")
|
@default_private_key_path = @home_path.join("insecure_private_key")
|
||||||
|
|
Loading…
Reference in New Issue