Skip to content

Commit

Permalink
DEV-209 | Fix ~/.bash_profile permission and on other locations
Browse files Browse the repository at this point in the history
  • Loading branch information
phuonglm committed Aug 31, 2015
1 parent 7d410af commit 90bceb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
24 changes: 6 additions & 18 deletions main-cookbooks/teracy-dev/recipes/git.rb
Expand Up @@ -102,21 +102,9 @@
end
end

ruby_block 'insert_line' do
block do
if not node['teracy-dev']['git']['core']['filemode']
fileName = '/home/vagrant/.bash_profile'
if not File.exist?(fileName)
file = File.open(fileName, 'w')
file.puts('
PROMPT_COMMAND=pc
pc () {
[ -d .git -a ! -g .git/config ] || return
git config core.filemode false
chmod +s .git/config
}')
file.close
end
end
end
end
bash 'update bash_profile permission' do
code <<-EOF
chown vagrant:vagrant /home/vagrant/.bash_profile
EOF
only_if 'ls /home/vagrant/.bash_profile'
end
7 changes: 7 additions & 0 deletions main-cookbooks/teracy-dev/recipes/node.rb
Expand Up @@ -52,4 +52,11 @@
end
end

bash 'clean up tmp dir if need' do
code <<-EOF
rm -rf /home/vagrant/tmp
EOF
only_if 'ls /home/vagrant/tmp'
end

end
2 changes: 2 additions & 0 deletions main-cookbooks/teracy-dev/recipes/virtualenvwrapper.rb
Expand Up @@ -66,5 +66,7 @@
echo 'export PATH=$HOME/.bin/:$PATH' >> /home/vagrant/.bash_profile
echo 'pyenv virtualenvwrapper' >> /home/vagrant/.bash_profile && source /home/vagrant/.bash_profile
EOF
environment 'HOME'=>'/home/vagrant/'
not_if 'grep -q pyenv /home/vagrant/.bash_profile'
user 'vagrant'
end

0 comments on commit 90bceb2

Please sign in to comment.