2013-10-05 01:02:24 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module CommandBox
|
|
|
|
module Command
|
|
|
|
class Base < Vagrant.plugin("2", :command)
|
|
|
|
# This is a helper for executing an action sequence with the proper
|
|
|
|
# environment hash setup so that the plugin specific helpers are
|
|
|
|
# in.
|
|
|
|
#
|
|
|
|
# @param [Object] callable the Middleware callable
|
|
|
|
# @param [Hash] env Extra environment hash that is merged in.
|
|
|
|
def action(callable, env=nil)
|
|
|
|
env = {
|
2013-10-05 01:27:30 +00:00
|
|
|
:box_state_file => box_state_file
|
2013-10-05 01:02:24 +00:00
|
|
|
}.merge(env || {})
|
|
|
|
|
|
|
|
@env.action_runner.run(callable, env)
|
|
|
|
end
|
2013-10-05 01:27:30 +00:00
|
|
|
|
|
|
|
def box_state_file
|
|
|
|
@box_state_file ||= StateFile.new(@env.home_path.join("boxes.json"))
|
|
|
|
end
|
2013-10-05 01:02:24 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|