bin/homedir-setup

Wed, 31 Aug 2016 16:24:17 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 31 Aug 2016 16:24:17 -0400
changeset 381
b09db2db7f84
parent 328
b3b18ced6949
child 382
09a6309e4856
permissions
-rwxr-xr-x

use ruby and nodejs plugins for asdf

245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 #!/bin/sh
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 set -eu
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
285
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
4 if [ ! -f .zshrc ]; then
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
5 echo "Refusing to run without a .zshrc nearby" >&2
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
6 exit 1
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
7 fi
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
8
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 if ! git --version >/dev/null; then
285
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
10 echo "Please install git!" >&2
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 exit 1
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 pull () {
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 echo "$1:"
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 git -C $1 pull --no-tags
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 }
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 if ! [ -d .zgen ]; then
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 git clone https://github.com/tarjoilija/zgen.git .zgen
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 else
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 pull .zgen
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 if ! [ -d .plenv ]; then
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 git clone https://github.com/tokuhirom/plenv.git .plenv
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 git clone https://github.com/tokuhirom/Perl-Build.git .plenv/plugins/perl-build/
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 else
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 pull .plenv
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 pull .plenv/plugins/perl-build
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 else
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
36 pull .asdf
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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 set +eu
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
48 . .asdf/asdf.sh
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
49 set -eu
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
50
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
51 # Transition older stuff to asdf
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
52 if [ -d .rbenv ]; then
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
53 echo 'Removing rbenv and moving ruby installs'
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
54
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
55 mkdir -p .asdf/installs
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
56 mv .rbenv/versions .asdf/installs/ruby
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
57 pushd $!
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
58 for ver in *; do
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
59 asdf reshim ruby $ver
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
60 done
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
61 popd
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
62
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
63 if [ -f .rbenv/version ]; then
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
64 echo "ruby $(cat .rbenv/version)" >> .tool-versions
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
65 fi
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
66
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
67 rm -rf .rbenv
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
68 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
69
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
70 if [ -d .ndenv ]; then
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
71 echo 'Removing ndenv and moving node installs'
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
72
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
73 mkdir -p .asdf/installs
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
74 mv .ndenv/versions .asdf/installs/nodejs
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
75 pushd $!
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
76 for ver in *; do
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
77 asdf reshim nodejs $ver
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
78 done
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
79 popd
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
80
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
81 if [ -f .ndenv/version ]; then
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
82 echo "nodejs $(cat .ndenv/version)" >> .tool-versions
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
83 fi
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
84
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
85 rm -rf .ndenv
328
b3b18ced6949 add asdf-vm
Meredith Howard <mhoward@roomag.org>
parents: 285
diff changeset
86 fi

mercurial