rhoconnect 4.0.4 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +5 -13
  2. data/CHANGELOG.md +54 -5
  3. data/CREDITS +219 -219
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +68 -79
  6. data/Rakefile +1 -2
  7. data/bench/benchapp/spec/models/ruby/mock_adapter_spec.rb +17 -17
  8. data/bench/benchapp/spec/models/ruby/queue_mock_adapter_spec.rb +17 -17
  9. data/bench/benchapp/spec/spec_helper.rb +3 -3
  10. data/bench/blobapp/spec/models/ruby/blob_adapter_spec.rb +17 -17
  11. data/bench/blobapp/spec/spec_helper.rb +3 -3
  12. data/bench/lib/bench/runner.rb +1 -69
  13. data/bench/lib/bench.rb +18 -18
  14. data/bench/spec/mock_adapter_spec.rb +54 -55
  15. data/bench/spec/mock_client_spec.rb +47 -48
  16. data/bench/spec/result_spec.rb +41 -44
  17. data/bench/spec/utils_spec.rb +24 -25
  18. data/commands/generators/app.rb +7 -5
  19. data/commands/generators/controller.rb +7 -5
  20. data/commands/generators/model.rb +7 -5
  21. data/commands/generators/source.rb +7 -5
  22. data/commands/parser.rb +1 -1
  23. data/commands/redis/redis_download.rb +1 -1
  24. data/doc/async-jobs.txt +9 -9
  25. data/doc/supported-platforms.txt +0 -2
  26. data/generators/rhoconnect.rb +92 -212
  27. data/generators/templates/application/rcgemfile +3 -3
  28. data/generators/templates/application/spec/application_controller_spec.rb +14 -16
  29. data/generators/templates/application/spec/js_spec.rb +20 -20
  30. data/generators/templates/application/spec/spec_helper.rb +1 -1
  31. data/generators/templates/source/controllers/ruby/controller_spec.rb +18 -19
  32. data/generators/templates/source/models/ruby/model_spec.rb +17 -17
  33. data/install.sh +10 -21
  34. data/installer/unix-like/rho_connect_install_constants.rb +5 -5
  35. data/installer/unix-like/rho_connect_install_installers.rb +4 -4
  36. data/installer/utils/constants.rb +6 -6
  37. data/installer/utils/nix_install_test.rb +29 -29
  38. data/installer/utils/package_upload/repos.rake +16 -26
  39. data/js-adapters/node.rb +4 -4
  40. data/js-adapters/node_channel.rb +4 -8
  41. data/lib/rhoconnect/db_adapter.rb +13 -13
  42. data/lib/rhoconnect/handler/changes/engine.rb +1 -1
  43. data/lib/rhoconnect/jobs/bulk_data_job.rb +29 -29
  44. data/lib/rhoconnect/license.rb +7 -7
  45. data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +13 -13
  46. data/lib/rhoconnect/ping/apple.rb +4 -4
  47. data/lib/rhoconnect/server.rb +2 -2
  48. data/lib/rhoconnect/source.rb +2 -2
  49. data/lib/rhoconnect/store.rb +12 -6
  50. data/lib/rhoconnect/utilities.rb +2 -2
  51. data/lib/rhoconnect/version.rb +1 -1
  52. data/lib/rhoconnect.rb +6 -4
  53. data/rhoconnect.gemspec +5 -6
  54. data/spec/api/api_helper.rb +1 -1
  55. data/spec/api/app/fast_delete_spec.rb +22 -22
  56. data/spec/api/app/fast_insert_spec.rb +23 -23
  57. data/spec/api/app/fast_update_spec.rb +63 -63
  58. data/spec/api/app/push_deletes_spec.rb +11 -13
  59. data/spec/api/app/push_objects_spec.rb +39 -39
  60. data/spec/api/client/client_get_db_doc_spec.rb +29 -29
  61. data/spec/api/client/client_set_db_doc_spec.rb +11 -11
  62. data/spec/api/client/get_client_params_spec.rb +29 -29
  63. data/spec/api/client/list_client_docs_spec.rb +32 -34
  64. data/spec/api/client/reset_spec.rb +30 -30
  65. data/spec/api/readstate/set_refresh_time_spec.rb +43 -43
  66. data/spec/api/source/get_source_params_spec.rb +32 -34
  67. data/spec/api/source/list_sources_spec.rb +13 -13
  68. data/spec/api/source/update_source_params_spec.rb +19 -19
  69. data/spec/api/store/get_db_doc_spec.rb +27 -27
  70. data/spec/api/store/set_db_doc_spec.rb +38 -38
  71. data/spec/api/system/adapter_spec.rb +27 -29
  72. data/spec/api/system/get_license_info_spec.rb +11 -11
  73. data/spec/api/system/login_spec.rb +37 -37
  74. data/spec/api/system/reset_spec.rb +15 -15
  75. data/spec/api/system/stats_spec.rb +70 -71
  76. data/spec/api/user/create_user_spec.rb +37 -37
  77. data/spec/api/user/delete_client_spec.rb +7 -7
  78. data/spec/api/user/delete_user_spec.rb +62 -62
  79. data/spec/api/user/list_clients_spec.rb +24 -24
  80. data/spec/api/user/list_source_docs_spec.rb +29 -29
  81. data/spec/api/user/list_users_spec.rb +22 -22
  82. data/spec/api/user/ping_spec.rb +18 -18
  83. data/spec/api/user/show_user_spec.rb +10 -10
  84. data/spec/api/user/update_user_spec.rb +43 -43
  85. data/spec/api/user/user_get_db_doc_spec.rb +12 -12
  86. data/spec/api/user/user_set_db_doc_spec.rb +37 -37
  87. data/spec/api_token_spec.rb +8 -8
  88. data/spec/app_spec.rb +18 -17
  89. data/spec/apps/jstestapp/settings/settings.yml +2 -0
  90. data/spec/async_spec.rb +9 -11
  91. data/spec/bulk_data/bulk_data_spec.rb +120 -120
  92. data/spec/cli/cli_spec.rb +50 -53
  93. data/spec/client_spec.rb +105 -105
  94. data/spec/client_sync_spec.rb +529 -528
  95. data/spec/controllers/js_base_spec.rb +147 -141
  96. data/spec/doc/doc_spec.rb +51 -52
  97. data/spec/document_spec.rb +58 -58
  98. data/spec/dynamic_adapter_spec.rb +33 -36
  99. data/spec/generator/generator_spec.rb +76 -42
  100. data/spec/jobs/bulk_data_job_spec.rb +101 -102
  101. data/spec/jobs/ping_job_spec.rb +176 -177
  102. data/spec/jobs/source_job_spec.rb +24 -25
  103. data/spec/license_spec.rb +54 -55
  104. data/spec/models/js_base_spec.rb +121 -120
  105. data/spec/perf/bulk_data_perf_spec.rb +23 -24
  106. data/spec/perf/perf_spec_helper.rb +7 -7
  107. data/spec/perf/store_perf_spec.rb +139 -140
  108. data/spec/ping/apple_spec.rb +65 -65
  109. data/spec/ping/gcm_spec.rb +83 -84
  110. data/spec/ping/rhoconnect_push_spec.rb +52 -53
  111. data/spec/predefined_adapters/rho_internal_bench_adapter_controller_js_spec.rb +100 -101
  112. data/spec/predefined_adapters/rho_internal_js_bench_adapter_js_spec.rb +29 -31
  113. data/spec/read_state_spec.rb +24 -25
  114. data/spec/rhoconnect_spec.rb +7 -7
  115. data/spec/server/server_spec.rb +664 -662
  116. data/spec/server/stats_spec.rb +12 -12
  117. data/spec/source_adapter_spec.rb +124 -125
  118. data/spec/source_spec.rb +148 -149
  119. data/spec/source_sync_spec.rb +736 -736
  120. data/spec/spec_helper.rb +4 -5
  121. data/spec/stats/record_spec.rb +22 -21
  122. data/spec/store_orm_spec.rb +48 -48
  123. data/spec/store_spec.rb +428 -426
  124. data/spec/support/shared_examples.rb +5 -7
  125. data/spec/sync_states_spec.rb +67 -67
  126. data/spec/test_methods_spec.rb +121 -123
  127. data/spec/testdata/10000-data.txt +0 -0
  128. data/spec/testdata/5000-data.txt +0 -0
  129. data/spec/user_spec.rb +102 -102
  130. data/tasks/redis.rake +3 -3
  131. metadata +154 -195
  132. data/bench/benchapp/tmp/pids/passenger.9292.pid.lock +0 -0
  133. data/bench/benchapp/tmp/restart.txt +0 -0
  134. data/bench/blobapp/settings/license.key.bak +0 -2
  135. data/bench/blobapp/tmp/restart.txt +0 -0
  136. data/bench/lib/testdata/1-data.txt +0 -0
  137. data/bench/lib/testdata/10-data.txt +0 -0
  138. data/bench/lib/testdata/2-data.txt +0 -0
  139. data/bench/lib/testdata/250-data.txt +0 -0
  140. data/bench/lib/testdata/5-blob_data.txt +0 -0
  141. data/bench/lib/testdata/5-data.txt +0 -0
  142. data/bench/lib/testdata/50-data.txt +0 -0
  143. data/bench/lib/testdata/500-data.txt +0 -0
  144. data/doc/protocol.html +0 -1993
  145. data/spec/coverage/rcov/assets/0.2.3/jquery-1.3.2.min.js +0 -19
  146. data/spec/coverage/rcov/assets/0.2.3/jquery.tablesorter.min.js +0 -15
  147. data/spec/coverage/rcov/assets/0.2.3/print.css +0 -12
  148. data/spec/coverage/rcov/assets/0.2.3/rcov.js +0 -42
  149. data/spec/coverage/rcov/assets/0.2.3/screen.css +0 -270
  150. data/spec/coverage/rcov/index.html +0 -88
  151. data/spec/generator/generator_spec_helper.rb +0 -9
@@ -1,272 +1,152 @@
1
- require 'rubygems'
2
- require 'templater'
1
+ require 'thor'
2
+ require 'thor/group'
3
3
 
4
4
  module Rhoconnect
5
- extend Templater::Manifold
6
- extend Rhoconnect
7
5
 
8
- desc <<-DESC
9
- Rhoconnect generator
10
- DESC
6
+ class AppGenerator < Thor::Group
7
+ namespace :app_generator
8
+ include Thor::Actions
11
9
 
12
- class BaseGenerator < Templater::Generator
13
- def class_name
14
- name.gsub('-', '_').camel_case
15
- end
16
-
17
- def underscore_name
18
- Rhoconnect.under_score(name)
19
- end
20
-
21
- def gem_version
22
- VERSION
23
- end
24
-
25
- # Callback method to run ERB on destination file
26
- def run_erb(action)
27
- template = ERB.new(File.read(action.destination))
28
- File.open(action.destination, "w") { |f| f << template.result(binding) }
29
- end
30
-
31
- def self.install_js_option(klass)
32
- klass.option :js, :required => false, :default => false, :desc => "generate JavaScript code", :as => :boolean
33
- end
34
-
35
- def self.install_app_options(klass)
36
- klass.first_argument :name, :required => true, :desc => "application name"
37
- install_js_option(klass)
38
- end
39
-
40
- def self.install_source_options(klass)
41
- klass.first_argument :name, :required => true, :desc => "source name"
42
- install_js_option(klass)
43
- end
44
-
45
- alias_method :module_name, :class_name
46
- end
10
+ argument :name
11
+ class_options :js => false
12
+ source_root File.join(File.dirname(__FILE__), 'templates', 'application')
47
13
 
48
- class AppGenerator < BaseGenerator
49
- install_app_options(self)
14
+ def gem_version; VERSION; end
50
15
 
51
- def self.source_root
52
- File.join(File.dirname(__FILE__), 'templates', 'application')
53
- end
54
-
55
- desc <<-DESC
56
- Generates a new rhoconnect application.
57
-
58
- Required:
59
- name - application name
60
- DESC
61
-
62
- # 'template' does not work under jruby. Using 'file' and after hook instead
63
- file :configru, :after => :run_erb do |template|
64
- require 'securerandom' rescue nil
16
+ def copy_files
65
17
  @secret = SecureRandom.hex(64) rescue '<changeme>'
66
- template.source = 'config.ru'
67
- template.destination = "#{name}/config.ru"
68
- end
18
+ template("config.ru", "#{name}/config.ru")
19
+ template("Gemfile", "#{name}/Gemfile")
69
20
 
70
- template :gitignore do |template|
71
- template.source = 'gitignore'
72
- template.destination = "#{name}/.gitignore"
73
- end
21
+ copy_file "gitignore", "#{name}/.gitignore"
22
+ copy_file 'rcgemfile', "#{name}/.rcgemfile"
23
+ copy_file 'Rakefile', "#{name}/Rakefile"
24
+ copy_file 'settings/settings.yml', "#{name}/settings/settings.yml"
25
+ copy_file 'settings/license.key', "#{name}/settings/license.key"
26
+ empty_directory File.join("#{name}", 'public')
74
27
 
75
- template :settings do |template|
76
- template.source = 'settings/settings.yml'
77
- template.destination = "#{name}/settings/settings.yml"
78
- end
28
+ if options[:js]
29
+ copy_file 'controllers/js/application_controller.js', "#{name}/controllers/js/application_controller.js"
30
+ # TODO: spec files for js app ...
79
31
 
80
- template :license do |template|
81
- template.source = 'settings/license.key'
82
- template.destination = "#{name}/settings/license.key"
83
- end
32
+ npm_install_note = <<_NPM_INSTALL_
84
33
 
85
- template :rakefile do |template|
86
- template.source = 'Rakefile'
87
- template.destination = "#{name}/Rakefile"
88
- end
89
-
90
- # 'template' does not work under jruby. Using 'file' and after hook instead
91
- file :gemfile, :after => :run_erb do |file|
92
- file.source = 'Gemfile'
93
- file.destination = "#{name}/Gemfile"
94
- end
34
+ In the future, to ensure that all the JavaScript dependencies in your
35
+ rhoconnect application are available execute these commands:
36
+ cd #{name} && npm install
95
37
 
96
- template :gemfile_app do |template|
97
- template.source = 'rcgemfile'
98
- template.destination = "#{name}/.rcgemfile"
99
- end
38
+ _NPM_INSTALL_
100
39
 
101
- empty_directory :public do |dir|
102
- dir.destination = File.join("#{name}", 'public')
40
+ copy_file 'package.json', "#{name}/package.json"
41
+ say npm_install_note, :bold
42
+ Dir.chdir(name) { system("npm install") }
43
+ # NB: The following does not work with JRuby (1.7.7)
44
+ # system("npm install", :chdir => name)
45
+ else # Ruby app ...
46
+ copy_file 'controllers/ruby/application_controller.rb', "#{name}/controllers/ruby/application_controller.rb"
47
+ copy_file 'spec/application_controller_spec.rb', "#{name}/spec/controllers/ruby/application_controller_spec.rb"
48
+ copy_file 'spec/spec_helper.rb', "#{name}/spec/spec_helper.rb"
49
+ end
103
50
  end
104
51
 
105
- invoke :js_app, :js => true
106
- invoke :ruby_app, :js => false
107
-
108
52
  def after_run
109
53
  install_gems_note = <<_BUNDLE_INSTALL_
110
54
 
111
55
  In the future, to ensure that all the dependencies in your rhoconnect application
112
56
  are available execute these commands:
113
- cd #{name} && bundle install
57
+ cd #{name} && bundle install
114
58
 
115
59
  If you're setting up the application in a production environment run the following:
116
- cd #{name} && bundle install --without=test development
60
+ cd #{name} && bundle install --without=test development
117
61
 
118
62
  _BUNDLE_INSTALL_
119
63
 
120
64
  running_bundler_first_time = <<_RUN_BUNDLER
121
65
 
122
66
  Executing 'bundle install' for the first time in your freshly baked application!
123
- bundle install --gemfile=#{destination_root}/#{name}/Gemfile
67
+ bundle install --gemfile=#{destination_root}/#{name}/Gemfile
124
68
 
125
69
  _RUN_BUNDLER
126
70
 
127
71
  gem_name, gem_ver_reqs = 'rhoconnect', gem_version
128
72
  found_gspec = Gem::Specification.find_by_name(gem_name, gem_ver_reqs)
129
73
  if found_gspec
130
- puts running_bundler_first_time
74
+ say running_bundler_first_time, :bold
131
75
  system("bundle install --gemfile=#{destination_root}/#{name}/Gemfile")
132
- puts install_gems_note
76
+ say install_gems_note, :bold
133
77
  end
134
- rescue Exception => e
135
- warning_msg = "\n" +
136
- "*** Warning: Generatior failed to run bundler. ***\n" +
137
- "*** Install required version of rhoconnect gem, or explicitly ***\n" +
78
+ rescue Exception => e
79
+ warning_msg = "\n" +
80
+ "*** Warning: Generatior failed to run bundler. ***\n" +
81
+ "*** Install required version of rhoconnect gem, or explicitly ***\n" +
138
82
  "*** define in Gemfile the source to the gem using :path option. ***\n" +
139
83
  "\n"
140
- puts warning_msg
84
+ say warning_msg, :red
141
85
  end
142
86
  end
143
87
 
144
- class RubyAppGenerator < AppGenerator
145
- install_app_options(self)
88
+ class BaseSourceGenerator < Thor::Group
89
+ include Thor::Actions
146
90
 
147
- template :application do |template|
148
- template.source = 'controllers/ruby/application_controller.rb'
149
- template.destination = "#{name}/controllers/ruby/application_controller.rb"
150
- end
151
-
152
- template :application_spec do |template|
153
- template.source = 'spec/application_controller_spec.rb'
154
- template.destination = "#{name}/spec/controllers/ruby/application_controller_spec.rb"
155
- end
156
-
157
- template :spec_helper do |template|
158
- template.source = 'spec/spec_helper.rb'
159
- template.destination = "#{name}/spec/spec_helper.rb"
160
- end
161
- end
162
-
163
- class JsAppGenerator < AppGenerator
164
- install_app_options(self)
165
-
166
- file :packagejson, :after => :npm_install do |template|
167
- template.source = 'package.json'
168
- template.destination = "#{name}/package.json"
169
- end
91
+ argument :name
92
+ class_options :js => false
170
93
 
171
- template :application do |template|
172
- template.source = 'controllers/js/application_controller.js'
173
- template.destination = "#{name}/controllers/js/application_controller.js"
174
- end
175
-
176
- def npm_install(action)
177
- npm_install_note = <<_NPM_INSTALL_
178
-
179
- In the future, to ensure that all the JavaScript dependencies in your
180
- rhoconnect application are available execute these commands:
181
- cd #{name} && npm install
182
-
183
- _NPM_INSTALL_
184
- puts npm_install_note
185
- Dir.chdir(name) { system("npm install") }
94
+ def class_name
95
+ Thor::Util.camel_case(name.gsub('-', '_'))
186
96
  end
187
- end
188
-
189
- class SourceGenerator < BaseGenerator
190
- install_source_options(self)
191
97
 
192
- def self.source_root
193
- File.join(File.dirname(__FILE__), 'templates', 'source')
98
+ def underscore_name
99
+ Thor::Util.snake_case(name)
194
100
  end
195
-
196
- desc <<-DESC
197
- Generates a new source adapter (Controller/Model pair).
198
-
199
- Required:
200
- name - source name (i.e. product)
201
- DESC
202
-
203
- invoke :ruby_source, :js => false
204
- invoke :js_source, :js => true
205
101
  end
206
102
 
207
- class RubySourceGenerator < SourceGenerator
208
- install_source_options(self)
209
-
210
- # 'template' does not work under jruby. Using 'file' and after hook instead
211
- file :model, :after => :run_erb do |file|
212
- file.source = 'models/ruby/model.rb'
213
- file.destination = "models/ruby/#{underscore_name}.rb"
214
- settings_file = File.join(@destination_root,'settings','settings.yml')
215
- settings = YAML.load_file(settings_file)
216
- settings[:sources] ||= {}
217
- settings[:sources][class_name] = {:poll_interval => 300}
218
- File.open(settings_file, 'w' ) do |f|
219
- f.write "#Sources" + {:sources => settings[:sources]}.to_yaml[3..-1]
220
- envs = {}
221
- [:development,:test,:production].each do |env|
222
- envs[env] = settings[env]
103
+ class ModelGenerator < BaseSourceGenerator
104
+ namespace :model_generator
105
+ source_root File.join(File.dirname(__FILE__), 'templates', 'source')
106
+
107
+ def create_model_and_specs
108
+ if options[:js]
109
+ template('models/js/model.js', "models/js/#{underscore_name}.js")
110
+ else
111
+ template('models/ruby/model.rb', "models/ruby/#{underscore_name}.rb")
112
+ template('models/ruby/model_spec.rb', "spec/models/ruby/#{underscore_name}_spec.rb")
113
+ # Edit settings.yml file
114
+ settings_file = File.join(destination_root,'settings','settings.yml')
115
+ settings = YAML.load_file(settings_file)
116
+ settings[:sources] ||= {}
117
+ settings[:sources][class_name] = {:poll_interval => 300}
118
+ File.open(settings_file, 'w' ) do |f|
119
+ f.write "#Sources" + {:sources => settings[:sources]}.to_yaml[3..-1]
120
+ envs = {}
121
+ [:development,:test,:production].each { |env| envs[env] = settings[env] }
122
+ f.write envs.to_yaml[3..-1]
123
+ # write all other settings
124
+ [:development, :test, :production, :sources].each { |key| settings.delete(key) }
125
+ f.write settings.to_yaml[3..-1] unless settings.empty?
223
126
  end
224
- f.write envs.to_yaml[3..-1]
225
- # write all other settings
226
- [:development, :test, :production, :sources].each do |key|
227
- settings.delete(key)
228
- end
229
- f.write settings.to_yaml[3..-1] unless settings.empty?
230
127
  end
231
128
  end
129
+ end
232
130
 
233
- file :controller, :after => :run_erb do |file|
234
- file.source = 'controllers/ruby/controller.rb'
235
- file.destination = "controllers/ruby/#{underscore_name}_controller.rb"
236
- end
237
-
238
- # 'template' does not work under jruby. Using 'file' and after hook instead
239
- file :model_spec, :after => :run_erb do |file|
240
- file.source = 'models/ruby/model_spec.rb'
241
- file.destination = "spec/models/ruby/#{underscore_name}_spec.rb"
242
- end
131
+ class ControllerGenerator < BaseSourceGenerator
132
+ namespace :controller_generator
133
+ source_root File.join(File.dirname(__FILE__), 'templates', 'source')
243
134
 
244
- # 'template' does not work under jruby. Using 'file' and after hook instead
245
- file :controller_spec, :after => :run_erb do |file|
246
- file.source = 'controllers/ruby/controller_spec.rb'
247
- file.destination = "spec/controllers/ruby/#{underscore_name}_controller_spec.rb"
135
+ def create_controller_and_specs
136
+ if options[:js]
137
+ template('controllers/js/controller.js', "controllers/js/#{underscore_name}_controller.js")
138
+ else
139
+ template('controllers/ruby/controller.rb', "controllers/ruby/#{underscore_name}_controller.rb")
140
+ template('controllers/ruby/controller_spec.rb', "spec/controllers/ruby/#{underscore_name}_controller_spec.rb")
141
+ end
248
142
  end
249
143
  end
250
144
 
251
- class JsSourceGenerator < SourceGenerator
252
- install_source_options(self)
145
+ class SourceGenerator < BaseSourceGenerator
146
+ namespace :source_generator
253
147
 
254
- file :model, :after => :run_erb do |file|
255
- file.source = 'models/js/model.js'
256
- file.destination = "models/js/#{underscore_name}.js"
257
- end
258
-
259
- file :controller, :after => :run_erb do |file|
260
- file.source = 'controllers/js/controller.js'
261
- file.destination = "controllers/js/#{underscore_name}_controller.js"
262
- end
148
+ invoke :controller_generator
149
+ invoke :model_generator
263
150
  end
264
151
 
265
- add :app, AppGenerator
266
- add_private :ruby_app, RubyAppGenerator
267
- add_private :js_app, JsAppGenerator
268
-
269
- add :source, SourceGenerator
270
- add_private :ruby_source, RubySourceGenerator
271
- add_private :js_source, JsSourceGenerator
272
152
  end
@@ -6,7 +6,7 @@ gem 'win32-process', '= 0.6.6', :platforms => [:mswin, :mingw]
6
6
 
7
7
  # use thin and eventmachine everywhere except JRuby
8
8
  platforms :ruby, :mingw do
9
- gem "eventmachine", "~> 1.0.0"
9
+ gem "eventmachine", "~> 1.0.5"
10
10
  # using thin by default
11
11
  gem 'thin'
12
12
  # for async framework
@@ -31,7 +31,7 @@ group :development do
31
31
  end
32
32
 
33
33
  group :test do
34
- gem 'rspec', '~> 2.10.0'
35
- gem 'rack-test', '>= 0.5.3', :require => "rack/test"
34
+ gem 'rspec', '~> 2.14'
35
+ gem 'rack-test', '~> 0.6', :require => "rack/test"
36
36
  gem 'rhomobile-debug', ">= 1.0.2"
37
37
  end
@@ -1,23 +1,21 @@
1
1
  require File.join(File.dirname(__FILE__),'..','..','spec_helper')
2
2
 
3
3
  describe "ApplicationController" do
4
- it_should_behave_like "SpecHelper" do
5
- include Rack::Test::Methods
6
- include Rhoconnect
4
+ include_examples "SpecHelper"
5
+ include Rack::Test::Methods
6
+ include Rhoconnect
7
7
 
8
- def app
9
- @app = Rack::URLMap.new Rhoconnect.url_map
10
- end
8
+ def app
9
+ @app = Rack::URLMap.new Rhoconnect.url_map
10
+ end
11
11
 
12
- it "should process ApplicationController /login" do
13
- post "/rc/#{Rhoconnect::API_VERSION}/app/login", {"login" => 'testuser', "password" => ''}.to_json,
14
- {'CONTENT_TYPE'=>'application/json; charset=UTF-8'}
15
- last_response.status.should == 200
16
- end
12
+ it "should process ApplicationController /login" do
13
+ post "/rc/#{Rhoconnect::API_VERSION}/app/login", {"login" => 'testuser', "password" => ''}.to_json,
14
+ {'CONTENT_TYPE'=>'application/json; charset=UTF-8'}
15
+ last_response.status.should == 200
16
+ end
17
17
 
18
- it "should process ApplicationController /rps_login" do
19
- pending
20
- end
21
-
22
- end
18
+ it "should process ApplicationController /rps_login" do
19
+ pending
20
+ end
23
21
  end
@@ -1,25 +1,25 @@
1
1
  require File.join(File.dirname(__FILE__),'..','spec_helper')
2
2
 
3
3
  describe "<%=class_name%>", :type => :feature do
4
- it_should_behave_like "SpecHelper" do
5
- before :each do
6
- setup_test_for '<%=class_name%>','testuser'
7
- end
8
-
9
- it "queries <%=class_name%>" do
10
-
11
- end
12
-
13
- it "creates <%=class_name%>" do
14
-
15
- end
16
-
17
- it "updates <%=class_name%>" do
18
-
19
- end
20
-
21
- it "deletes <%=class_name%>" do
22
-
23
- end
4
+ include_examples "SpecHelper"
5
+
6
+ before :each do
7
+ setup_test_for '<%=class_name%>','testuser'
8
+ end
9
+
10
+ it "queries <%=class_name%>" do
11
+
12
+ end
13
+
14
+ it "creates <%=class_name%>" do
15
+
16
+ end
17
+
18
+ it "updates <%=class_name%>" do
19
+
20
+ end
21
+
22
+ it "deletes <%=class_name%>" do
23
+
24
24
  end
25
25
  end
@@ -17,7 +17,7 @@ include Rhoconnect
17
17
  require 'rhoconnect/application/init'
18
18
  require 'rhoconnect/test_methods'
19
19
 
20
- shared_examples_for "SpecHelper" do
20
+ shared_examples "SpecHelper" do
21
21
  include Rhoconnect::TestMethods
22
22
 
23
23
  before(:each) do
@@ -1,27 +1,26 @@
1
1
  require File.join(File.dirname(__FILE__),'..','..','spec_helper')
2
2
 
3
3
  describe "<%=class_name%>Controller" do
4
- it_should_behave_like "SpecHelper" do
5
- include Rack::Test::Methods
6
- include Rhoconnect
4
+ include_examples "SpecHelper"
5
+ include Rack::Test::Methods
6
+ include Rhoconnect
7
7
 
8
- def app
9
- @app = Rack::URLMap.new Rhoconnect.url_map
10
- end
8
+ def app
9
+ @app = Rack::URLMap.new Rhoconnect.url_map
10
+ end
11
11
 
12
- before(:each) do
13
- setup_test_for <%=class_name%>,'testuser'
14
- # login user to establish session cookie before each test
15
- post "/rc/#{Rhoconnect::API_VERSION}/app/login", {"login" => 'testuser', "password" => ''}.to_json, {'CONTENT_TYPE'=>'application/json; charset=UTF-8'}
16
- last_response.status.should == 200
17
- end
12
+ before(:each) do
13
+ setup_test_for <%=class_name%>,'testuser'
14
+ # login user to establish session cookie before each test
15
+ post "/rc/#{Rhoconnect::API_VERSION}/app/login", {"login" => 'testuser', "password" => ''}.to_json, {'CONTENT_TYPE'=>'application/json; charset=UTF-8'}
16
+ last_response.status.should == 200
17
+ end
18
18
 
19
- it "should process <%=class_name%>Controller GET" do
20
- pending
21
- end
19
+ it "should process <%=class_name%>Controller GET" do
20
+ pending
21
+ end
22
22
 
23
- it "should process <%=class_name%>Controller POST" do
24
- pending
25
- end
26
- end
23
+ it "should process <%=class_name%>Controller POST" do
24
+ pending
25
+ end
27
26
  end
@@ -1,25 +1,25 @@
1
1
  require File.join(File.dirname(__FILE__),'..','..','spec_helper')
2
2
 
3
3
  describe "<%=class_name%>" do
4
- it_should_behave_like "SpecHelper" do
5
- before(:each) do
6
- setup_test_for <%=class_name%>,'testuser'
7
- end
4
+ include_examples "SpecHelper"
8
5
 
9
- it "should process <%=class_name%> query" do
10
- pending
11
- end
6
+ before(:each) do
7
+ setup_test_for <%=class_name%>,'testuser'
8
+ end
12
9
 
13
- it "should process <%=class_name%> create" do
14
- pending
15
- end
10
+ it "should process <%=class_name%> query" do
11
+ pending
12
+ end
16
13
 
17
- it "should process <%=class_name%> update" do
18
- pending
19
- end
14
+ it "should process <%=class_name%> create" do
15
+ pending
16
+ end
20
17
 
21
- it "should process <%=class_name%> delete" do
22
- pending
23
- end
24
- end
18
+ it "should process <%=class_name%> update" do
19
+ pending
20
+ end
21
+
22
+ it "should process <%=class_name%> delete" do
23
+ pending
24
+ end
25
25
  end
data/install.sh CHANGED
@@ -51,7 +51,7 @@ checkDeps ()
51
51
  determinePkgMgr ()
52
52
  {
53
53
  if [[ `which apt-get 2> /dev/null` != "" ]]; then
54
- pkgMgr="apt-get -y"
54
+ pkgMgr="apt-get --force-yes -y"
55
55
  dist='debian'
56
56
  elif [[ `which yum 2> /dev/null` != "" ]]; then
57
57
  pkgMgr="yum -y"
@@ -167,23 +167,12 @@ setDefaults ()
167
167
 
168
168
  setRubyVars ()
169
169
  {
170
- if [[ $rubyVersion == "" || $rubyVersion =~ ruby'ee'|'enterprise' ]]; then
171
- rubyVersion=${RUBY_VERSION}
172
- rubyDir=${RUBY_VERSION}
173
- rubyTar="${rubyDir}.tar.gz"
174
- rubyURL="http://ftp.ruby-lang.org/pub/ruby/1.9/${rubyTar}"
175
- elif [$rubyVersion == "ruby187"]; then
176
- rubyDir="ruby-1.8.7"
177
- rubyTar="${rubyDir}.tar.gz"
178
- rubyURL="ftp://ftp.ruby-lang.org/pub/ruby/1.8/${rubyTar}"
179
- elif [$rubyVersion == "ruby192"]; then
180
- rubyDir="ruby-1.9.2-p180"
181
- rubyTar="${rubyDir}.tar.gz"
182
- rubyURL="http://ftp.ruby-lang.org/pub/ruby/1.9/${rubyTar}"
183
- else
184
- echo "${rubyVersion} is not a valid ruby version" | tee -a $log
185
- exit 1
186
- fi
170
+ # RUBY_VERSION="ruby-2.2.1"
171
+ rubyVersion=${RUBY_VERSION}
172
+ rubyDir=${RUBY_VERSION}
173
+ rubyTar="${rubyDir}.tar.gz"
174
+ # http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.gz
175
+ rubyURL="http://cache.ruby-lang.org/pub/ruby/2.2/${rubyTar}"
187
176
  }
188
177
 
189
178
  installRuby ()
@@ -263,10 +252,10 @@ rubyVersion=""
263
252
  rubyBinDir=""
264
253
 
265
254
  # Define ruby and nodejs versions to be installed ...
266
- RUBY_PATCH="p484"
267
- RUBY_VERSION="ruby-1.9.3-${RUBY_PATCH}"
255
+ RUBY_PATCH="p85"
256
+ RUBY_VERSION="ruby-2.2.1"
268
257
 
269
- NODE_VERSION=v0.10.22
258
+ NODE_VERSION=v0.10.33
270
259
  NODE_URL=http://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}.tar.gz
271
260
  ARCH=$([[ `uname -m` == x86_64 ]] && echo "x64" || echo "x86")
272
261
  NODE_BIN_URL=http://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${ARCH}.tar.gz
@@ -8,16 +8,16 @@ module Constants
8
8
  "libaprutil1-dev",
9
9
  "dtach"]
10
10
 
11
- RUBY = "ruby-1.9.3-p484"
12
- REDIS = "redis-2.6.16"
13
- SQLITE3 = "sqlite-autoconf-3071502"
14
- NGINX = "nginx-1.4.4"
11
+ RUBY = "ruby-2.2.1"
12
+ REDIS = "redis-2.8.17"
13
+ SQLITE3 = "sqlite-autoconf-3080704"
14
+ NGINX = "nginx-1.6.2"
15
15
  PASSENGER_ROOT = "/opt/rhoconnect/lib/ruby/gems/1.9.1/gems/passenger"
16
16
 
17
17
  SOFTWARE = [ REDIS, SQLITE3, RUBY, NGINX ]
18
18
 
19
19
  REDIS_URL = "http://download.redis.io/releases/#{REDIS}.tar.gz"
20
- SQLITE3_URL = "http://www.sqlite.org/#{SQLITE3}.tar.gz"
20
+ SQLITE3_URL = "http://www.sqlite.org/2014/#{SQLITE3}.tar.gz"
21
21
  NGINX_URL = "http://nginx.org/download/#{NGINX}.tar.gz"
22
22
  URLS = [ REDIS_URL, SQLITE3_URL, NGINX_URL]
23
23
  GEMS = ["bundler"] # foreman"