Extracted Logic for vim in seperate class
[vagrant-dotfiles.git] / lib / copy_my_conf / vim.rb
diff --git a/lib/copy_my_conf/vim.rb b/lib/copy_my_conf/vim.rb
new file mode 100644 (file)
index 0000000..f8935ed
--- /dev/null
@@ -0,0 +1,21 @@
+module Vagrant
+  module Provisioners
+    class CopyMyConf < Base
+      class Vim
+        def prepare vm, tmp_root
+          `mkdir -p #{tmp_root}/vim`
+          ["~/.vimrc", "~/.vim"].each do |file|
+            `cp -r #{file} #{tmp_root}/vim`
+          end
+          vm.share_folder("vim", "#{tmp_root}/vim", "#{tmp_root}/vim")
+        end
+
+        def provision channel, user_home, tmp_root
+          puts "Copying your vim configuratios"
+          channel.execute("rm -rf #{user_home}/.vim*")
+          channel.execute("cp -r #{tmp_root}/vim/.??* ~/")
+        end
+      end
+    end
+  end
+end