1 #!/usr/bin/env ruby |
1 #!/usr/bin/env ruby |
2 # vim: et sts=2 sw=2 fdm=marker |
2 # vim: et sts=2 sw=2 fdm=marker |
3 |
3 |
4 # we don't yet have rbenv so keep safe for ruby 1.8 |
4 # we don't yet have rbenv so keep safe for ruby 1.9 |
5 |
5 |
6 if `which git` == '' |
6 if `which git` == '' |
7 puts "please install git" |
7 puts "please install git" |
8 exit 1 |
8 exit 1 |
9 end |
9 end |
10 |
10 |
11 |
11 |
12 # just checks and bails after each call |
12 # just checks and bails after each call, output already in STDERR |
13 def do_cmds (*cmds) |
13 def do_cmds (*cmds) |
14 cmds.each do |cmd| |
14 cmds.each do |cmd| |
15 puts "$ #{cmd}" |
15 puts "$ #{cmd}" |
16 system( cmd ) or exit $? |
16 system( cmd ) or exit $? |
17 end |
17 end |
18 end |
18 end |
19 |
19 |
20 |
20 |
21 |
21 |
22 # oh-my-zsh {{{ |
22 # oh-my-zsh {{{ |
23 # i have a custom theme and the omz install complains about already |
23 # some custom zsh files are already in .oh-my-zsh.cust |
24 # having a directory there. remove, install, then revert my stuff |
|
25 # out of hg |
|
26 |
24 |
27 if Dir.exists?('.oh-my-zsh/.git') |
25 if Dir.exists?('.oh-my-zsh/.git') |
28 puts "oh-my-zsh already installed" |
26 puts "oh-my-zsh already installed" |
29 else |
27 else |
30 puts "Installing oh-my-zsh..." |
28 puts "Installing oh-my-zsh..." |
31 |
29 |
32 do_cmds \ |
30 do_cmds \ |
33 'git clone git://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh', |
31 'git clone git://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh' |
34 'hg stat -dn0 -I .oh-my-zsh/ | xargs -0 hg revert' |
|
35 |
32 |
36 end |
33 end |
37 |
34 |
38 # }}} |
35 # }}} |
39 |
36 |