From a93fff103f90cdad7f12eb2af129ffb8cde93434 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 22 Oct 2014 17:39:45 -0400 Subject: [PATCH] Add base skeleton for `vagrant push` --- lib/vagrant/plugin/v2.rb | 1 + lib/vagrant/plugin/v2/plugin.rb | 13 +++++++++++++ lib/vagrant/plugin/v2/push.rb | 31 +++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 lib/vagrant/plugin/v2/push.rb diff --git a/lib/vagrant/plugin/v2.rb b/lib/vagrant/plugin/v2.rb index 1539667bd..953f73ff6 100644 --- a/lib/vagrant/plugin/v2.rb +++ b/lib/vagrant/plugin/v2.rb @@ -16,6 +16,7 @@ module Vagrant autoload :Manager, "vagrant/plugin/v2/manager" autoload :Plugin, "vagrant/plugin/v2/plugin" autoload :Provider, "vagrant/plugin/v2/provider" + autoload :Push, "vagrant/plugin/v2/push" autoload :Provisioner, "vagrant/plugin/v2/provisioner" autoload :SyncedFolder, "vagrant/plugin/v2/synced_folder" end diff --git a/lib/vagrant/plugin/v2/plugin.rb b/lib/vagrant/plugin/v2/plugin.rb index 9a7f6177d..e6020f6c5 100644 --- a/lib/vagrant/plugin/v2/plugin.rb +++ b/lib/vagrant/plugin/v2/plugin.rb @@ -221,6 +221,19 @@ module Vagrant data[:provisioners] end + # Registers additional pushes to be available. + # + # @param [String] name Name of the push. + def self.push(name=UNSET_VALUE, &block) + data[:pushes] ||= Registry.new + + # Register a new pusher class only if a name was given + data[:pushes].register(name.to_sym, &block) if name != UNSET_VALUE + + # Return the registry + data[:pushes] + end + # Registers additional synced folder implementations. # # @param [String] name Name of the implementation. diff --git a/lib/vagrant/plugin/v2/push.rb b/lib/vagrant/plugin/v2/push.rb new file mode 100644 index 000000000..63f9d4ae0 --- /dev/null +++ b/lib/vagrant/plugin/v2/push.rb @@ -0,0 +1,31 @@ +module Vagrant + module Plugin + module V2 + class Push + attr_reader :machine + attr_reader :config + + # Initializes the pusher with the machine that exists for this project + # as well as the configuration (the push configuration, not the full machine + # configuration). + # + # The pusher should _not_ do anything at this point except + # initialize internal state. + # + # @param [Machine] machine The machine associated with this code. + # @param [Object] config Push configuration, if one was set. + def initialize(machine, config) + @machine = machine + @config = config + end + + # This is the method called when the actual pushing should be + # done. + # + # No return value is expected. + def push + end + end + end + end +end