rhoconnect 3.0.0.beta1 → 3.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +16 -2
- data/Gemfile +14 -5
- data/Gemfile.lock +13 -23
- data/Rakefile +86 -0
- data/bench/bench_runner.rb +5 -4
- data/bench/benchapp/Gemfile +17 -8
- data/bench/blobapp/Gemfile +13 -14
- data/doc/adapters-crm.txt +226 -0
- data/doc/adapters-intro.txt +18 -0
- data/doc/client.txt +29 -2
- data/doc/heroku-addon.txt +54 -0
- data/doc/install.txt +1 -2
- data/doc/migration.txt +18 -6
- data/doc/net-plugin.txt +276 -0
- data/doc/plugin-intro.txt +6 -0
- data/doc/push.txt +1 -1
- data/doc/rails-plugin.txt +116 -0
- data/doc/rest-api.txt +2 -2
- data/doc/settings.txt +59 -0
- data/doc/tutorial.txt +8 -5
- data/generators/rhoconnect.rb +30 -0
- data/generators/templates/application/Gemfile +16 -7
- data/generators/templates/application/gitignore +4 -0
- data/install.sh +74 -106
- data/installer/deb-scripts/LICENSE +75 -0
- data/installer/deb-scripts/install.sh +300 -0
- data/installer/deb-scripts/scripts/rho_connect_install_constants.rb +32 -0
- data/installer/deb-scripts/scripts/rho_connect_install_installers.rb +103 -0
- data/installer/deb-scripts/scripts/rho_connect_install_utilities.rb +110 -0
- data/installer/deb-scripts/scripts/rhoinstaller.rb +55 -0
- data/installer/deb-scripts/utils/README +67 -0
- data/installer/deb-scripts/utils/create_texts.rb +76 -0
- data/installer/deb-scripts/utils/redis_init_script +124 -0
- data/installer/deb-scripts/utils/redis_log_rotate +8 -0
- data/installer/unix-like/install.sh +361 -0
- data/installer/unix-like/post-install.sh +8 -0
- data/installer/unix-like/pre-install.sh +8 -0
- data/installer/unix-like/rho_connect_install_constants.rb +9 -14
- data/installer/unix-like/rho_connect_install_debian.rb +7 -5
- data/installer/unix-like/rho_connect_install_dnd.rb +6 -6
- data/installer/unix-like/rho_connect_install_get_params.rb +1 -1
- data/installer/unix-like/rho_connect_install_installers.rb +39 -38
- data/installer/unix-like/rho_connect_install_utilities.rb +9 -10
- data/installer/unix-like/rho_connect_install_yum.rb +6 -5
- data/installer/unix-like/rhoinstaller.rb +8 -3
- data/installer/utils/create_texts.rb +313 -85
- data/installer/windows/rhosync.nsi +5 -5
- data/lib/rhoconnect/api/application/clientcreate.rb +1 -1
- data/lib/rhoconnect/api/application/clientregister.rb +1 -1
- data/lib/rhoconnect/api/application/clientreset.rb +1 -1
- data/lib/rhoconnect/client.rb +0 -1
- data/lib/rhoconnect/client_sync.rb +1 -0
- data/lib/rhoconnect/console/app/routes/home.rb +1 -1
- data/lib/rhoconnect/console/app/routes/user.rb +8 -3
- data/lib/rhoconnect/console/app/views/adapter.erb +2 -2
- data/lib/rhoconnect/console/app/views/ping.erb +14 -2
- data/lib/rhoconnect/console/app/views/users.erb +8 -1
- data/lib/rhoconnect/jobs/ping_job.rb +11 -3
- data/lib/rhoconnect/model.rb +2 -2
- data/lib/rhoconnect/read_state.rb +2 -0
- data/lib/rhoconnect/server.rb +4 -3
- data/lib/rhoconnect/source.rb +33 -6
- data/lib/rhoconnect/source_adapter.rb +5 -9
- data/lib/rhoconnect/source_sync.rb +11 -5
- data/lib/rhoconnect/store.rb +7 -4
- data/lib/rhoconnect/tasks.rb +3 -3
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect.rb +22 -8
- data/rhoconnect.gemspec +4 -22
- data/spec/api/application/rhoconnect_api_spec.rb +54 -8
- data/spec/api/source/get_source_params_spec.rb +2 -1
- data/spec/api/source/list_sources_spec.rb +3 -3
- data/spec/app_spec.rb +8 -1
- data/spec/apps/rhotestapp/settings/settings.yml +10 -5
- data/spec/apps/rhotestapp/sources/other_adapter.rb +7 -0
- data/spec/client_sync_spec.rb +5 -8
- data/spec/dynamic_adapter_spec.rb +8 -8
- data/spec/generator/generator_spec.rb +4 -2
- data/spec/jobs/ping_job_spec.rb +53 -0
- data/spec/model_spec.rb +2 -2
- data/spec/rhosync_spec.rb +1 -1
- data/spec/server/server_spec.rb +3 -14
- data/spec/source_sync_spec.rb +84 -2
- data/spec/support/shared_examples.rb +2 -2
- data/tasks/redis.rake +2 -2
- metadata +30 -41
- data/spec/api/rhosync_api_spec.rb.orig +0 -606
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/opt/rhoconnect/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','scripts'))
|
4
|
+
|
5
|
+
require 'rho_connect_install_constants'
|
6
|
+
|
7
|
+
@prefix = '/opt/rhoconnect'
|
8
|
+
@dist = 'debian'
|
9
|
+
@redis = ''
|
10
|
+
@ruby_version = 'rubyee'
|
11
|
+
@profile = '~/.profile'
|
12
|
+
|
13
|
+
# place_redis_init
|
14
|
+
# Places the redis initialization file into the correct directory
|
15
|
+
def place_redis_init
|
16
|
+
redis_init="/etc/init.d/redis"
|
17
|
+
|
18
|
+
# Move the script into the appropriate directory
|
19
|
+
`mv redis_init_script #{redis_init}`
|
20
|
+
# Make the init script executable
|
21
|
+
`chmod +x #{redis_init}`
|
22
|
+
|
23
|
+
# Set run levels
|
24
|
+
`update-rc.d -f redis defaults`
|
25
|
+
end #place_redis_init
|
26
|
+
|
27
|
+
def place_redis_logrotate
|
28
|
+
log_rotate = '/etc/logrotate.d/redis'
|
29
|
+
|
30
|
+
# Move the file to the appropriate directory
|
31
|
+
`mv redis_log_rotate #{log_rotate}`
|
32
|
+
end
|
33
|
+
|
34
|
+
# place_readme
|
35
|
+
# Places the readme file in the appropriate directory
|
36
|
+
def place_readme
|
37
|
+
readme_dir = "#{prefix}/README"
|
38
|
+
|
39
|
+
# Move the readme into the appropriate folder
|
40
|
+
`mv README #{readme_dir}`
|
41
|
+
end #create_readme
|
42
|
+
|
43
|
+
def create_passenger_load
|
44
|
+
passenger_load_file = '/etc/apache2/mods-available/passenger.load'
|
45
|
+
|
46
|
+
passenger_load = <<_PASSENGER_LOAD_
|
47
|
+
LoadModule passenger_module /opt/rhoconnect/lib/ruby/gems/1.8/gems/#{Constants::PASSENGER_VERSION}/ext/apache2/mod_passenger.so
|
48
|
+
PassengerRoot /opt/rhoconnect/lib/ruby/gems/1.8/gems/#{Constants::PASSENGER_VERSION}
|
49
|
+
PassengerRuby /opt/rhoconnect/bin/ruby
|
50
|
+
_PASSENGER_LOAD_
|
51
|
+
|
52
|
+
File.open( passenger_load_file, 'w' ) { |f| f << passenger_load }
|
53
|
+
end #create_passenger_load
|
54
|
+
|
55
|
+
def create_nginx_vhost
|
56
|
+
vhost_file = ''
|
57
|
+
|
58
|
+
File.open( vhost_file, 'w' ) { |f| f << vhost }
|
59
|
+
end #create_apache_vhost
|
60
|
+
|
61
|
+
def create_texts
|
62
|
+
if @redis
|
63
|
+
place_redis_init
|
64
|
+
place_redis_logrotate
|
65
|
+
end
|
66
|
+
|
67
|
+
readme = create_readme
|
68
|
+
|
69
|
+
create_passenger_load
|
70
|
+
create_apache_vhost
|
71
|
+
|
72
|
+
puts readme
|
73
|
+
|
74
|
+
end #create_texts
|
75
|
+
|
76
|
+
create_texts
|
@@ -0,0 +1,124 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
### BEGIN INIT INFO
|
3
|
+
# Provides: redis-server
|
4
|
+
# Required-Start: $syslog
|
5
|
+
# Required-Stop: $syslog
|
6
|
+
# Should-Start: $local_fs
|
7
|
+
# Should-Stop: $local_fs
|
8
|
+
# Default-Start: 2 3 4 5
|
9
|
+
# Default-Stop: 0 1 6
|
10
|
+
# Short-Description: redis-server - Persistent key-value db
|
11
|
+
# Description: redis-server - Persistent key-value db
|
12
|
+
### END INIT INFO
|
13
|
+
#
|
14
|
+
# Author: Wayne E. Seguin <wayneeseguin@gmail.com>
|
15
|
+
# License: The same licence as Redis, New BSD
|
16
|
+
# http://www.opensource.org/licenses/bsd-license.php
|
17
|
+
#
|
18
|
+
|
19
|
+
# Source the system config file, if it exists.
|
20
|
+
if [[ -s /etc/conf.d/redis ]] ; then
|
21
|
+
source /etc/conf.d/redis
|
22
|
+
fi
|
23
|
+
|
24
|
+
# Default config variables that have not been set.
|
25
|
+
port="${port:-6379}"
|
26
|
+
prefix="${prefix:-/opt/rhoconnect}"
|
27
|
+
redis="${prefix}/bin/redis-server"
|
28
|
+
redis_cli="${prefix}/bin/redis-cli"
|
29
|
+
pidfile="${pidfile:-/var/run/redis.pid}"
|
30
|
+
config="${config:-/opt/rhoconnect/etc/redis.conf}"
|
31
|
+
user="${user:-root}"
|
32
|
+
#prefix="${prefix:-/usr/local}"
|
33
|
+
#config="${config:-/usr/local/etc/redis.conf}"
|
34
|
+
#pidfile="${pidfile:-/var/run/redis/redis.pid}"
|
35
|
+
#config="${config:-/etc/redis/redis.conf}"
|
36
|
+
#user="${user:-redis}"
|
37
|
+
|
38
|
+
#
|
39
|
+
# Set the running $pid value based on $pidfile.
|
40
|
+
#
|
41
|
+
if [[ -s "$pidfile" ]] ; then
|
42
|
+
pid=$(cat $pidfile)
|
43
|
+
else
|
44
|
+
rm -f $pidfile
|
45
|
+
fi
|
46
|
+
|
47
|
+
# In case there was pidfile corruption...
|
48
|
+
if [[ "Linux" = "$(uname)" ]] ; then
|
49
|
+
# /proc does not exist on say, Darwin
|
50
|
+
if [[ ! -z "${pid}" ]] && [[ ! -x "/proc/${pid}" ]] ;then
|
51
|
+
pid="$(ps auxww | grep [r]edis | grep "$config" | grep -v 'grep' | awk '{print $2}')"
|
52
|
+
elif [[ -z "${pid}" ]] ; then
|
53
|
+
pid="$(ps auxww | grep [r]edis | grep "$config" | grep -v 'grep' | awk '{print $2}')"
|
54
|
+
fi
|
55
|
+
else
|
56
|
+
if [[ -z "${pid}" ]] ; then
|
57
|
+
pid="$(ps auxww | grep [r]edis | grep "$config" | grep -v 'grep' | awk '{print $2}')"
|
58
|
+
fi
|
59
|
+
fi
|
60
|
+
|
61
|
+
#
|
62
|
+
# Start redis using redis-server as user 'redis'.
|
63
|
+
#
|
64
|
+
redis_start() {
|
65
|
+
if [[ -f $pidfile ]] ; then
|
66
|
+
echo "$pidfile exists, redis-server is either already running or crashed."
|
67
|
+
exit 1
|
68
|
+
elif [[ ! -z "$pid" ]] ; then
|
69
|
+
echo -e "\nRedis is already running with configuration '$config'."
|
70
|
+
echo "$pid" > $pidfile # Ensure pidfile exists with the pid.
|
71
|
+
else
|
72
|
+
echo "Starting Redis server..."
|
73
|
+
su $user -c "$redis $config"
|
74
|
+
exit 0
|
75
|
+
fi
|
76
|
+
}
|
77
|
+
|
78
|
+
#
|
79
|
+
# Stop redis using redis-cli SHUTDOWN.
|
80
|
+
#
|
81
|
+
redis_stop() {
|
82
|
+
echo -n "Stopping redis server on port ${port} ... "
|
83
|
+
"$redis_cli" -p ${port} SHUTDOWN
|
84
|
+
|
85
|
+
# Keep user informed while server shuts down.
|
86
|
+
echo "Waiting for the redis server to shutdown "
|
87
|
+
|
88
|
+
if [[ "Linux" = "$(uname)" ]] ; then
|
89
|
+
if [[ "${pid}" = "" ]] ; then
|
90
|
+
echo "redis server is not running."
|
91
|
+
# Clear out the old pidfile if available
|
92
|
+
rm -f $pidfile
|
93
|
+
exit 1
|
94
|
+
fi
|
95
|
+
while [[ -x /proc/${pid} ]] ; do
|
96
|
+
echo -n '.' ; sleep 1
|
97
|
+
done
|
98
|
+
else # Darwin, etc...
|
99
|
+
while [[ ! -z "$(ps auxww | grep [r]edis | grep "$config" | awk '{print $2}')" ]] ; do
|
100
|
+
echo -n '.' ; sleep 1
|
101
|
+
done
|
102
|
+
fi
|
103
|
+
|
104
|
+
# Clear out the old pidfile.
|
105
|
+
rm -f $pidfile
|
106
|
+
|
107
|
+
# Notify user of successful completion.
|
108
|
+
echo -e "redis server stopped."
|
109
|
+
exit 0
|
110
|
+
}
|
111
|
+
|
112
|
+
redis_usage() {
|
113
|
+
echo -e "Usage: $0 {start,stop}"
|
114
|
+
exit 1
|
115
|
+
}
|
116
|
+
|
117
|
+
#
|
118
|
+
# CLI logic.
|
119
|
+
#
|
120
|
+
case "$1" in
|
121
|
+
start) redis_start ;;
|
122
|
+
stop) redis_stop ;;
|
123
|
+
*) redis_usage ;;
|
124
|
+
esac
|
@@ -0,0 +1,361 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# DO FIRST
|
4
|
+
|
5
|
+
# make sure only run as root
|
6
|
+
if [ "$(id -u)" != "0" ]; then
|
7
|
+
echo "This script must be run as root"
|
8
|
+
exit 1
|
9
|
+
fi
|
10
|
+
|
11
|
+
timeInitial=`date +%H%M%S`
|
12
|
+
installTime=$timeInitial
|
13
|
+
|
14
|
+
# CONSTANTS
|
15
|
+
|
16
|
+
RHOCONNECT_VERSION="3.0.0.beta3"
|
17
|
+
PACKAGE_INSTALL_DIR="/tmp/installdir/rhoconnect-${RHOCONNECT_VERSION}"
|
18
|
+
DEPS=(gcc tar make wget)
|
19
|
+
|
20
|
+
# FUNCTIONS
|
21
|
+
|
22
|
+
echoLog ()
|
23
|
+
{
|
24
|
+
timeStamp="[`date`]: "
|
25
|
+
echo -e $1
|
26
|
+
#end echoLog
|
27
|
+
}
|
28
|
+
|
29
|
+
showHelp ()
|
30
|
+
{
|
31
|
+
echoLog "
|
32
|
+
Usage: install.sh [options]\n
|
33
|
+
--no-redis Skip the installation of the redis server.\n
|
34
|
+
--offline Check that all necessary files are installed in /opt/rhoconnect if no prefix is specified.\n
|
35
|
+
-p, --prefix PREFIX Specify PREFIX as the installation directory. Default is /opt/rhoconnect.\n
|
36
|
+
-r, --ruby-version VERSION Specify version of ruby to install. Default is Ruby Enterprise.\n
|
37
|
+
-s, --silent Perform installation with minimal output.\n
|
38
|
+
--skip-ruby Use system ruby instead of ruby installed through this installer.\n
|
39
|
+
-w, --web-server SERVER Specify that you are using web server SERVER. Default is Nginx.\n
|
40
|
+
-h, --help Display this screen.\n
|
41
|
+
"
|
42
|
+
# End script after printing help message
|
43
|
+
exit
|
44
|
+
} #end showHelp
|
45
|
+
|
46
|
+
checkDeps ()
|
47
|
+
{
|
48
|
+
missingDeps=""
|
49
|
+
for ((i=0; i<${#DEPS[@]}; i++))
|
50
|
+
do
|
51
|
+
dep=`which ${DEPS[$i]} 2> /dev/null`
|
52
|
+
if [[ $dep == "" ]]; then
|
53
|
+
missingDeps="${missingDeps}${DEPS[$i]}\n"
|
54
|
+
fi
|
55
|
+
done
|
56
|
+
|
57
|
+
if [[ $missingDeps != "" ]]; then
|
58
|
+
echoLog "Dependencies Missing: " | tee -a $log
|
59
|
+
echoLog "${missingDeps}" | tee -a $log
|
60
|
+
echoLog "These must be installed before setup can continue..." | tee -a $log
|
61
|
+
exit
|
62
|
+
fi
|
63
|
+
} #end checkDeps
|
64
|
+
|
65
|
+
determinePkgMgr ()
|
66
|
+
{
|
67
|
+
if [[ `which apt-get 2> /dev/null` != "" ]]; then
|
68
|
+
pkgMgr="apt-get -y"
|
69
|
+
dist='debian'
|
70
|
+
elif [[ `which yum 2> /dev/null` != "" ]]; then
|
71
|
+
pkgMgr="yum -y"
|
72
|
+
dist='yum'
|
73
|
+
else
|
74
|
+
echoLog "No supported package manager." | tee -a $log
|
75
|
+
echoLog "Please install apt-get or yum to continue..." | tee -a $log
|
76
|
+
exit
|
77
|
+
fi
|
78
|
+
} #end determinePkgMgr
|
79
|
+
|
80
|
+
parseOpts ()
|
81
|
+
{
|
82
|
+
for i in "$*"; do
|
83
|
+
i=$(echo $i | tr '[:upper:]' '[:lower:]')
|
84
|
+
opts="${opts}${i} "
|
85
|
+
# looking for getVal flag to grab next value.
|
86
|
+
case $getVal in
|
87
|
+
"p" )
|
88
|
+
prefix=$i
|
89
|
+
;;
|
90
|
+
"w" )
|
91
|
+
webServer=$i
|
92
|
+
;;
|
93
|
+
"r" )
|
94
|
+
rubyVersion=$i
|
95
|
+
;;
|
96
|
+
* )
|
97
|
+
;;
|
98
|
+
esac
|
99
|
+
|
100
|
+
# Check options passed in and assign flags where applicable
|
101
|
+
case $i in
|
102
|
+
--web-server | -w )
|
103
|
+
getVal="w"
|
104
|
+
;;
|
105
|
+
--prefix | -p )
|
106
|
+
getVal="p"
|
107
|
+
;;
|
108
|
+
--ruby-version )
|
109
|
+
getVal="r"
|
110
|
+
;;
|
111
|
+
--offline )
|
112
|
+
;;
|
113
|
+
--silent | -s )
|
114
|
+
;;
|
115
|
+
--skip-redis )
|
116
|
+
redis=false
|
117
|
+
;;
|
118
|
+
--skip-ruby )
|
119
|
+
ruby=false
|
120
|
+
;;
|
121
|
+
--help | -h )
|
122
|
+
showHelp
|
123
|
+
;;
|
124
|
+
* )
|
125
|
+
if [ "${i}" ]; then
|
126
|
+
echoLog "${i} is not a valid option" | tee -a $log
|
127
|
+
exit
|
128
|
+
fi
|
129
|
+
;;
|
130
|
+
esac
|
131
|
+
done
|
132
|
+
} #end parseOpts
|
133
|
+
|
134
|
+
cleanPrefix ()
|
135
|
+
{
|
136
|
+
# make sure there are no double /'s in the prefix path
|
137
|
+
prefix=${prefix/\/\/+/"/"}
|
138
|
+
|
139
|
+
# make sure path is absolute for ruby EE installation
|
140
|
+
if [[ $prefix == *\.* ]]; then
|
141
|
+
prefix=${prefix/\./`pwd`}
|
142
|
+
fi
|
143
|
+
|
144
|
+
# make sure prefix exists, create if not
|
145
|
+
if ! [ -d $prefix ]; then
|
146
|
+
mkdir -p $prefix
|
147
|
+
fi
|
148
|
+
} #end cleanPrefix
|
149
|
+
|
150
|
+
setPrefixDependantPaths ()
|
151
|
+
{
|
152
|
+
# if rubyBinDir not specified
|
153
|
+
if [$rubyBinDir == ""]; then
|
154
|
+
rubyBinDir="${prefix}/ruby/bin"
|
155
|
+
fi
|
156
|
+
|
157
|
+
# If logs directory does not exist, create it
|
158
|
+
if ! [[ -d "${prefix}/logs/" ]]; then
|
159
|
+
mkdir "${prefix}/logs/"
|
160
|
+
fi
|
161
|
+
|
162
|
+
# Make path to log file absolute and create directory if not already existent
|
163
|
+
log="${prefix}/logs/${log}"
|
164
|
+
touch $log
|
165
|
+
|
166
|
+
# Add the log file path to the info file
|
167
|
+
`echo $log >> info.dat`
|
168
|
+
cat info.dat
|
169
|
+
|
170
|
+
# Move info.dat into installation directory if not already there
|
171
|
+
if ! [ -e "${prefix}/info.dat" ]; then
|
172
|
+
mv info.dat "${prefix}/info.dat"
|
173
|
+
fi
|
174
|
+
} #end setPrefixDependantPaths
|
175
|
+
|
176
|
+
setDefaults ()
|
177
|
+
{
|
178
|
+
# if $prefix not specified set to /opt/rhoconnect
|
179
|
+
if [$prefix == ""]; then
|
180
|
+
prefix="/opt/rhoconnect"
|
181
|
+
fi
|
182
|
+
|
183
|
+
# if $webServer not specified set to nginx
|
184
|
+
if [$webServer == ""]; then
|
185
|
+
webServer="nginx"
|
186
|
+
fi
|
187
|
+
} #end setDefaults
|
188
|
+
|
189
|
+
logAndPrint ()
|
190
|
+
{
|
191
|
+
$1 > tempout 2>&1
|
192
|
+
exitStatus=$?
|
193
|
+
cat tempout | tee -a $log
|
194
|
+
} #end logAndPrint
|
195
|
+
|
196
|
+
setRubyVars ()
|
197
|
+
{
|
198
|
+
if [[ $rubyVersion == "" || $rubyVersion =~ ruby'ee'|'enterprise' ]]; then
|
199
|
+
rubyVersion="rubyee"
|
200
|
+
rubyDir="ruby-enterprise-1.8.7-2011.03"
|
201
|
+
rubyTar="${rubyDir}.tar.gz"
|
202
|
+
rubyURL="http://rubyenterpriseedition.googlecode.com/files/${rubyTar}"
|
203
|
+
elif [$rubyVersion == "ruby187"]; then
|
204
|
+
rubyDir="ruby-1.8.7"
|
205
|
+
rubyTar="${rubyDir}.tar.gz"
|
206
|
+
rubyURL="ftp://ftp.ruby-lang.org/pub/ruby/1.8/${rubyTar}"
|
207
|
+
elif [$rubyVersion == "ruby192"]; then
|
208
|
+
rubyDir="ruby-1.9.2-p180"
|
209
|
+
rubyTar="${rubyDir}.tar.gz"
|
210
|
+
rubyURL="http://ftp.ruby-lang.org/pub/ruby/1.9/${rubyTar}"
|
211
|
+
else
|
212
|
+
echoLog "${rubyVersion} is not a valid ruby version" | tee -a $log
|
213
|
+
exit
|
214
|
+
fi
|
215
|
+
} #end setRubyVars
|
216
|
+
|
217
|
+
installRuby ()
|
218
|
+
{
|
219
|
+
if [[ ! -d "${prefix}${rubyDir}" ]]; then
|
220
|
+
echoLog "Loading ruby tarball ..." | tee -a $log
|
221
|
+
echoLog "wget -P ${prefix} ${rubyURL}" | tee -a $log
|
222
|
+
wget -P ${prefix} ${rubyURL}
|
223
|
+
echoLog "tar -xzf ${prefix}/${rubyTar} -C ${prefix}" | tee -a $log
|
224
|
+
tar -xzf ${prefix}/${rubyTar} -C ${prefix}
|
225
|
+
fi
|
226
|
+
echoLog "Installing ruby. This may take some time..." | tee -a $log
|
227
|
+
|
228
|
+
case $rubyVersion in
|
229
|
+
rubyee)
|
230
|
+
logAndPrint "${prefix}/${rubyDir}/installer --dont-install-useful-gems --no-dev-docs --auto ${prefix}"
|
231
|
+
;;
|
232
|
+
ruby187)
|
233
|
+
logAndPrint "${prefix}/${rubyDir}/configure --prefix=\"${prefix}\""
|
234
|
+
logAndPrint "make && make install"
|
235
|
+
;;
|
236
|
+
ruby192)
|
237
|
+
logAndPrint "${prefix}/${rubyDir}/configure --prefix=\"${prefix}\""
|
238
|
+
logAndPrint "make && make install"
|
239
|
+
;;
|
240
|
+
*)
|
241
|
+
logAndPrint "echoLog \"${rubyVersion} is not a supported ruby version\""
|
242
|
+
exit
|
243
|
+
;;
|
244
|
+
esac
|
245
|
+
|
246
|
+
if [[ $exitStatus != 0 ]]; then
|
247
|
+
echoLog "Some dependencies not installed..." | tee -a $log
|
248
|
+
echoLog "Please install them and then re-run the installation script." | tee -a $log
|
249
|
+
exit
|
250
|
+
fi
|
251
|
+
|
252
|
+
rm tempout
|
253
|
+
} #end installRuby
|
254
|
+
|
255
|
+
getTime ()
|
256
|
+
{
|
257
|
+
timeDiff=$(( $1 - $timeInitial ))
|
258
|
+
timeSec=$(( $timeDiff % 100 ))
|
259
|
+
timeDiff=$(( $timeDiff / 100 ))
|
260
|
+
|
261
|
+
if [ $timeSec -gt 1 ]; then
|
262
|
+
timeSec=$timeSec" seconds"
|
263
|
+
else
|
264
|
+
timeSec=$timeSec" second"
|
265
|
+
fi
|
266
|
+
|
267
|
+
if [ $timeDiff -gt 0 ]; then
|
268
|
+
timeMin=$(( $timeDiff % 100 ))
|
269
|
+
timeDiff=$(( $timeDiff / 100 ))
|
270
|
+
if [ $timeMin -gt 1 ]; then
|
271
|
+
timeMin=$timeMin" minutes and "
|
272
|
+
else
|
273
|
+
timeMin=$timeMin" minute and "
|
274
|
+
fi
|
275
|
+
fi
|
276
|
+
|
277
|
+
if [ $timeDiff -gt 0 ]; then
|
278
|
+
timeHour=$(( $timeDiff % 100 ))
|
279
|
+
timeDiff=$(( $timeDiff / 100 ))
|
280
|
+
if [ $timeHour -gt 1 ]; then
|
281
|
+
timeHour=$timeHour" hours, "
|
282
|
+
else
|
283
|
+
timeHour=$timeHour" hour, "
|
284
|
+
fi
|
285
|
+
fi
|
286
|
+
|
287
|
+
echoLog "\nInstallation completed in ${timeHour}${timeMin}${timeSec}."
|
288
|
+
} #end getTime
|
289
|
+
|
290
|
+
# SCRIPT
|
291
|
+
# define log file name
|
292
|
+
DATEFILE=`date +%Y%m%d%H%M%S`
|
293
|
+
log=rhoconnect_$(date +$DATEFILE).log
|
294
|
+
|
295
|
+
# Make sure basic system dependencies are installed
|
296
|
+
checkDeps
|
297
|
+
|
298
|
+
# Determine which package management the system uses (Debian short-circuted)
|
299
|
+
determinePkgMgr
|
300
|
+
|
301
|
+
# define option variables
|
302
|
+
opts=""
|
303
|
+
prefix=""
|
304
|
+
getVal=""
|
305
|
+
webServer=""
|
306
|
+
rubyVersion=""
|
307
|
+
rubyBinDir=""
|
308
|
+
|
309
|
+
# parse command-line options
|
310
|
+
parseOpts "$*"
|
311
|
+
|
312
|
+
# Set default Values
|
313
|
+
setDefaults
|
314
|
+
|
315
|
+
# Reformat ruby version to fit this scripts format
|
316
|
+
# Tolower rubyVersion
|
317
|
+
rubyVersion=$(echoLog $rubyVersion | tr '[:upper:]' '[:lower:]')
|
318
|
+
# Remove all white space
|
319
|
+
rubyVersion=${rubyVersion//[[:space:]]}
|
320
|
+
# Remove periods and hyphens such as those present in version numbers
|
321
|
+
rubyVersion=${rubyVersion//[-.]/}
|
322
|
+
|
323
|
+
# Set ruby insatallation variables
|
324
|
+
setRubyVars
|
325
|
+
|
326
|
+
# Clean up the formatting of prefix
|
327
|
+
cleanPrefix
|
328
|
+
|
329
|
+
# Once the prefix path is cleaned up...
|
330
|
+
setPrefixDependantPaths
|
331
|
+
|
332
|
+
# Install ruby if not already installed
|
333
|
+
if ! [ -e "${prefix}/bin/ruby" ]; then
|
334
|
+
installRuby
|
335
|
+
else
|
336
|
+
echoLog "Ruby already installed" | tee -a $log
|
337
|
+
fi
|
338
|
+
|
339
|
+
# Construct the string with which to call the ruby installation script.
|
340
|
+
callruby="sudo ${prefix}/bin/ruby ${PACKAGE_INSTALL_DIR}/unix-like/rhoinstaller.rb ${opts}"
|
341
|
+
# Call the ruby script
|
342
|
+
$callruby
|
343
|
+
|
344
|
+
if [[ $installedSoftware -eq ${#INSTALL_ARRAY[@]} ]]; then
|
345
|
+
rm "${prefix}/info.dat"
|
346
|
+
if [ -e $prefix$rubyTar ]; then
|
347
|
+
mv $prefix/$rubyTar $prefix"/downloads/"$rubyTar
|
348
|
+
fi
|
349
|
+
if [ -e $prefix$rubyDir ]; then
|
350
|
+
mv $prefix$rubyDir $prefix"/downloads/"$rubyDir
|
351
|
+
fi
|
352
|
+
if [ ! -e $prefix"/post-install" ]; then
|
353
|
+
mkdir $prefix"/post-install"
|
354
|
+
fi
|
355
|
+
|
356
|
+
opts=$opts" -d $dist"
|
357
|
+
|
358
|
+
sudo ${prefix}/bin/ruby ${PACKAGE_INSTALL_DIR}/utils/create_texts.rb ${opts}
|
359
|
+
# timeFinal=`date +%H%M%S`
|
360
|
+
# getTime $timeFinal
|
361
|
+
fi
|
@@ -8,27 +8,22 @@ PACKAGES = ["zlib1g-dev",
|
|
8
8
|
"libaprutil1-dev",
|
9
9
|
"dtach"]
|
10
10
|
|
11
|
-
RUBYGEMS = "rubygems-1.8.5"
|
12
|
-
REDIS = "redis-2.2.
|
11
|
+
#RUBYGEMS = "rubygems-1.8.5"
|
12
|
+
REDIS = "redis-2.2.13"
|
13
13
|
SQLITE3 = "sqlite-autoconf-3070701"
|
14
|
+
RUBY = "ruby-enterprise-1.8.7-2011.03"
|
15
|
+
Nginx = "nginx-1.0.6"
|
14
16
|
|
15
|
-
SOFTWARE = [
|
16
|
-
REDIS,
|
17
|
-
SQLITE3]
|
17
|
+
SOFTWARE = [ REDIS, SQLITE3, RUBY ]
|
18
18
|
|
19
|
-
RUBYGEMS_URL = "http://rubyforge.org/frs/download.php/74954/" +
|
20
|
-
"#{ RUBYGEMS }.tgz"
|
19
|
+
#RUBYGEMS_URL = "http://rubyforge.org/frs/download.php/74954/" + "#{ RUBYGEMS }.tgz"
|
21
20
|
REDIS_URL = "http://redis.googlecode.com/files/#{ REDIS }.tar.gz"
|
22
21
|
SQLITE3_URL = "http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz"
|
23
22
|
|
24
23
|
|
25
|
-
URLS = [
|
26
|
-
REDIS_URL,
|
27
|
-
SQLITE3_URL]
|
24
|
+
URLS = [ REDIS_URL, SQLITE3_URL ]
|
28
25
|
|
29
|
-
GEMS = ["bundler",
|
30
|
-
"passenger",
|
31
|
-
"sqlite3"]
|
26
|
+
GEMS = ["bundler", "passenger"]
|
32
27
|
|
33
28
|
SUPPORTED_PKG_MGRS = ["apt-get", "yum"]
|
34
29
|
|
@@ -40,7 +35,7 @@ CHECKS = ["check_all_packages",
|
|
40
35
|
"check_all_gems",
|
41
36
|
"check_web_server_running"]
|
42
37
|
|
43
|
-
DEFAULT_INSTALL_DIR = "/opt/rhoconnect
|
38
|
+
DEFAULT_INSTALL_DIR = "/opt/rhoconnect"
|
44
39
|
|
45
40
|
DEFAULTS = {"Packages" => PACKAGES,
|
46
41
|
"Software" => SOFTWARE,
|
@@ -26,12 +26,14 @@ class Debian
|
|
26
26
|
set_log_file @options[:log]
|
27
27
|
|
28
28
|
#gather necessary files
|
29
|
-
download_and_decompress
|
29
|
+
download_and_decompress(@options[:prefix], [Constants::REDIS_URL])
|
30
30
|
|
31
|
-
#
|
32
|
-
install_rubygems
|
31
|
+
# ruby gems is installed by the REE installer
|
32
|
+
#install_rubygems
|
33
33
|
install_redis if @options[:redis]
|
34
|
-
|
34
|
+
|
35
|
+
# Look for sqlite3-dev as it is required by the sqlite3 gem
|
36
|
+
`apt-get -y install libsqlite3-dev` if `dpkg -l | grep libsqlite3-dev`.empty?
|
35
37
|
|
36
38
|
#start installing
|
37
39
|
install_all_gems
|
@@ -41,7 +43,7 @@ class Debian
|
|
41
43
|
install_rhoconnect
|
42
44
|
|
43
45
|
#remove downloaded tarballs
|
44
|
-
cleanup options[:prefix]
|
46
|
+
cleanup options[:prefix]
|
45
47
|
end #execute_installation
|
46
48
|
|
47
49
|
# to_s
|
@@ -5,10 +5,10 @@ module DownloadAndDocompress
|
|
5
5
|
|
6
6
|
# download_and_decompress
|
7
7
|
# Delegates the download and decompression duties
|
8
|
-
def download_and_decompress(prefix)
|
8
|
+
def download_and_decompress(prefix, tarballs)
|
9
9
|
print_header "Downloading and Decompressing"
|
10
10
|
downloads = 0
|
11
|
-
|
11
|
+
tarballs.each do |url|
|
12
12
|
if !File.exists?("#{ get_tarball_name url }") ||
|
13
13
|
!File.exists?("#{ get_version url }")
|
14
14
|
wget_download prefix, url
|
@@ -25,8 +25,8 @@ module DownloadAndDocompress
|
|
25
25
|
# Takes a URL and the name of a tarball and issues a wget command on said
|
26
26
|
# URL unless the tarball or directory already exists
|
27
27
|
def wget_download(prefix, url)
|
28
|
-
if !File.exists?("#{ prefix }
|
29
|
-
!File.directory?("#{ prefix }
|
28
|
+
if !File.exists?("#{ prefix }/#{ get_tarball_name url }") &&
|
29
|
+
!File.directory?("#{ prefix }/#{ get_version url }")
|
30
30
|
cmd "wget -P #{ prefix } #{ url }"
|
31
31
|
end #if
|
32
32
|
end #wget_download
|
@@ -37,8 +37,8 @@ module DownloadAndDocompress
|
|
37
37
|
def decompress(prefix, url)
|
38
38
|
tarball = get_tarball_name(url)
|
39
39
|
dir = get_version(url)
|
40
|
-
cmd "tar -xzf #{ prefix }
|
41
|
-
File.directory? "#{ prefix }
|
40
|
+
cmd "tar -xzf #{ prefix }/#{ tarball } -C #{ prefix }" unless
|
41
|
+
File.directory? "#{ prefix }/#{ dir }"
|
42
42
|
end #decompress
|
43
43
|
|
44
44
|
# get_version
|