helm/rake/pkg/zsh.rake

31 lines
732 B
Ruby
Raw Normal View History

require_relative '../lib/sh'
require_relative '../lib/git'
2014-04-11 00:31:44 -07:00
desc "Ensure zsh and oh-my-zsh is installed and set"
task :zsh => 'zsh:update'
namespace :zsh do
2014-08-30 23:50:03 -07:00
task :install do
unless Dir.exists?(File.expand_path("~/.zprezto"))
echo "Installing prezto"
github 'hlissner/prezto', '~/.zprezto'
2014-04-11 00:31:44 -07:00
end
2014-08-30 23:50:03 -07:00
sh_safe '~/.dotfiles/install.sh'
2014-04-11 00:31:44 -07:00
2014-08-30 23:50:03 -07:00
unless `printenv SHELL | grep "/bin/zsh"`
echo "Setting shell to zsh"
sh_safe "chsh -s /bin/zsh"
sh_safe "exec /bin/zsh -l"
2014-04-13 08:46:20 -07:00
end
2014-08-30 23:50:03 -07:00
end
task :update => "zsh:install" do
echo "Updating zprezto"
sh_safe 'cd ~/.zprezto && git pull'
end
2014-04-11 00:31:44 -07:00
2014-08-30 23:50:03 -07:00
task :remove do
sh_safe 'rm -rf ~/.zprezto' if Dir.exists?(File.expand_path("~/.zprezto"))
end
2014-04-11 00:31:44 -07:00
end