Move StateFile into Vagrant::Plugin core

This commit is contained in:
Mitchell Hashimoto 2014-01-04 16:45:41 -08:00
parent d98868d150
commit 8450f20e87
5 changed files with 10 additions and 8 deletions

View File

@ -1,6 +1,7 @@
module Vagrant
module Plugin
autoload :V1, "vagrant/plugin/v1"
autoload :V2, "vagrant/plugin/v2"
autoload :V1, "vagrant/plugin/v1"
autoload :V2, "vagrant/plugin/v2"
autoload :StateFile, "vagrant/plugin/state_file"
end
end

View File

@ -1,7 +1,7 @@
require "json"
module VagrantPlugins
module CommandPlugin
module Vagrant
module Plugin
# This is a helper to deal with the plugin state file that Vagrant
# uses to track what plugins are installed and activated and such.
class StateFile

View File

@ -1,3 +1,5 @@
require "vagrant/plugin/state_file"
module VagrantPlugins
module CommandPlugin
module Command
@ -11,7 +13,7 @@ module VagrantPlugins
def action(callable, env=nil)
env = {
:gem_helper => GemHelper.new(@env.gems_path),
:plugin_state_file => StateFile.new(@env.home_path.join("plugins.json"))
:plugin_state_file => Vagrant::Plugin::StateFile.new(@env.home_path.join("plugins.json"))
}.merge(env || {})
@env.action_runner.run(callable, env)

View File

@ -17,6 +17,5 @@ DESC
autoload :Action, File.expand_path("../action", __FILE__)
autoload :GemHelper, File.expand_path("../gem_helper", __FILE__)
autoload :StateFile, File.expand_path("../state_file", __FILE__)
end
end

View File

@ -1,9 +1,9 @@
require "json"
require "pathname"
require File.expand_path("../../../../base", __FILE__)
require File.expand_path("../../../base", __FILE__)
describe VagrantPlugins::CommandPlugin::StateFile do
describe Vagrant::Plugin::StateFile do
let(:path) do
f = Tempfile.new("vagrant")
p = f.path