.homedir-setup.rb

Fri, 01 Aug 2014 02:34:19 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 01 Aug 2014 02:34:19 -0400
changeset 124
1be15444e144
parent 96
f4808ae73ead
child 136
b634c40e658b
permissions
-rwxr-xr-x

Don't use any shorthand options

94
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 #!/usr/bin/env ruby
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 # vim: et sts=2 sw=2 fdm=marker
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 # we don't yet have rbenv so keep safe for ruby 1.8
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 if `which git` == ''
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 puts "please install git"
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 exit 1
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 end
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11
96
f4808ae73ead clean up
Meredith Howard <mhoward@roomag.org>
parents: 94
diff changeset
12 # just checks and bails after each call
f4808ae73ead clean up
Meredith Howard <mhoward@roomag.org>
parents: 94
diff changeset
13 def do_cmds (*cmds)
f4808ae73ead clean up
Meredith Howard <mhoward@roomag.org>
parents: 94
diff changeset
14 cmds.each do |cmd|
f4808ae73ead clean up
Meredith Howard <mhoward@roomag.org>
parents: 94
diff changeset
15 puts "$ #{cmd}"
f4808ae73ead clean up
Meredith Howard <mhoward@roomag.org>
parents: 94
diff changeset
16 system( cmd ) or exit $?
94
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 end
96
f4808ae73ead clean up
Meredith Howard <mhoward@roomag.org>
parents: 94
diff changeset
18 end
94
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 # oh-my-zsh {{{
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 # i have a custom theme and the omz install complains about already
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 # having a directory there. remove, install, then revert my stuff
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 # out of hg
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 if Dir.exists?('.oh-my-zsh/.git')
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 puts "oh-my-zsh already installed"
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 else
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 puts "Installing oh-my-zsh..."
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 do_cmds \
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 'git clone git://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh',
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 'hg stat -dn0 -I .oh-my-zsh/ | xargs -0 hg revert'
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 end
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
38 # }}}
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
40
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41 # plenv {{{
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
42
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
43 if Dir.exists?('.plenv')
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
44 puts "plenv already installed"
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
45 else
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
46 puts "Installing plenv..."
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
47
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
48 do_cmds \
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
49 'git clone git://github.com/tokuhirom/plenv.git .plenv',
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
50 'git clone git://github.com/tokuhirom/Perl-Build.git .plenv/plugins/perl-build/'
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
51
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
52 end
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
53
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
54 # }}}
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
55
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
56
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
57 # rbenv {{{
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
58 if Dir.exists?('.rbenv')
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
59 puts "rbenv already installed"
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
60 else
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
61 puts "Installing rbenv..."
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
62
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
63 do_cmds \
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
64 'git clone https://github.com/sstephenson/rbenv.git .rbenv',
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
65 'git clone https://github.com/sstephenson/ruby-build.git .rbenv/plugins/ruby-build/'
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
66
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
67 end
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
68 # }}}
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
69
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
70
51ca19919894 Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
71

mercurial