forked from lashd/mirage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
full_build.sh
executable file
·100 lines (85 loc) · 2.2 KB
/
full_build.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
blue='\033[34m'
red='\033[31m'
green='\033[32m'
yellow='\033[33m'
white='\033[37m'
bold='\033[1m'
reset='\033[0m'
println(){
echo -e "$1${reset}"
}
print(){
echo -ne "$1${reset}"
}
usage(){
println "${bold}Usage:\n"
println "./full_build.sh [ruby_version]\n"
println "When running with out a ruby version, the full build is run for ruby versions:"
println "1.8.6\n1.8.7\n1.9.1\n1.9.2\njruby\n"
println "Else specify a particular ruby version to run the build against\n"
}
if [ -f "$HOME/.rvm/scripts/rvm" ]
then
source "$HOME/.rvm/scripts/rvm"
elif [ -f "/usr/local/rvm/scripts/rvm" ]
then
source "/usr/local/rvm/scripts/rvm"
else
println "${bold}RVM Not found"
println "I looked in $HOME/.rvm/scripts/rvm and /usr/local/rvm/scripts/rvm"
println "RVM must be installed to run this script. It's great! find out more: here ${bold}http://rvm.beginrescueend.com/"
println "Until it is installed simply run the default rake target to test Mirage against your active version of Ruby and installed gems"
exit 1
fi
while getopts ":h" opt; do
case $opt in
h)
usage
exit 0
;;
\?)
println "Invalid option: -$OPTARG"
usage
exit 1
;;
esac
done
message=""
result=true
run_build_for_ruby( ){
println "${green}Running build for: $1"
ruby_list=`rvm list`
if [[ ${ruby_list} == *$1* ]]
then
rvm --create $1@mirage
rvm --force gemset empty
[ -f Gemfile.lock ] && rm Gemfile.lock
gem install bundler
bundle install
rake
if [ $? == 0 ]
then
message="${message}${blue}$1: ${green}pass\n"
else
message="${message}${blue}$1: ${red}fail\n"
result=false
fi
else
message="${message}${blue}$1: ${yellow}Not installed\n"
result=false
fi
}
if [ $1 ]
then
run_build_for_ruby $1
else
run_build_for_ruby 'ruby-1.8.6'
run_build_for_ruby 'ruby-1.8.7'
run_build_for_ruby 'ruby-1.9.1-p378'
run_build_for_ruby 'ruby-1.9.2'
run_build_for_ruby 'jruby'
fi
println "\n\n${message}"
print "${white}Result: "
[ ${result} == true ] && println "${green}Pass\n" || println "${red}Fail\n"