rhoconnect 3.0.0.rc1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data/{CHANGELOG → CHANGELOG.md} +8 -1
  2. data/CREDITS +6 -1
  3. data/Gemfile.lock +19 -1
  4. data/Rakefile +12 -13
  5. data/bench/blobapp/settings/license.key +1 -1
  6. data/doc/authentication.txt +1 -1
  7. data/doc/install.txt +1 -1
  8. data/doc/rest-api.txt +11 -0
  9. data/doc/settings.txt +0 -22
  10. data/generators/templates/application/Gemfile +2 -0
  11. data/generators/templates/application/config.ru +5 -0
  12. data/install.sh +17 -6
  13. data/installer/{utils → unix-like}/create_texts.rb +2 -2
  14. data/installer/unix-like/rho_connect_install_checkers.rb +2 -3
  15. data/installer/unix-like/rho_connect_install_constants.rb +22 -29
  16. data/installer/unix-like/rho_connect_install_installers.rb +18 -43
  17. data/installer/unix-like/rho_connect_install_utilities.rb +1 -0
  18. data/installer/unix-like/rhoinstaller.rb +12 -5
  19. data/installer/utils/constants.rb +45 -0
  20. data/installer/utils/nix_installation.rake +0 -0
  21. data/installer/utils/unix_install_test.rb +258 -0
  22. data/lib/rhoconnect/api/source/push_deletes.rb +4 -1
  23. data/lib/rhoconnect/api/source/push_objects.rb +4 -1
  24. data/lib/rhoconnect/document.rb +8 -0
  25. data/lib/rhoconnect/source.rb +7 -33
  26. data/lib/rhoconnect/source_adapter.rb +9 -5
  27. data/lib/rhoconnect/source_sync.rb +49 -29
  28. data/lib/rhoconnect/store.rb +51 -0
  29. data/lib/rhoconnect/tasks.rb +20 -1
  30. data/lib/rhoconnect/version.rb +1 -1
  31. data/rhoconnect.gemspec +1 -1
  32. data/spec/source_sync_spec.rb +0 -50
  33. data/spec/store_spec.rb +36 -1
  34. data/tasks/redis.rake +17 -0
  35. metadata +9 -9
  36. data/installer/utils/install_test.rb +0 -152
@@ -1,4 +1,11 @@
1
- ## 3.0.0.rc1 (not released)
1
+ ## 3.0.0 (2011-09-30)
2
+ * #18888077 - implement Redis transactions optimization for push_objects and push_deletes
3
+ * added 2 rake tasks (build:rpm and build:deb) to generate packaged software for popular linux servers
4
+ (CentOS/Ubuntu). The package includes ruby enterprise, redis and nginx servers, passenger,
5
+ and rhoconnect gem with all dependencies
6
+ * #19116273 - created new redis:startbg task for Rhostudio
7
+
8
+ ## 3.0.0.rc1 (2011-09-27)
2
9
  * load sqlite3 gem on demand, fixes issue with generator requiring it
3
10
  * #18934311 - create :startbg task for Rhostudio
4
11
 
data/CREDITS CHANGED
@@ -35,4 +35,9 @@ RhoConnect uses following other projects:
35
35
 
36
36
  bundler 1.0.10 (http://gembundler.com/)
37
37
  License: MIT (http://www.opensource.org/licenses/mit-license.php)
38
-
38
+
39
+ Nginx 1.0.6 (http://www.nginx.org/)
40
+ License: 2-clause BSD-like (http://nginx.org/LICENSE)
41
+
42
+ fpm 0.3.9 (https://github.com/jordansissel/fpm)
43
+ License: MIT (https://github.com/jordansissel/fpm/blob/master/LICENSE)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rhoconnect (3.0.0.rc1)
4
+ rhoconnect (3.0.0)
5
5
  bundler (~> 1.0)
6
6
  json (~> 1.5.0)
7
7
  rake (= 0.9.2)
@@ -17,20 +17,32 @@ GEM
17
17
  remote: http://rubygems.org/
18
18
  specs:
19
19
  addressable (2.2.6)
20
+ bouncy-castle-java (1.5.0146.1)
20
21
  crack (0.3.1)
22
+ dbd-jdbc (0.1.4)
23
+ dbi (0.4.5)
24
+ deprecated (= 2.0.1)
25
+ deprecated (2.0.1)
21
26
  diff-lcs (1.1.3)
22
27
  extlib (0.9.15)
23
28
  ffaker (1.8.1)
24
29
  fpm (0.3.9)
25
30
  json
26
31
  highline (1.6.2)
32
+ jdbc-sqlite3 (3.7.2)
33
+ jruby-jars (1.6.4)
34
+ jruby-openssl (0.7.4)
35
+ bouncy-castle-java
36
+ jruby-rack (1.0.10)
27
37
  json (1.5.4)
38
+ json (1.5.4-java)
28
39
  mime-types (1.16)
29
40
  rack (1.3.3)
30
41
  rack-test (0.6.1)
31
42
  rack (>= 1.0)
32
43
  rake (0.9.2)
33
44
  rcov (0.9.10)
45
+ rcov (0.9.10-java)
34
46
  redis (2.2.2)
35
47
  redis-namespace (1.0.3)
36
48
  redis (< 3.0.0)
@@ -63,11 +75,17 @@ GEM
63
75
  uuidtools (2.1.2)
64
76
  vegas (0.1.8)
65
77
  rack (>= 1.0.0)
78
+ warbler (1.3.2)
79
+ jruby-jars (>= 1.4.0)
80
+ jruby-rack (>= 1.0.0)
81
+ rake (>= 0.8.7)
82
+ rubyzip (>= 0.9.4)
66
83
  webmock (1.6.4)
67
84
  addressable (> 2.2.5, ~> 2.2)
68
85
  crack (>= 0.1.7)
69
86
 
70
87
  PLATFORMS
88
+ java
71
89
  ruby
72
90
 
73
91
  DEPENDENCIES
data/Rakefile CHANGED
@@ -105,12 +105,10 @@ def build_pkg(dist, arch, deps)
105
105
 
106
106
  Dir.mkdir("#{workspace}")
107
107
  Dir.mkdir("#{workspace}/unix-like")
108
- Dir.mkdir("#{workspace}/utils")
109
108
 
110
109
  # Copy all necessary Files into the workspace
111
110
  system("cp install.sh Gemfile Gemfile.lock #{workspace}")
112
111
  system("cp -r installer/unix-like/* #{workspace}/unix-like")
113
- system("cp -r installer/utils/create_texts.rb #{workspace}/utils")
114
112
  system("cp pkg/#{gem_name} #{workspace}")
115
113
 
116
114
  # cd into the pkg dir so that fpm will create the package into the pkg dir.
@@ -128,7 +126,6 @@ def build_pkg(dist, arch, deps)
128
126
  end #do
129
127
 
130
128
  # Create the package
131
- puts fpm_cmd
132
129
  system(fpm_cmd)
133
130
  # Leave no trace...
134
131
  system("rm -rf #{workspace}")
@@ -137,13 +134,14 @@ end #build_pkg
137
134
  desc "Build Debian DEB rhoconnect-#{Rhoconnect::VERSION}_all.deb package into the pkg directory"
138
135
  task "build:deb" => :build do
139
136
  deps = [
137
+ "wget (>= 1.0)", "make (>= 3.0)", "patch (>= 2.0)",
140
138
  "build-essential (>= 0)",
141
- "zlib1g-dev (>= 0)",
142
- "libssl-dev (>= 0)",
139
+ "zlib1g (>= 1.2.3)", "zlib1g-dev (>= 1.2.3)",
140
+ "libssl0.9.8 (>= 0)", "libssl-dev (>= 0.9.8)",
143
141
  "libcurl4-openssl-dev (>= 0)",
144
- "libreadline5-dev (>= 0)",
145
- "libsqlite3-0 (>= 3.7.4)",
146
- "libsqlite3-dev (>= 3.7.4)"
142
+ "libreadline5 (>= 0)", "libreadline5-dev (>= 0)",
143
+ # "libreadline6 (>= 0)", "libreadline6-dev (>= 0)",
144
+ "libsqlite3-0 (>= 3.7.4)", "libsqlite3-dev (>= 3.7.4)"
147
145
  ]
148
146
 
149
147
  build_pkg "deb", "all", deps
@@ -152,12 +150,13 @@ end #build:deb
152
150
  desc "Build Red Hat RPM rhoconnect-#{Rhoconnect::VERSION}.noarch.rpm package into the pkg directory"
153
151
  task "build:rpm" => :build do
154
152
  deps = [
153
+ "wget >= 1.0", "make >= 3.0", "patch >= 2.0",
155
154
  "gcc-c++ >= 4.1.2",
156
- "zlib-devel >= 1.2.3",
157
- "curl-devel >= 7.15.5",
158
- "pcre-devel >= 6.6",
159
- "openssl-devel >= 0.9.8e",
160
- "readline-devel >= 5.1"
155
+ "zlib >= 1.2.3", "zlib-devel >= 1.2.3",
156
+ "curl >= 7.15.5", "curl-devel >= 7.15.5",
157
+ "pcre >= 6.6", "pcre-devel >= 6.6",
158
+ "openssl >= 0.9.8e", "openssl-devel >= 0.9.8e",
159
+ "readline-devel >= 5.1", "readline-devel >= 5.1"
161
160
  ]
162
161
 
163
162
  build_pkg "rpm", "noarch", deps
@@ -1 +1 @@
1
- 73e2fe1f3d161b339acc4acf748f800a08ff03444f3c4cc51524545717c1efa26625ff53238bde371ef6fc26c4a0ade3fe9e39aa7026236fad33d69c4af069e8
1
+ 858fc60fadfde40273d0ac505906969318aa4931d1a2c4aeb24d98393c74379f60e226651601969874257f7f1fbda9b099ecd551a641519aa46819947fda0191
@@ -28,7 +28,7 @@ If your backend service requires authentication, simply add code to the authenti
28
28
  ## Changing Login
29
29
  If your actual user name is different than the username that is input into the client, you can change the username by returning a string instead of true if authentication was successful.
30
30
 
31
- :::ruby
31
+ :::ruby
32
32
  def authenticate(username, password, session)
33
33
  success = false
34
34
  # ... connect to backend using API and authenticate ...
data/doc/install.txt CHANGED
@@ -24,4 +24,4 @@ Your RhoConnect application folder will be located in C:\RhoConnect\rhoconnect b
24
24
  To install the RhoConnect gem, run:
25
25
 
26
26
  :::term
27
- $ [sudo] gem install rhoconnect --pre
27
+ $ [sudo] gem install rhoconnect
data/doc/rest-api.txt CHANGED
@@ -113,6 +113,11 @@ Push new objects or object updates to RhoConnect. These changes will be sent to
113
113
  }.to_json,
114
114
  :content_type => :json
115
115
  )
116
+
117
+ **NOTE: Normally, `push_objects` method will refresh the whole :md document in Redis. However, in case of large-size
118
+ documents, `push_objects` method can be optimized by invoking only the necessary updates. This can help reducing
119
+ the number of transactions with Redis. To force the optimization, user can use the `:rebuild_md => false` flag
120
+ in the `push_objects` parameters hash.
116
121
 
117
122
  ### `push_deletes`
118
123
  Delete objects from RhoConnect. These objects will be deleted from the device the next time it synchronizes.
@@ -132,6 +137,12 @@ Delete objects from RhoConnect. These objects will be deleted from the device th
132
137
  :content_type => :json
133
138
  )
134
139
 
140
+ **NOTE: Normally, `push_deletes` method will refresh the whole :md document in Redis. However, in case of large-size
141
+ documents, `push_deletes` method can be optimized by invoking only the necessary updates. This can help reducing
142
+ the number of transactions with Redis. To force the optimization, user can use the `:rebuild_md => false` flag
143
+ in the `push_deletes` parameters hash.
144
+
145
+
135
146
  ### `list_users`
136
147
  List users registered with this RhoConnect application.
137
148
 
data/doc/settings.txt CHANGED
@@ -34,26 +34,4 @@ Typical source settings include:
34
34
  default application poll interval
35
35
  even if source has its own setting.
36
36
  :partition_type: <app|user> - default partition type for the source
37
- :retry_limit: <number_of_retries> - this option allows to for the user to
38
- perform sync upto <number_of_retries> times
39
- in case of previous sync failure.
40
- Normally, each sync resets the refresh time
41
- according to the polling interval regardless
42
- of the sync success or failure. In case of failure,
43
- it may not be a desired scenario because user will
44
- be getting an error on all sync attempts until
45
- the next polling interval will expire. This setting
46
- allows to overcome this issue.The following flow
47
- shows the algorithm in place:
48
-
49
- 1) If sync fails and :retry_limit is set to N > 0,
50
- refresh_time is not updated for next N retries (or until any of them succeeds).
51
- Here 'retry' means that user will be able to initiate another sync request
52
- (since refresh_time is not updated).
53
-
54
- 2) If one of the retry succeeds - source's refresh time is updated and retry counter is reset.
55
- 3) If the `:retry_limit` is reached and all attempts have failed -
56
- source's refresh time is updated to prevent excessive polling on the permanently down backend.
57
- 4) Also, if more then `:poll_interval` seconds has elapsed
58
- since last refresh_time - source's retry counter is reset.
59
37
 
@@ -21,10 +21,12 @@ gem 'trinidad', :platforms => :jruby
21
21
  group :development do
22
22
  # By default to run application thin web server is used
23
23
  gem 'thin', :platforms => [:ruby, :mswin, :mingw]
24
+ gem 'rhomobile-debug', ">= 1.0.2"
24
25
  end
25
26
 
26
27
  group :test do
27
28
  gem 'rack-test', '>= 0.5.3', :require => "rack/test"
28
29
  gem 'rspec', '~> 2.6.0'
29
30
  gem 'rcov', '>= 0.9.8'
31
+ gem 'rhomobile-debug', ">= 1.0.2"
30
32
  end
@@ -3,6 +3,11 @@ require 'rubygems'
3
3
  require 'bundler'
4
4
  Bundler.require
5
5
 
6
+ if ENV['DEBUG'] == 'yes'
7
+ ENV['APP_TYPE'] = 'rhosync'
8
+ require 'debugger'
9
+ end
10
+
6
11
  # Try to load vendor-ed rhoconnect, otherwise load the gem
7
12
  begin
8
13
  require 'vendor/rhoconnect/lib/rhoconnect/server'
data/install.sh CHANGED
@@ -8,6 +8,13 @@ if [ "$(id -u)" != "0" ]; then
8
8
  exit 1
9
9
  fi
10
10
 
11
+ # Check if web server is running on port 80
12
+ if [[ `echo "close" | telnet localhost 80 2>&1 | grep "Connected"` ]]; then
13
+ echo "Web server on port 80 is running."
14
+ echo "Please stop it and then re-run the installation script."
15
+ exit 1
16
+ fi
17
+
11
18
  timeInitial=`date +%H%M%S`
12
19
  installTime=$timeInitial
13
20
 
@@ -209,7 +216,7 @@ setRubyVars ()
209
216
  echo "${rubyVersion} is not a valid ruby version" | tee -a $log
210
217
  exit
211
218
  fi
212
- } #end setRubyVars
219
+ }
213
220
 
214
221
  installRuby ()
215
222
  {
@@ -347,6 +354,7 @@ fi
347
354
  callruby="sudo ${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/rhoinstaller.rb ${opts}"
348
355
  # Call the ruby script
349
356
  $callruby
357
+ rho_status=$?
350
358
 
351
359
  if [[ $installedSoftware -eq ${#INSTALL_ARRAY[@]} ]]; then
352
360
  rm "${prefix}/info.dat"
@@ -360,9 +368,12 @@ if [[ $installedSoftware -eq ${#INSTALL_ARRAY[@]} ]]; then
360
368
  mkdir $prefix"/post-install"
361
369
  fi
362
370
 
363
- opts=" -d $dist"
364
-
365
- sudo ${prefix}/bin/ruby ${INSTALL_DIR}/utils/create_texts.rb ${opts}
366
- # timeFinal=`date +%H%M%S`
367
- # getTime $timeFinal
371
+ if (( $rho_status )) ; then
372
+ echo "Installation failed. For troubleshooting see file $log ..." | tee -a $log
373
+ else
374
+ opts=" -d $dist"
375
+ sudo ${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/create_texts.rb ${opts}
376
+ fi
377
+ # timeFinal=`date +%H%M%S`
378
+ # getTime $timeFinal
368
379
  fi
@@ -546,7 +546,7 @@ def generate_rhoapp(rho_path)
546
546
  Dir.chdir "rhoapp"
547
547
  `#{rho_path}/bin/bundle install --without=test development`
548
548
  Dir.chdir "../"
549
- `chown nginx:nginx rhoapp/`
549
+ `chown -R nginx:nginx rhoapp/`
550
550
  end
551
551
  end
552
552
 
@@ -604,7 +604,7 @@ _NGINX_TO_DO_
604
604
  /sbin/service httpd start
605
605
 
606
606
  _APACHE2_TO_DO_
607
- end + "For more details see #{@prefix}/README and #{@prefix}/logs/ files."
607
+ end + "For more details see #{@prefix}/README file."
608
608
 
609
609
  end #create_texts
610
610
 
@@ -100,18 +100,17 @@ module Checkers
100
100
  # Get the HTTP_RESPONSE from the site we are checking
101
101
  begin
102
102
  res = Net::HTTP.get_response(URI.parse(url.to_s))
103
+ running = false
103
104
  # Check the response code
104
105
  if !res.code =~ /2|3\d{2}/
105
- running = false
106
106
  string << " " + red("Not Running!")
107
107
  else
108
- running = ''
108
+ running = true
109
109
  string << " " + green("Running")
110
110
  end #if
111
111
  log_print string
112
112
  rescue
113
113
  @log.error {"#{@options[:web_server]} web server not unresponsive!"}
114
- running = false
115
114
  end
116
115
 
117
116
  running
@@ -1,6 +1,6 @@
1
1
  module Constants
2
2
 
3
- PACKAGES = ["zlib1g-dev",
3
+ PACKAGES = ["zlib1g-dev",
4
4
  "libcurl4-openssl-dev",
5
5
  "apache2-mpm-prefork",
6
6
  "apache2-prefork-dev",
@@ -8,39 +8,32 @@ PACKAGES = ["zlib1g-dev",
8
8
  "libaprutil1-dev",
9
9
  "dtach"]
10
10
 
11
- #RUBYGEMS = "rubygems-1.8.5"
12
- REDIS = "redis-2.2.14"
13
- SQLITE3 = "sqlite-autoconf-3070701"
14
- RUBY = "ruby-enterprise-1.8.7-2011.03"
15
- Nginx = "nginx-1.0.6"
11
+ REDIS = "redis-2.2.14"
12
+ SQLITE3 = "sqlite-autoconf-3070701"
13
+ RUBY = "ruby-enterprise-1.8.7-2011.03"
14
+ Nginx = "nginx-1.0.6"
15
+ #RUBYGEMS = "rubygems-1.8.5"
16
16
 
17
- SOFTWARE = [ REDIS, SQLITE3, RUBY ]
17
+ SOFTWARE = [ REDIS, SQLITE3, RUBY, Nginx ]
18
18
 
19
- #RUBYGEMS_URL = "http://rubyforge.org/frs/download.php/74954/" + "#{ RUBYGEMS }.tgz"
20
- REDIS_URL = "http://redis.googlecode.com/files/#{ REDIS }.tar.gz"
21
- SQLITE3_URL = "http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz"
19
+ REDIS_URL = "http://redis.googlecode.com/files/#{ REDIS }.tar.gz"
20
+ SQLITE3_URL = "http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz"
21
+ #RUBYGEMS_URL = "http://rubyforge.org/frs/download.php/74954/" + "#{ RUBYGEMS }.tgz"
22
+ URLS = [ REDIS_URL, SQLITE3_URL ]
22
23
 
24
+ GEMS = ["bundler", "passenger"]
25
+ SUPPORTED_PKG_MGRS = ["apt-get", "yum"]
26
+ SUPPORTED_WEB_SERVERS = ["apache2", "nginx"]
23
27
 
24
- URLS = [ REDIS_URL, SQLITE3_URL ]
28
+ WEB_SERVER_URL = "http://localhost/"
25
29
 
26
- GEMS = ["bundler", "passenger"]
30
+ CHECKS = ["check_all_packages", "check_all_gems", "check_web_server_running"]
27
31
 
28
- SUPPORTED_PKG_MGRS = ["apt-get", "yum"]
32
+ DEFAULT_INSTALL_DIR = "/opt/rhoconnect"
29
33
 
30
- SUPPORTED_WEB_SERVERS = ["apache2", "nginx"]
34
+ DEFAULTS = {"Packages" => PACKAGES, "Software" => SOFTWARE, "Gems" => GEMS,
35
+ "Supported Package Managers" => SUPPORTED_PKG_MGRS,
36
+ "Supported Web Servers" => SUPPORTED_WEB_SERVERS,
37
+ "Default Install Directory" => DEFAULT_INSTALL_DIR}
31
38
 
32
- WEB_SERVER_URL = "http://localhost/"
33
-
34
- CHECKS = ["check_all_packages",
35
- "check_all_gems",
36
- "check_web_server_running"]
37
-
38
- DEFAULT_INSTALL_DIR = "/opt/rhoconnect"
39
-
40
- DEFAULTS = {"Packages" => PACKAGES,
41
- "Software" => SOFTWARE,
42
- "Gems" => GEMS,
43
- "Supported Package Managers" => SUPPORTED_PKG_MGRS,
44
- "Supported Web Servers" => SUPPORTED_WEB_SERVERS,
45
- "Default Install Directory" => DEFAULT_INSTALL_DIR}
46
- end #Constants
39
+ end
@@ -4,14 +4,14 @@ require 'rho_connect_install_checkers'
4
4
  include Checkers
5
5
 
6
6
  module Installers
7
- @options=''
8
-
9
7
  # configure_passenger
10
8
  # This method installs items that were retrieved via wget as well as passenger
11
9
  def configure_passenger(options)
10
+ raise "Please stop the web server and then reinstall the package." if check_web_server_running
11
+
12
12
  @options=options
13
13
  print_header "Configuring passenger ..."
14
- if @options[:web_server] && !check_web_server_running
14
+ if @options[:web_server]
15
15
  if @options[:web_server] == "apache2"
16
16
  print_header "Configuring apache2 to work with passenger ..."
17
17
  cmd "yes | #{@options[:prefix]}/bin/passenger-install-#{ @options[:web_server] }-module"
@@ -24,42 +24,12 @@ module Installers
24
24
  --nginx-source-dir=#{@options[:prefix]}/#{nginx_version} \
25
25
  --extra-configure-flags='--with-http_ssl_module --with-http_gzip_static_module --user=nginx --group=nginx'"
26
26
  else
27
- log_print "That web server is not yet supported. Sorry..."
28
- exit
29
- end #if
30
- end #if
27
+ raise "Unsupported web server."
28
+ end
29
+ end
30
+ raise "Nginx installation failed." if $? != 0
31
+ end
31
32
 
32
- if $? != 0
33
- log_print "Some dependencies are not installed.\nPlease install them and re-run this script..."
34
- exit
35
- end #if
36
- # FIXME:
37
- cmd "rm -rf #{@options[:prefix]}/#{nginx_version}; rm #{@options[:prefix]}/#{nginx_version}.tar.gz" if File.exist? "#{@options[:prefix]}/#{nginx_version}.tar.gz"
38
-
39
- end #configure_passenger
40
-
41
- # install_all_packages
42
- # This method installs all packages listed in the PACKAGES list defined
43
- # in the Constants file.
44
- # def install_all_packages(pkg_mgr)
45
- # print_header "Installing packages ..."
46
- # Constants::PACKAGES.each do |pkg|
47
- # install_package pkg, pkg_mgr unless check_package pkg == true
48
- # end #do
49
- # packages_not_found = check_all_packages
50
- # if packages_not_found && !packages_not_found.empty?
51
- # log_print packages_not_found
52
- # else
53
- # log_print "All packages installed correctly"
54
- # end #if
55
- # end #install_all_packages
56
-
57
- # install_package
58
- # This method installs the package passed with the determined get_cmd
59
- # def install_package(pkg, pkg_mgr)
60
- # cmd "#{ pkg_mgr } install #{ pkg }" unless check_package pkg
61
- # end #install_package
62
-
63
33
  # install_all_gems
64
34
  # This method installs all gems specified in the GEMS list defined in the
65
35
  # Constants file
@@ -73,7 +43,8 @@ module Installers
73
43
  # install_gem
74
44
  # This method installs the given gem unless it is already installed
75
45
  def install_gem(gem)
76
- cmd "#{@gem_path} install #{ gem } --no-ri --no-rdoc" unless check_gem(gem, @gem_path)
46
+ cmd "#{@gem_path} install #{gem} --no-ri --no-rdoc" unless check_gem(gem, @gem_path)
47
+ raise "#{gem} installation failed." if $? != 0
77
48
  end #install_gem
78
49
 
79
50
  # install_rubygems
@@ -90,10 +61,12 @@ module Installers
90
61
  # This method installs redis
91
62
  def install_redis
92
63
  print_header "Installing redis ..."
64
+
93
65
  Dir.chdir("#{@options[:prefix]}/#{Constants::REDIS}/src")
94
66
  cmd "make 2>&1; make PREFIX=#{@options[:prefix]} install"
95
- `mkdir #{@options[:prefix]}/etc` unless File.exist? "#{@options[:prefix]}/etc"
67
+ raise "Redis installation failed." if $? != 0
96
68
 
69
+ `mkdir #{@options[:prefix]}/etc` unless File.exist? "#{@options[:prefix]}/etc"
97
70
  #cmd "cp ../redis.conf #{@options[:prefix]}etc"
98
71
  redis_conf_file = File.new("#{@options[:prefix]}/etc/redis.conf", 'w')
99
72
  File.foreach("../redis.conf") do |line|
@@ -117,6 +90,7 @@ module Installers
117
90
  Dir.chdir("#{@options[:prefix]}/#{Constants::SQLITE3}")
118
91
  cmd "./configure --prefix=#{@options[:prefix]}"
119
92
  cmd "make 2>&1; make install"
93
+ raise "Installation if sqlite3 libraries failed." if $? != 0
120
94
  end #install_sqlite
121
95
 
122
96
  # install_rhoconnect
@@ -137,7 +111,8 @@ module Installers
137
111
  # PATH=/opt/rhoconnect/bin:$PATH rake build
138
112
  cmd "PATH=#{@options[:prefix]}/bin:$PATH rake build"
139
113
  cmd "#{@gem_path} install pkg/rhoconnect-*.gem --no-ri --no-rdoc"
114
+ raise "Gem installation failed." if $? != 0
140
115
  #`rm -f pkg/rhoconnect-*.gem`
141
- end #if
142
- end #install_rhoconnect
143
- end #Installers
116
+ end
117
+ end
118
+ end
@@ -26,6 +26,7 @@ module Utilities
26
26
  @log.info cmd unless @log == nil
27
27
  res = `#{cmd} 2>&1`
28
28
  @log.info res unless @log == nil
29
+ $?
29
30
  end #cmd
30
31
 
31
32
  #set_log_file
@@ -25,7 +25,7 @@ user = `whoami`.strip
25
25
  if user != "root"
26
26
  puts "This installation must be performed by the root user"
27
27
  exit(2)
28
- end #if
28
+ end
29
29
 
30
30
  options = {}
31
31
 
@@ -64,7 +64,7 @@ optparse = OptionParser.new do|opts|
64
64
  puts opts
65
65
  exit
66
66
  end #do
67
- end #do
67
+ end
68
68
 
69
69
  options[:start_dir] = `pwd`.strip
70
70
 
@@ -77,7 +77,7 @@ options[:log] = log
77
77
  #downcase all options hash string values
78
78
  options.each do |key, val|
79
79
  options[key] = val.downcase if val.class == String
80
- end #do
80
+ end
81
81
 
82
82
  #Start installation process
83
83
  #determine into what directory things will be installed
@@ -86,5 +86,12 @@ rho = GetParams.get_flavor(options)
86
86
  if options[:offline]
87
87
  rho.check_for_installed_software_only
88
88
  else
89
- rho.execute_installation
90
- end #if
89
+ begin
90
+ rho.execute_installation
91
+ rescue => ex
92
+ log.error "#{ex.message}"
93
+ puts
94
+ puts "#{ex.message}"
95
+ exit(1)
96
+ end
97
+ end
@@ -0,0 +1,45 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+
3
+ require 'rhoconnect/version'
4
+
5
+ module Constants
6
+
7
+ RC_VERSION = Rhoconnect::VERSION
8
+ REGION = 'us-west-1'
9
+ SLEEP = 45
10
+ HOME_DIR = `echo ~/`.strip.chomp("/")
11
+ REMOTE_HOME = '/home/ubuntu'
12
+ PEM_FILE = 'alexdevkey.pem'
13
+ SSH_KEY = "#{HOME_DIR}/.ssh/#{PEM_FILE}"
14
+ SCP_KEY = "#{HOME_DIR}/.scp/#{PEM_FILE}"
15
+ ACCESS_KEY_FILE = "#{HOME_DIR}/.ec2/credentials"
16
+ UBUNTU_STACK = { :image_id => 'ami-3d491a78',
17
+ :flavor_id => 'm1.small',
18
+ :key_name => 'alexdevkey',
19
+ :groups => 'load-test',
20
+ :user => 'ubuntu'}
21
+
22
+ CENTOS_STACK = { :image_id => 'ami-13346656',
23
+ :flavor_id => 'm1.small',
24
+ :key_name => 'alexdevkey',
25
+ :groups => 'load-test',
26
+ :user => 'root'}
27
+
28
+ STACKS = [ UBUNTU_STACK ]
29
+ # CENTOS_STACK ]
30
+
31
+ DEB_DEPS = [ "build-essential",
32
+ "zlib1g-dev",
33
+ "libssl-dev",
34
+ "libcurl4-openssl-dev",
35
+ "libreadline5-dev",
36
+ "libsqlite3-0",
37
+ "libsqlite3-dev" ]
38
+
39
+ RPM_DEPS = [ "gcc-c++",
40
+ "zlib-devel",
41
+ "curl-devel",
42
+ "pcre-devel",
43
+ "openssl-devel",
44
+ "readline-devel" ]
45
+ end #Constants
File without changes