Created
April 25, 2012 16:21
-
-
Save fnordfish/2491039 to your computer and use it in GitHub Desktop.
Register a middleware action from within a plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index 0b10045..be73523 100644 | |
--- a/lib/vagrant/plugin/v1.rb | |
+++ b/lib/vagrant/plugin/v1.rb | |
@@ -114,6 +114,10 @@ module Vagrant | |
data[:provisioners] | |
end | |
+ def self.action(stack, &block) | |
+ Vagrant.actions[stack.to_sym].instance_eval(&block) | |
+ end | |
+ | |
# Registers the plugin. This makes the plugin actually work with | |
# Vagrant. Prior to registering, the plugin is merely a skeleton. | |
def self.register!(plugin=nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Plugin < Vagrant.plugin("1") | |
# ... includes, name, description ... | |
# push my middleware on the start stack | |
action(:start) { | |
use MyAction | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment