Mon, 12 Sep 2016 17:29:48 -0400
fix formatoptions and autorun
245 | 1 | #!/bin/sh |
2 | set -eu | |
3 | ||
285 | 4 | if [ ! -f .zshrc ]; then |
5 | echo "Refusing to run without a .zshrc nearby" >&2 | |
6 | exit 1 | |
7 | fi | |
8 | ||
245 | 9 | if ! git --version >/dev/null; then |
285 | 10 | echo "Please install git!" >&2 |
245 | 11 | exit 1 |
12 | fi | |
13 | ||
14 | pull () { | |
15 | echo "$1:" | |
16 | git -C $1 pull --no-tags | |
17 | } | |
18 | ||
19 | if ! [ -d .zgen ]; then | |
20 | git clone https://github.com/tarjoilija/zgen.git .zgen | |
21 | else | |
22 | pull .zgen | |
23 | fi | |
24 | ||
25 | if ! [ -d .plenv ]; then | |
26 | git clone https://github.com/tokuhirom/plenv.git .plenv | |
27 | git clone https://github.com/tokuhirom/Perl-Build.git .plenv/plugins/perl-build/ | |
28 | else | |
29 | pull .plenv | |
30 | pull .plenv/plugins/perl-build | |
31 | fi | |
32 | ||
381
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
33 | if ! [ -d .asdf ]; then |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
34 | git clone https://github.com/asdf-vm/asdf .asdf |
245 | 35 | else |
381
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
36 | pull .asdf |
245 | 37 | fi |
38 | ||
381
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
39 | for LANG in ruby nodejs erlang elixir; do |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
40 | if ! [ -d .asdf/plugins/$LANG ]; then |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
41 | git clone https://github.com/asdf-vm/asdf-$LANG .asdf/plugins/$LANG |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
42 | else |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
43 | pull .asdf/plugins/$LANG |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
44 | fi |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
45 | done |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
46 | |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
47 | # Transition older stuff to asdf |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
48 | if [ -d .rbenv ]; then |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
49 | echo 'Removing rbenv and moving ruby installs' |
383
c14c440cda0f
Add note about shebang for now
Meredith Howard <mhoward@roomag.org>
parents:
382
diff
changeset
|
50 | echo 'bin/* in each version dir needs all shebang lines fixed' |
381
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
51 | |
382 | 52 | if [ -d .rbenv/versions ]; then |
53 | mkdir -p .asdf/installs | |
54 | mv .rbenv/versions .asdf/installs/ruby | |
55 | for ver in .asdf/installs/ruby/*; do | |
56 | bash -c "asdf reshim ruby $(basename $ver)" | |
57 | done | |
58 | fi | |
381
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
59 | |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
60 | if [ -f .rbenv/version ]; then |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
61 | echo "ruby $(cat .rbenv/version)" >> .tool-versions |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
62 | fi |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
63 | |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
64 | rm -rf .rbenv |
245 | 65 | fi |
66 | ||
381
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
67 | if [ -d .ndenv ]; then |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
68 | echo 'Removing ndenv and moving node installs' |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
69 | |
382 | 70 | if [ -d .ndenv/versions ]; then |
71 | mkdir -p .asdf/installs | |
72 | mv .ndenv/versions .asdf/installs/nodejs | |
73 | for ver in .asdf/installs/nodejs/*; do | |
74 | bash -c "asdf reshim nodejs $(basename $ver)" | |
75 | done | |
76 | fi | |
381
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
77 | |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
78 | if [ -f .ndenv/version ]; then |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
79 | echo "nodejs $(cat .ndenv/version)" >> .tool-versions |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
80 | fi |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
81 | |
b09db2db7f84
use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents:
328
diff
changeset
|
82 | rm -rf .ndenv |
328 | 83 | fi |