-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·23 lines (18 loc) · 769 Bytes
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
if [[ $(uname -s) =~ "Darwin" ]]; then
RUBY_VERSION=$(ruby -v | grep --only-matching '\d\+\.\d\+\.\d\+')
MAJOR_RUBY_VERSION=$(echo "${RUBY_VERSION}" | grep --only-matching '\d\+' | head -n 1)
else
RUBY_VERSION=$(ruby -v | grep --perl-regexp --only-matching '\d+\.\d+\.\d+')
MAJOR_RUBY_VERSION=$(echo "${RUBY_VERSION}" | grep --perl-regexp --only-matching '\d+' | head -n 1)
fi
WANTED_RUBY_VERSION=3
if [ "${MAJOR_RUBY_VERSION}" != "${WANTED_RUBY_VERSION}" ]; then
echo "Looking for ruby version ${WANTED_RUBY_VERSION} but running on ${RUBY_VERSION}"
echo "Please ensure this is running on >= 3"
exit 1
fi
DIRECTORY="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${DIRECTORY}"
bundle install
exec ruby "${DIRECTORY}/lib/dotfiles.rb"