Now supporting vagrant 1.2. Simplified config class. SSH not working
[vagrant-dotfiles.git] / lib / copy_my_conf.rb
index 7cde153..fa7fec1 100644 (file)
@@ -1,40 +1,16 @@
-require 'boot'
-module Vagrant
-  module Provisioners
-    class CopyMyConf < Base
-      def initialize *args
-        `rm -rf /tmp/copy_my_conf`
-        super *args
-      end
+module CopyMyConf
+  class Plugin < Vagrant.plugin("2")
+    name "copy_my_conf"
 
-      def prepare
-        @to_be_copied = []
-        config.all_enabled_attributes.each do |conf|
-          @to_be_copied << conf
-          conf.prepare env[:vm].config.vm, tmp_root
-        end
-      end
-
-      def provision!
-        channel = env[:vm].channel
-        @to_be_copied.each do |conf|
-          conf.provision channel, user_home, tmp_root
-        end
-      end
-
-      def self.config_class
-        Config
-      end
-
-    private
-
-      def tmp_root
-        "/tmp/copy_my_conf"
-      end
+    config(:copy_my_conf, :provisioner) do
+      require File.expand_path('../copy_my_conf/config', __FILE__)
+      Config
+    end
 
-      def user_home
-        config.user_home || "/home/vagrant"
-      end
+    provisioner :copy_my_conf do
+      require File.expand_path('../copy_my_conf/provisioner', __FILE__)
+      Provisioner
     end
+
   end
 end