From 0e824cc47193047ad389226b1c8c3f5ca53343d9 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 22 Oct 2014 22:29:23 -0400 Subject: [PATCH] Rename file push to noop push --- plugins/pushes/file/config.rb | 26 --------------- plugins/pushes/file/push.rb | 29 ----------------- plugins/pushes/noop/config.rb | 16 +++++++++ plugins/pushes/{file => noop}/plugin.rb | 11 +++---- plugins/pushes/noop/push.rb | 11 +++++++ test/unit/plugins/pushes/file/config_test.rb | 34 -------------------- test/unit/plugins/pushes/noop/config_test.rb | 14 ++++++++ 7 files changed, 46 insertions(+), 95 deletions(-) delete mode 100644 plugins/pushes/file/config.rb delete mode 100644 plugins/pushes/file/push.rb create mode 100644 plugins/pushes/noop/config.rb rename plugins/pushes/{file => noop}/plugin.rb (60%) create mode 100644 plugins/pushes/noop/push.rb delete mode 100644 test/unit/plugins/pushes/file/config_test.rb create mode 100644 test/unit/plugins/pushes/noop/config_test.rb diff --git a/plugins/pushes/file/config.rb b/plugins/pushes/file/config.rb deleted file mode 100644 index 025ab78dd..000000000 --- a/plugins/pushes/file/config.rb +++ /dev/null @@ -1,26 +0,0 @@ -module VagrantPlugins - module FileDeploy - class Config < Vagrant.plugin("2", :config) - attr_accessor :destination - - def initialize - @destination = UNSET_VALUE - end - - def finalize! - @destination = nil if @destination == UNSET_VALUE - end - - def validate(machine) - errors = _detected_errors - - # Validate that a destination was provided - if !destination - errors << I18n.t("vagrant.pushes.file.no_destination") - end - - { "File push" => errors } - end - end - end -end diff --git a/plugins/pushes/file/push.rb b/plugins/pushes/file/push.rb deleted file mode 100644 index 662719ec5..000000000 --- a/plugins/pushes/file/push.rb +++ /dev/null @@ -1,29 +0,0 @@ -module VagrantPlugins - module FileDeploy - class Push < Vagrant.plugin("2", :push) - def push - @machine.communicate.tap do |comm| - destination = expand_guest_path(config.destination) - - # Make sure the remote path exists - command = "mkdir -p %s" % File.dirname(destination) - comm.execute(command) - - # Now push the deploy... - # ??? - end - end - - private - - # Expand the guest path if the guest has the capability - def expand_guest_path(destination) - if machine.guest.capability?(:shell_expand_guest_path) - machine.guest.capability(:shell_expand_guest_path, destination) - else - destination - end - end - end - end -end diff --git a/plugins/pushes/noop/config.rb b/plugins/pushes/noop/config.rb new file mode 100644 index 000000000..9b23fb450 --- /dev/null +++ b/plugins/pushes/noop/config.rb @@ -0,0 +1,16 @@ +module VagrantPlugins + module NoopDeploy + class Config < Vagrant.plugin("2", :config) + def initialize + end + + def finalize! + end + + def validate(machine) + errors = _detected_errors + { "Noop push" => errors } + end + end + end +end diff --git a/plugins/pushes/file/plugin.rb b/plugins/pushes/noop/plugin.rb similarity index 60% rename from plugins/pushes/file/plugin.rb rename to plugins/pushes/noop/plugin.rb index 365e5e44c..d3dc6994d 100644 --- a/plugins/pushes/file/plugin.rb +++ b/plugins/pushes/noop/plugin.rb @@ -1,20 +1,19 @@ require "vagrant" module VagrantPlugins - module FileDeploy + module NoopDeploy class Plugin < Vagrant.plugin("2") - name "file" + name "noop" description <<-DESC - Deploy by pushing to a filepath on your local system or a remote share - attached to this system + Literally do nothing DESC - config(:file, :push) do + config(:noop, :push) do require File.expand_path("../config", __FILE__) Config end - push(:file) do + push(:noop) do require File.expand_path("../push", __FILE__) Push end diff --git a/plugins/pushes/noop/push.rb b/plugins/pushes/noop/push.rb new file mode 100644 index 000000000..490e32188 --- /dev/null +++ b/plugins/pushes/noop/push.rb @@ -0,0 +1,11 @@ +module VagrantPlugins + module NoopDeploy + class Push < Vagrant.plugin("2", :push) + def push + @machine.communicate.tap do |comm| + puts "pushed" + end + end + end + end +end diff --git a/test/unit/plugins/pushes/file/config_test.rb b/test/unit/plugins/pushes/file/config_test.rb deleted file mode 100644 index c5c7c591e..000000000 --- a/test/unit/plugins/pushes/file/config_test.rb +++ /dev/null @@ -1,34 +0,0 @@ -require_relative "../../../base" - -require Vagrant.source_root.join("plugins/pushes/file/config") - -describe VagrantPlugins::FileDeploy::Config do - include_context "unit" - - subject { described_class.new } - - let(:machine) { double("machine") } - - describe "#validate" do - it "returns an error if destination is not specified" do - subject.finalize! - - result = subject.validate(machine) - - expect(result["File push"]).to eql([ - I18n.t("vagrant.pushes.file.no_destination") - ]) - end - - it "returns no errors when the config is valid" do - existing_file = File.expand_path(__FILE__) - - subject.destination = existing_file - subject.finalize! - - result = subject.validate(machine) - - expect(result["File push"]).to be_empty - end - end -end diff --git a/test/unit/plugins/pushes/noop/config_test.rb b/test/unit/plugins/pushes/noop/config_test.rb new file mode 100644 index 000000000..05be6c3f8 --- /dev/null +++ b/test/unit/plugins/pushes/noop/config_test.rb @@ -0,0 +1,14 @@ +require_relative "../../../base" + +require Vagrant.source_root.join("plugins/pushes/noop/config") + +describe VagrantPlugins::NoopDeploy::Config do + include_context "unit" + + subject { described_class.new } + + let(:machine) { double("machine") } + + describe "#validate" do + end +end