4 class CopyMyConf
< Base
8 config
.all_true
.each
do |c
|
9 conf
= self.class.const_get(c
.capitalize
).new
11 conf
.prepare
env[:vm].config
.vm
, tmp_root
16 channel
= env[:vm].channel
17 @to_be_copied.each
do |conf
|
18 conf
.provision channel
, user_home
, tmp_root
20 provision_ssh(channel
) if config
.ssh
21 provision_vim(channel
) if config
.vim
22 provision_git(channel
) if config
.git
36 env[:vm].config
.vm
.share_folder("ssh", "#{tmp_root}/ssh", "~/.ssh")
40 `mkdir -p #{tmp_root}/git`
41 `cp ~/.gitconfig #{tmp_root}/git/`
42 env[:vm].config
.vm
.share_folder("git", "#{tmp_root}/git/", "#{tmp_root}/git")
45 def provision_git(channel
)
46 puts
"Copying your gitconfig"
47 channel
.execute("cp #{tmp_root}/git/.gitconfig ~/")
50 def provision_ssh(channel
)
51 puts
"Copying your ssh keys and config"
52 channel
.sudo("mkdir -p #{tmp_root}/cached && chown -R vagrant #{tmp_root}/cached")
53 channel
.execute("[[ -f #{user_home}/.ssh/authorized_keys ]] && mv #{user_home}/.ssh/authorized_keys #{tmp_root}/cached")
54 channel
.execute("cp #{tmp_root}/ssh/* #{user_home}/.ssh")
55 channel
.execute("cat #{tmp_root}/cached/authorized_keys >> #{user_home}/.ssh/authorized_keys") # So that `vagrant ssh` doesn't ask for password
59 config
.user_home
|| "/home/vagrant"