Wed, 25 Mar 2015 23:18:57 -0700
add include .gitconfig.local
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 | |
136
b634c40e658b
Update, got omz files in right place
Meredith Howard <mhoward@roomag.org>
parents:
96
diff
changeset
|
4 | # we don't yet have rbenv so keep safe for ruby 1.9 |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
5 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
6 | require 'getoptlong' |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
7 | |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
8 | if `which git` == '' |
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
9 | puts "please install git" |
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
10 | exit 1 |
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
11 | end |
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
12 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
13 | def main |
160 | 14 | if ARGV.length == 0 |
15 | ARGV << '--help' | |
16 | end | |
17 | ||
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
18 | opts = GetoptLong.new( |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
19 | [ '--help', '-h', GetoptLong::NO_ARGUMENT ], |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
20 | [ '--update', '-u', GetoptLong::NO_ARGUMENT ], |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
21 | [ '--setup', '-s', GetoptLong::NO_ARGUMENT ], |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
22 | ); |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
23 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
24 | case opts.get.shift |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
25 | when '--help' |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
26 | puts <<-ENDHELP.sub(/^\s+/,'') |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
27 | #{$0} usage: |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
28 | -h --help This help message |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
29 | -s --setup Perform home directory setup (git clone) |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
30 | -u --update Update git stuff (git pull) |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
31 | ENDHELP |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
32 | exit 1 |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
33 | when '--setup' |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
34 | setup |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
35 | when '--update' |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
36 | update |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
37 | end |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
38 | end |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
39 | |
136
b634c40e658b
Update, got omz files in right place
Meredith Howard <mhoward@roomag.org>
parents:
96
diff
changeset
|
40 | # just checks and bails after each call, output already in STDERR |
96 | 41 | def do_cmds (*cmds) |
42 | cmds.each do |cmd| | |
43 | puts "$ #{cmd}" | |
44 | system( cmd ) or exit $? | |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
45 | end |
96 | 46 | end |
94
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 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
49 | def setup |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
50 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
51 | # oh-my-zsh {{{ |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
52 | # some custom zsh files are already in .oh-my-zsh.cust |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
53 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
54 | if Dir.exists?('.oh-my-zsh/.git') |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
55 | puts "oh-my-zsh already installed" |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
56 | else |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
57 | puts "Installing oh-my-zsh..." |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
58 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
59 | do_cmds \ |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
60 | 'git clone git://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh' |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
61 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
62 | end |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
63 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
64 | # }}} |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
65 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
66 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
67 | # plenv {{{ |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
68 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
69 | if Dir.exists?('.plenv') |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
70 | puts "plenv already installed" |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
71 | else |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
72 | puts "Installing plenv..." |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
73 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
74 | do_cmds \ |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
75 | 'git clone git://github.com/tokuhirom/plenv.git .plenv', |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
76 | 'git clone git://github.com/tokuhirom/Perl-Build.git .plenv/plugins/perl-build/' |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
77 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
78 | end |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
79 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
80 | # }}} |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
81 | |
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
82 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
83 | # rbenv {{{ |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
84 | if Dir.exists?('.rbenv') |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
85 | puts "rbenv already installed" |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
86 | else |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
87 | puts "Installing rbenv..." |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
88 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
89 | do_cmds \ |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
90 | 'git clone https://github.com/sstephenson/rbenv.git .rbenv', |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
91 | 'git clone https://github.com/sstephenson/ruby-build.git .rbenv/plugins/ruby-build/' |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
92 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
93 | end |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
94 | # }}} |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
95 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
96 | end |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
97 | |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
98 | def update |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
99 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
100 | [ |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
101 | '.oh-my-zsh', |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
102 | '.plenv', |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
103 | '.plenv/plugins/perl-build', |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
104 | '.rbenv', |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
105 | '.rbenv/plugins/ruby-build', |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
106 | ].each do |dir| |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
107 | do_cmds \ |
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
108 | "chdir ~/#{dir} && git pull origin master" |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
109 | end |
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
110 | |
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
111 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
112 | end |
94
51ca19919894
Try to make setup easier, unify shell environments
Meredith Howard <mhoward@roomag.org>
parents:
diff
changeset
|
113 | |
152
69896d410e89
add easy update option for stuff that's git-based
Meredith Howard <mhoward@roomag.org>
parents:
136
diff
changeset
|
114 | main |
136
b634c40e658b
Update, got omz files in right place
Meredith Howard <mhoward@roomag.org>
parents:
96
diff
changeset
|
115 |