forked from adelasofia/developers.redhat.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_ci.sh
executable file
·71 lines (54 loc) · 1.66 KB
/
_ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -e
function setup_mac {
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
if ! type "pngquant" &> /dev/null; then
brew install pngquant
fi
if ! type "optipng" &> /dev/null; then
brew install optipng
fi
}
function commit_cdn {
## Commit back CDN changes
git add _cdn/cdn.yml
git commit -m "Update cdn.yml" || true
# Fetch any changes made since the build changed
git pull --rebase origin HEAD
git push origin HEAD
}
function setup_environment {
## Environment setup
# Read the ruby environment to use from the checkout
ruby_version=`cat .ruby-version`
ruby_gemset=`cat .ruby-gemset`
# Load or install RVM
if [ -s "$HOME/.rvm/scripts/rvm" ]; then
export RVM=$HOME/.rvm/bin/rvm
elif [ -s "/usr/local/rvm/scripts/rvm" ]; then
export RVM="/usr/local/rvm/bin/rvm"
else
\curl -sSL https://get.rvm.io | bash -s stable --user-install --autolibs=read-only
if [ -s "$HOME/.rvm/scripts/rvm" ]; then
export RVM=$HOME/.rvm/bin/rvm
elif [ -s "/usr/local/rvm/scripts/rvm" ]; then
export RVM="/usr/local/rvm/bin/rvm"
fi
fi
$RVM autolibs read-only
$RVM install ${ruby_version}
## Ruby Setup
# Ensure we are using the right ruby & gemset
$RVM gemset create ${ruby_gemset}
export RVMDO="$RVM ${ruby_version}@${ruby_gemset} do"
# Make sure rake is installed, so we can execute rake setup
if [ $($RVMDO gem list rake -i) != "true" ] ; then
$RVMDO gem install rake
fi
#We need bundler, and we need a recent version
$RVMDO gem install bundler
## Build setup
# Configure the environment. Must run bundle install to bootstrap the env
$RVMDO bundle install
$RVMDO rake setup
}