-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathruby.sh
More file actions
100 lines (84 loc) · 3.38 KB
/
Copy pathruby.sh
File metadata and controls
100 lines (84 loc) · 3.38 KB
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
100
#!/bin/bash
# ruby.sh - installs software needed to develop Ruby Appium tests.
# Ruby 2.0+ (http://www.ruby-lang.org/en/)
# RVM (https://rvm.io/)
# selenium-webdriver (http://rubygems.org/gems/selenium-webdriver)
# appium_lib (http://rubygems.org/gems/appium_lib)
# rspec (http://rubygems.org/gems/rspec)
# CI::Reporter (http://rubygems.org/gems/ci_reporter)
ruby_ver=2.0.0p247
ruby_ver_m=2.0.0
ruby_ver_p=247
rvm_ver=1.21.8
rspec_ver=2.14.2
echo -e "\nSetting up Ruby environment..."
echo -e "$chck Checking for Ruby and RVM...${txtrst}"
if ! brew list | grep -q libyaml; then
echo -e "$inst Installing libyaml...${txtrst}"
successfully brew install libyaml
fi
if ! try ruby -v || ! try rvm -v; then
echo -e "$inst Installing Ruby and RVM (this may take "`
`"a few minutes)...${txtrst}"
successfully curl -L https://get.rvm.io \| bash -s stable --ruby
successfully source $HOME/.rvm/scripts/rvm
successfully rvm reload
fi
echo -e "$chck Checking Ruby and RVM versions...${txtrst}"
r=$(successfully rvm -v | awk '{print $2}' | grep '\.')
if ! check_version $r $rvm_ver; then
echo -e "$warn RVM is outdated, should be $rvm_ver but is $r ${txtrst}"
echo -e "$updt Updating Ruby and RVM...${txtrst}"
if curl -L https://get.rvm.io/ | bash -s stable --ruby | \
grep 'rvm-installer [options]'; then
successfully rvm-installer
fi
successfully rvm reload
fi
# Ruby has major and minor versions to account for (separated by 'p')
r=$(successfully ruby -v | awk '{print $2}' | grep "\.")
rr=(${r//p/ })
# Update to 2.0+
if ! check_version $rr $ruby_ver_m; then
echo -e "$warn Ruby is majorly outdated, should be $ruby_ver "`
`"but is $r ${txtrst}"
echo -e "$updt Resolving OpenSSL compatibility problem (this may take "`
`"a while)...${txtrst}"
successfully rvm pkg install openssl
successfully rvm reinstall all --force
echo -e "$inst Installing Ruby 2.0...${txtrst}"
successfully rvm install 2.0.0
echo -e "$updt Setting Ruby 2.0 as the default...${txtrst}"
successfully rvm use 2.0.0 --default
fi
if ! check_version ${rr[1]} $ruby_ver_p; then
echo -e "$warn Ruby is outdated, should be $ruby_ver but is $r ${txtrst}"
echo -e "$updt Updating Ruby and RVM...${txtrst}"
if curl -L https://get.rvm.io/ | bash -s stable --ruby | \
grep "rvm-installer [options]"; then
successfully rvm-installer
fi
successfully rvm reload
fi
echo -e "\n$chck Checking for Selenium WebDriver...${txtrst}"
if ! gem list --local | grep -q selenium-webdriver; then
echo -e "$inst Installing Selenium WebDriver...${txtrst}"
successfully gem install selenium-webdriver
fi
echo -e "\n$chck Checking for appium_lib...${txtrst}"
if ! gem list --local | grep -q appium_lib; then
echo -e "$inst Installing appium_lib...${txtrst}"
successfully gem install appium_lib
fi
echo -e "\n$chck Checking for RSpec...${txtrst}"
if ! try rspec --version; then
echo -e "$inst Installing RSpec...${txtrst}"
successfully gem install rspec
fi
echo -e "\n$chck Checking for CI::Reporter...${txtrst}"
if ! gem list --local | grep -q ci_reporter; then
echo -e "$inst Installing CI::Reporter...${txtrst}"
successfully gem install ci_reporter
fi
echo -e "\n$updt Updating gems...${txtrst}"
successfully gem update