From a194057fc04f6c8e1a66e0a2eb14aa537622e86f Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Thu, 8 Mar 2018 14:20:21 -0800 Subject: [PATCH] Add trigger config plugin --- plugins/kernel_v2/config/trigger.rb | 46 +++++++++++++++++++++++++++++ plugins/kernel_v2/plugin.rb | 5 ++++ 2 files changed, 51 insertions(+) create mode 100644 plugins/kernel_v2/config/trigger.rb diff --git a/plugins/kernel_v2/config/trigger.rb b/plugins/kernel_v2/config/trigger.rb new file mode 100644 index 000000000..7e23ee8c8 --- /dev/null +++ b/plugins/kernel_v2/config/trigger.rb @@ -0,0 +1,46 @@ +require "vagrant" + +module VagrantPlugins + module Kernel_V2 + class TriggerConfig < Vagrant.plugin("2", :config) + + attr_accessor :name + + def initialize + @logger = Log4r::Logger.new("vagrant::config::trigger") + + # Internal state + @name = UNSET_VALUE + end + + # @param [Symbol] command Vagrant command to create trigger on + # @param [Block] block The defined after block + def before(command, &block) + end + + # @param [Symbol] command Vagrant command to create trigger on + # @param [Block] block The defined after block + def after(command, &block) + end + + #------------------------------------------------------------------- + # Internal methods, don't call these. + #------------------------------------------------------------------- + + def finalize! + @name = nil if @name == UNSET_VALUE + end + + # Validate all pushes + def validate(machine) + end + + # The String representation of this Trigger. + # + # @return [String] + def to_s + "Trigger" + end + end + end +end diff --git a/plugins/kernel_v2/plugin.rb b/plugins/kernel_v2/plugin.rb index 27737854f..4c836424f 100644 --- a/plugins/kernel_v2/plugin.rb +++ b/plugins/kernel_v2/plugin.rb @@ -39,6 +39,11 @@ module VagrantPlugins require File.expand_path("../config/vm", __FILE__) VMConfig end + + config("trigger") do + require File.expand_path("../config/trigger", __FILE__) + TriggerConfig + end end end end