7cde153e74f1b36eae9278a63580a6ec95ff0f75
[vagrant-dotfiles.git] / lib / copy_my_conf.rb
1 require 'boot'
2 module Vagrant
3 module Provisioners
4 class CopyMyConf < Base
5 def initialize *args
6 `rm -rf /tmp/copy_my_conf`
7 super *args
8 end
9
10 def prepare
11 @to_be_copied = []
12 config.all_enabled_attributes.each do |conf|
13 @to_be_copied << conf
14 conf.prepare env[:vm].config.vm, tmp_root
15 end
16 end
17
18 def provision!
19 channel = env[:vm].channel
20 @to_be_copied.each do |conf|
21 conf.provision channel, user_home, tmp_root
22 end
23 end
24
25 def self.config_class
26 Config
27 end
28
29 private
30
31 def tmp_root
32 "/tmp/copy_my_conf"
33 end
34
35 def user_home
36 config.user_home || "/home/vagrant"
37 end
38 end
39 end
40 end