Skip to content

Commit

Permalink
add oh-my-zsh submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
Jico Baligod committed Nov 4, 2012
1 parent bc4cc8e commit a5cfa8a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@
[submodule "vim/bundle/cucumber-align-pipes"]
path = vim/bundle/cucumber-align-pipes
url = git@github.com:quentindecock/vim-cucumber-align-pipes.git
[submodule "oh-my-zsh"]
path = oh-my-zsh
url = git@github.com:jico/oh-my-zsh.git
20 changes: 7 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ require 'rake'

desc "install the dotfiles into user's home directory"
task :install do
system 'git submodule init && git submodule update --init'
install_oh_my_zsh
system 'git submodule init && git submodule update'

replace_all = false
Dir['*'].each do |file|
Expand Down Expand Up @@ -33,6 +32,9 @@ task :install do
link_file(file)
end
end

# Change shell to zsh
system 'chsh -s /bin/zsh' unless ENV['SHELL'] =~ /\/zsh$/
end

desc "uninstall the dotfiles from the user's home directory"
Expand All @@ -41,13 +43,14 @@ task :uninstall do
print "Are you sure you wish to continue? [yN] "
exit unless STDIN.gets.chomp.downcase == 'y'

print "uninstall oh-my-zsh? [yN] "
uninstall_oh_my_zsh if STDIN.gets.chomp.downcase == 'y'
print "remove oh-my-zsh? [yN] "
uninstall_oh_my_zsh = false unless STDIN.gets.chomp.downcase == 'y'

Dir['*'].each do |file|
local_file_path = File.join(ENV['HOME'], ".#{file}")

next if %w[Rakefile README.md LICENSE].include? file
next if file == "oh-my-zsh" && uninstall_oh_my_zsh
if File.exist?(local_file_path)
puts "unlinking ~/.#{file}"
system %Q{rm -rf "#{local_file_path}"}
Expand All @@ -64,12 +67,3 @@ def link_file(file)
puts "linking ~/.#{file}"
system %Q{ln -s "$PWD/#{file}" "$HOME/.#{file}"}
end

def install_oh_my_zsh
system 'git clone git://github.com/jico/oh-my-zsh.git ~/.oh-my-zsh'
system 'chsh -s /bin/zsh' unless ENV['SHELL'] =~ /\/zsh$/
end

def uninstall_oh_my_zsh
system %Q{rm -rf "$HOME/.oh-my-zsh"}
end
1 change: 1 addition & 0 deletions oh-my-zsh
Submodule oh-my-zsh added at d94c9c

0 comments on commit a5cfa8a

Please sign in to comment.