helm/rake/zsh.rake

33 lines
828 B
Ruby
Raw Normal View History

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