Builtin class and stubbed import middleware

This commit is contained in:
Mitchell Hashimoto 2010-07-04 04:58:03 +02:00
parent 5775292408
commit 64b533edc4
4 changed files with 35 additions and 1 deletions

View File

@ -14,3 +14,6 @@ require File.expand_path("util/glob_loader", libdir)
Vagrant::GlobLoader.glob_require(libdir, %w{util/stacked_proc_runner
actions/base downloaders/base actions/collection actions/runner config
provisioners/base provisioners/chef systems/base commands/base commands/box})
# Initialize the built-in actions
Vagrant::Action.builtin!

View File

@ -15,7 +15,7 @@ module Vagrant
#
# @param [Symbol] key
def register(key, callable)
@actions[key] = callable
actions[key] = callable
end
end

View File

@ -0,0 +1,15 @@
module Vagrant
class Action
# Registers the builtin actions. These are locked away in a
# method so that their definition can be deferred until after
# all the necessary Vagrant libraries are loaded. Hopefully
# in the future this will no longer be necessary with autoloading.
def self.builtin!
up = Builder.new do
use VM::Import
end
register :up, up
end
end
end

View File

@ -0,0 +1,16 @@
module Vagrant
class Action
module VM
class Import
def initialize(app, env)
@app = app
end
def call(env)
@app.call(env)
p env['vm']
end
end
end
end
end