c10b8143ff8f6ef60b6d18043537abf9fc34645b
4 class CopyMyConf
< Base
7 prepare_vim
if config
.vim
8 prepare_git
if config
.git
9 prepare_ssh
if config
.ssh
13 channel
= env[:vm].channel
14 provision_ssh(channel
) if config
.ssh
15 provision_vim(channel
) if config
.vim
16 provision_git(channel
) if config
.git
30 env[:vm].config
.vm
.share_folder("ssh", "#{tmp_root}/ssh", "~/.ssh")
34 `mkdir -p #{tmp_root}/git`
35 `cp ~/.gitconfig #{tmp_root}/git/`
36 env[:vm].config
.vm
.share_folder("git", "#{tmp_root}/git/", "#{tmp_root}/git")
40 `mkdir -p #{tmp_root}/vim`
41 ["~/.vimrc", "~/.vim"].each
do |file
|
42 `cp -r #{file} #{tmp_root}/vim`
44 env[:vm].config
.vm
.share_folder("vim", "#{tmp_root}/vim/", "#{tmp_root}/vim")
47 def provision_git(channel
)
48 puts
"Copying your gitconfig"
49 channel
.execute("cp #{tmp_root}/git/.gitconfig ~/")
52 def provision_vim(channel
)
53 puts
"Copying your vim configuratios"
54 channel
.execute("rm -rf #{user_home}/.vim*")
55 channel
.execute("cp -r #{tmp_root}/vim/.??* ~/")
58 def provision_ssh(channel
)
59 puts
"Copying your ssh keys and config"
60 channel
.sudo("mkdir -p #{tmp_root}/cached && chown -R vagrant #{tmp_root}/cached")
61 channel
.execute("[[ -f #{user_home}/.ssh/authorized_keys ]] && mv #{user_home}/.ssh/authorized_keys #{tmp_root}/cached")
62 channel
.execute("cp #{tmp_root}/ssh/* #{user_home}/.ssh")
63 channel
.execute("cat #{tmp_root}/cached/authorized_keys >> #{user_home}/.ssh/authorized_keys") # So that `vagrant ssh` doesn't ask for password
67 config
.user_home
|| "/home/vagrant"