rhoconnect 4.0.4 → 5.1.1
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.
- checksums.yaml +5 -13
- data/CHANGELOG.md +54 -5
- data/CREDITS +219 -219
- data/Gemfile +2 -2
- data/Gemfile.lock +68 -79
- data/Rakefile +1 -2
- data/bench/benchapp/spec/models/ruby/mock_adapter_spec.rb +17 -17
- data/bench/benchapp/spec/models/ruby/queue_mock_adapter_spec.rb +17 -17
- data/bench/benchapp/spec/spec_helper.rb +3 -3
- data/bench/blobapp/spec/models/ruby/blob_adapter_spec.rb +17 -17
- data/bench/blobapp/spec/spec_helper.rb +3 -3
- data/bench/lib/bench/runner.rb +1 -69
- data/bench/lib/bench.rb +18 -18
- data/bench/spec/mock_adapter_spec.rb +54 -55
- data/bench/spec/mock_client_spec.rb +47 -48
- data/bench/spec/result_spec.rb +41 -44
- data/bench/spec/utils_spec.rb +24 -25
- data/commands/generators/app.rb +7 -5
- data/commands/generators/controller.rb +7 -5
- data/commands/generators/model.rb +7 -5
- data/commands/generators/source.rb +7 -5
- data/commands/parser.rb +1 -1
- data/commands/redis/redis_download.rb +1 -1
- data/doc/async-jobs.txt +9 -9
- data/doc/supported-platforms.txt +0 -2
- data/generators/rhoconnect.rb +92 -212
- data/generators/templates/application/rcgemfile +3 -3
- data/generators/templates/application/spec/application_controller_spec.rb +14 -16
- data/generators/templates/application/spec/js_spec.rb +20 -20
- data/generators/templates/application/spec/spec_helper.rb +1 -1
- data/generators/templates/source/controllers/ruby/controller_spec.rb +18 -19
- data/generators/templates/source/models/ruby/model_spec.rb +17 -17
- data/install.sh +10 -21
- data/installer/unix-like/rho_connect_install_constants.rb +5 -5
- data/installer/unix-like/rho_connect_install_installers.rb +4 -4
- data/installer/utils/constants.rb +6 -6
- data/installer/utils/nix_install_test.rb +29 -29
- data/installer/utils/package_upload/repos.rake +16 -26
- data/js-adapters/node.rb +4 -4
- data/js-adapters/node_channel.rb +4 -8
- data/lib/rhoconnect/db_adapter.rb +13 -13
- data/lib/rhoconnect/handler/changes/engine.rb +1 -1
- data/lib/rhoconnect/jobs/bulk_data_job.rb +29 -29
- data/lib/rhoconnect/license.rb +7 -7
- data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +13 -13
- data/lib/rhoconnect/ping/apple.rb +4 -4
- data/lib/rhoconnect/server.rb +2 -2
- data/lib/rhoconnect/source.rb +2 -2
- data/lib/rhoconnect/store.rb +12 -6
- data/lib/rhoconnect/utilities.rb +2 -2
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect.rb +6 -4
- data/rhoconnect.gemspec +5 -6
- data/spec/api/api_helper.rb +1 -1
- data/spec/api/app/fast_delete_spec.rb +22 -22
- data/spec/api/app/fast_insert_spec.rb +23 -23
- data/spec/api/app/fast_update_spec.rb +63 -63
- data/spec/api/app/push_deletes_spec.rb +11 -13
- data/spec/api/app/push_objects_spec.rb +39 -39
- data/spec/api/client/client_get_db_doc_spec.rb +29 -29
- data/spec/api/client/client_set_db_doc_spec.rb +11 -11
- data/spec/api/client/get_client_params_spec.rb +29 -29
- data/spec/api/client/list_client_docs_spec.rb +32 -34
- data/spec/api/client/reset_spec.rb +30 -30
- data/spec/api/readstate/set_refresh_time_spec.rb +43 -43
- data/spec/api/source/get_source_params_spec.rb +32 -34
- data/spec/api/source/list_sources_spec.rb +13 -13
- data/spec/api/source/update_source_params_spec.rb +19 -19
- data/spec/api/store/get_db_doc_spec.rb +27 -27
- data/spec/api/store/set_db_doc_spec.rb +38 -38
- data/spec/api/system/adapter_spec.rb +27 -29
- data/spec/api/system/get_license_info_spec.rb +11 -11
- data/spec/api/system/login_spec.rb +37 -37
- data/spec/api/system/reset_spec.rb +15 -15
- data/spec/api/system/stats_spec.rb +70 -71
- data/spec/api/user/create_user_spec.rb +37 -37
- data/spec/api/user/delete_client_spec.rb +7 -7
- data/spec/api/user/delete_user_spec.rb +62 -62
- data/spec/api/user/list_clients_spec.rb +24 -24
- data/spec/api/user/list_source_docs_spec.rb +29 -29
- data/spec/api/user/list_users_spec.rb +22 -22
- data/spec/api/user/ping_spec.rb +18 -18
- data/spec/api/user/show_user_spec.rb +10 -10
- data/spec/api/user/update_user_spec.rb +43 -43
- data/spec/api/user/user_get_db_doc_spec.rb +12 -12
- data/spec/api/user/user_set_db_doc_spec.rb +37 -37
- data/spec/api_token_spec.rb +8 -8
- data/spec/app_spec.rb +18 -17
- data/spec/apps/jstestapp/settings/settings.yml +2 -0
- data/spec/async_spec.rb +9 -11
- data/spec/bulk_data/bulk_data_spec.rb +120 -120
- data/spec/cli/cli_spec.rb +50 -53
- data/spec/client_spec.rb +105 -105
- data/spec/client_sync_spec.rb +529 -528
- data/spec/controllers/js_base_spec.rb +147 -141
- data/spec/doc/doc_spec.rb +51 -52
- data/spec/document_spec.rb +58 -58
- data/spec/dynamic_adapter_spec.rb +33 -36
- data/spec/generator/generator_spec.rb +76 -42
- data/spec/jobs/bulk_data_job_spec.rb +101 -102
- data/spec/jobs/ping_job_spec.rb +176 -177
- data/spec/jobs/source_job_spec.rb +24 -25
- data/spec/license_spec.rb +54 -55
- data/spec/models/js_base_spec.rb +121 -120
- data/spec/perf/bulk_data_perf_spec.rb +23 -24
- data/spec/perf/perf_spec_helper.rb +7 -7
- data/spec/perf/store_perf_spec.rb +139 -140
- data/spec/ping/apple_spec.rb +65 -65
- data/spec/ping/gcm_spec.rb +83 -84
- data/spec/ping/rhoconnect_push_spec.rb +52 -53
- data/spec/predefined_adapters/rho_internal_bench_adapter_controller_js_spec.rb +100 -101
- data/spec/predefined_adapters/rho_internal_js_bench_adapter_js_spec.rb +29 -31
- data/spec/read_state_spec.rb +24 -25
- data/spec/rhoconnect_spec.rb +7 -7
- data/spec/server/server_spec.rb +664 -662
- data/spec/server/stats_spec.rb +12 -12
- data/spec/source_adapter_spec.rb +124 -125
- data/spec/source_spec.rb +148 -149
- data/spec/source_sync_spec.rb +736 -736
- data/spec/spec_helper.rb +4 -5
- data/spec/stats/record_spec.rb +22 -21
- data/spec/store_orm_spec.rb +48 -48
- data/spec/store_spec.rb +428 -426
- data/spec/support/shared_examples.rb +5 -7
- data/spec/sync_states_spec.rb +67 -67
- data/spec/test_methods_spec.rb +121 -123
- data/spec/testdata/10000-data.txt +0 -0
- data/spec/testdata/5000-data.txt +0 -0
- data/spec/user_spec.rb +102 -102
- data/tasks/redis.rake +3 -3
- metadata +154 -195
- data/bench/benchapp/tmp/pids/passenger.9292.pid.lock +0 -0
- data/bench/benchapp/tmp/restart.txt +0 -0
- data/bench/blobapp/settings/license.key.bak +0 -2
- data/bench/blobapp/tmp/restart.txt +0 -0
- data/bench/lib/testdata/1-data.txt +0 -0
- data/bench/lib/testdata/10-data.txt +0 -0
- data/bench/lib/testdata/2-data.txt +0 -0
- data/bench/lib/testdata/250-data.txt +0 -0
- data/bench/lib/testdata/5-blob_data.txt +0 -0
- data/bench/lib/testdata/5-data.txt +0 -0
- data/bench/lib/testdata/50-data.txt +0 -0
- data/bench/lib/testdata/500-data.txt +0 -0
- data/doc/protocol.html +0 -1993
- data/spec/coverage/rcov/assets/0.2.3/jquery-1.3.2.min.js +0 -19
- data/spec/coverage/rcov/assets/0.2.3/jquery.tablesorter.min.js +0 -15
- data/spec/coverage/rcov/assets/0.2.3/print.css +0 -12
- data/spec/coverage/rcov/assets/0.2.3/rcov.js +0 -42
- data/spec/coverage/rcov/assets/0.2.3/screen.css +0 -270
- data/spec/coverage/rcov/index.html +0 -88
- data/spec/generator/generator_spec_helper.rb +0 -9
data/generators/rhoconnect.rb
CHANGED
|
@@ -1,272 +1,152 @@
|
|
|
1
|
-
require '
|
|
2
|
-
require '
|
|
1
|
+
require 'thor'
|
|
2
|
+
require 'thor/group'
|
|
3
3
|
|
|
4
4
|
module Rhoconnect
|
|
5
|
-
extend Templater::Manifold
|
|
6
|
-
extend Rhoconnect
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
class AppGenerator < Thor::Group
|
|
7
|
+
namespace :app_generator
|
|
8
|
+
include Thor::Actions
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
49
|
-
install_app_options(self)
|
|
14
|
+
def gem_version; VERSION; end
|
|
50
15
|
|
|
51
|
-
def
|
|
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.
|
|
67
|
-
template
|
|
68
|
-
end
|
|
18
|
+
template("config.ru", "#{name}/config.ru")
|
|
19
|
+
template("Gemfile", "#{name}/Gemfile")
|
|
69
20
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
81
|
-
template.source = 'settings/license.key'
|
|
82
|
-
template.destination = "#{name}/settings/license.key"
|
|
83
|
-
end
|
|
32
|
+
npm_install_note = <<_NPM_INSTALL_
|
|
84
33
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
97
|
-
template.source = 'rcgemfile'
|
|
98
|
-
template.destination = "#{name}/.rcgemfile"
|
|
99
|
-
end
|
|
38
|
+
_NPM_INSTALL_
|
|
100
39
|
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
57
|
+
cd #{name} && bundle install
|
|
114
58
|
|
|
115
59
|
If you're setting up the application in a production environment run the following:
|
|
116
|
-
|
|
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
|
-
|
|
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
|
-
|
|
74
|
+
say running_bundler_first_time, :bold
|
|
131
75
|
system("bundle install --gemfile=#{destination_root}/#{name}/Gemfile")
|
|
132
|
-
|
|
76
|
+
say install_gems_note, :bold
|
|
133
77
|
end
|
|
134
|
-
rescue
|
|
135
|
-
warning_msg =
|
|
136
|
-
"*** Warning:
|
|
137
|
-
"*** Install required version of rhoconnect gem, or explicitly
|
|
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
|
-
|
|
84
|
+
say warning_msg, :red
|
|
141
85
|
end
|
|
142
86
|
end
|
|
143
87
|
|
|
144
|
-
class
|
|
145
|
-
|
|
88
|
+
class BaseSourceGenerator < Thor::Group
|
|
89
|
+
include Thor::Actions
|
|
146
90
|
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
172
|
-
|
|
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
|
|
193
|
-
|
|
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
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
[:
|
|
222
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
|
252
|
-
|
|
145
|
+
class SourceGenerator < BaseSourceGenerator
|
|
146
|
+
namespace :source_generator
|
|
253
147
|
|
|
254
|
-
|
|
255
|
-
|
|
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.
|
|
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.
|
|
35
|
-
gem '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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
include_examples "SpecHelper"
|
|
5
|
+
include Rack::Test::Methods
|
|
6
|
+
include Rhoconnect
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
def app
|
|
9
|
+
@app = Rack::URLMap.new Rhoconnect.url_map
|
|
10
|
+
end
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','spec_helper')
|
|
2
2
|
|
|
3
3
|
describe "<%=class_name%>Controller" do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
include_examples "SpecHelper"
|
|
5
|
+
include Rack::Test::Methods
|
|
6
|
+
include Rhoconnect
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
def app
|
|
9
|
+
@app = Rack::URLMap.new Rhoconnect.url_map
|
|
10
|
+
end
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
it "should process <%=class_name%>Controller GET" do
|
|
20
|
+
pending
|
|
21
|
+
end
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
5
|
-
before(:each) do
|
|
6
|
-
setup_test_for <%=class_name%>,'testuser'
|
|
7
|
-
end
|
|
4
|
+
include_examples "SpecHelper"
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
before(:each) do
|
|
7
|
+
setup_test_for <%=class_name%>,'testuser'
|
|
8
|
+
end
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
it "should process <%=class_name%> query" do
|
|
11
|
+
pending
|
|
12
|
+
end
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
it "should process <%=class_name%> create" do
|
|
15
|
+
pending
|
|
16
|
+
end
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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="
|
|
267
|
-
RUBY_VERSION="ruby-
|
|
255
|
+
RUBY_PATCH="p85"
|
|
256
|
+
RUBY_VERSION="ruby-2.2.1"
|
|
268
257
|
|
|
269
|
-
NODE_VERSION=v0.10.
|
|
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-
|
|
12
|
-
REDIS = "redis-2.
|
|
13
|
-
SQLITE3 = "sqlite-autoconf-
|
|
14
|
-
NGINX = "nginx-1.
|
|
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"
|