rhoconnect 3.2.0.beta1 → 3.2.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +33 -7
- data/README.md +4 -0
- data/Rakefile +13 -11
- data/commands/commands/rhoconnect/create_user.rb +1 -1
- data/commands/commands/rhoconnect/delete_device.rb +1 -1
- data/commands/commands/rhoconnect/delete_user.rb +1 -1
- data/commands/commands/rhoconnect/get_token.rb +1 -1
- data/commands/commands/rhoconnect/reset.rb +1 -1
- data/commands/execute.rb +0 -1
- data/doc/bulk-sync.txt +35 -1
- data/doc/install.txt +7 -3
- data/examples/simple/config.ru +1 -1
- data/generators/templates/application/Gemfile +1 -1
- data/install.sh +4 -4
- data/installer/unix-like/create_texts.rb +31 -31
- data/installer/unix-like/pre_uninstall.sh +2 -3
- data/installer/unix-like/rho_connect_install_constants.rb +3 -3
- data/installer/unix-like/rho_connect_install_debian.rb +0 -5
- data/installer/unix-like/rho_connect_install_yum.rb +1 -3
- data/installer/utils/constants.rb +4 -4
- data/installer/utils/nix_install_test.rb +20 -20
- data/installer/utils/package_upload/repos.rake +2 -2
- data/installer/utils/package_upload/s3_single_file.rb +57 -0
- data/lib/rhoconnect/client_sync.rb +1 -1
- data/lib/rhoconnect/jobs/bulk_data_job.rb +30 -32
- data/lib/rhoconnect/jobs/ping_job.rb +15 -2
- data/lib/rhoconnect/server.rb +3 -0
- data/lib/rhoconnect/tasks.rb +5 -7
- data/lib/rhoconnect/user.rb +1 -0
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/models/adapter.js +2 -0
- data/lib/rhoconnect/web-console/models/client.js +0 -22
- data/lib/rhoconnect/web-console/models/source.js +1 -1
- data/lib/rhoconnect/web-console/templates/index.erb +2 -1
- data/lib/rhoconnect/web-console/views/home.js +22 -1
- data/lib/rhoconnect/web-console/views/set_adapter.js +5 -6
- data/rhoconnect.gemspec +2 -1
- data/spec/api/source/fast_insert_spec.rb +1 -1
- data/spec/api/user/create_user_spec.rb +11 -1
- data/spec/client_sync_spec.rb +32 -25
- data/spec/javascripts/admins_routes_spec.js +108 -103
- data/spec/javascripts/doc_view_spec.js +2 -3
- data/spec/javascripts/edit_user_view_spec.js +1 -1
- data/spec/javascripts/home_view_spec.js +6 -6
- data/spec/javascripts/server_doc_view_spec.js +4 -0
- data/spec/javascripts/session_spec.js +15 -0
- data/spec/javascripts/set_adapter_view_spec.js +2 -6
- data/spec/javascripts/show_device_view_spec.js +4 -1
- data/spec/javascripts/show_user_view_spec.js +4 -0
- data/spec/javascripts/source_docs_view_spec.js +2 -2
- data/spec/jobs/bulk_data_job_spec.rb +8 -12
- data/spec/jobs/ping_job_spec.rb +21 -0
- data/spec/perf/bulk_data_perf_spec.rb +1 -2
- data/spec/server/server_spec.rb +2 -4
- data/spec/spec_helper.rb +13 -3
- data/tasks/jasmine.rake +7 -0
- metadata +24 -7
- data/lib/rhoconnect/console/rhoconnect_api.rb +0 -245
- data/spec/api/application/rhoconnect_api_spec.rb +0 -592
data/spec/spec_helper.rb
CHANGED
@@ -184,8 +184,8 @@ module TestHelpers
|
|
184
184
|
end
|
185
185
|
|
186
186
|
def validate_db_by_name(db,s,data)
|
187
|
-
db.execute("select source_id,name,sync_priority,partition,
|
188
|
-
|
187
|
+
db.execute("select source_id,name,sync_priority,partition,sync_type,source_attribs,
|
188
|
+
metadata,schema,blob_attribs,associations,last_inserted_size, backend_refresh_time
|
189
189
|
from sources where name='#{s.name}'").each do |row|
|
190
190
|
|
191
191
|
return false if row[0].to_s != s.source_id.to_s
|
@@ -198,6 +198,8 @@ module TestHelpers
|
|
198
198
|
return false if row[7] != s.schema
|
199
199
|
return false if row[8] != s.blob_attribs
|
200
200
|
return false if row[9] != s.has_many
|
201
|
+
return false if row[10] != s.get_value(:md_size).to_i
|
202
|
+
return false if row[11] != s.read_state.refresh_time
|
201
203
|
end
|
202
204
|
|
203
205
|
data = json_clone(data)
|
@@ -293,6 +295,14 @@ module TestHelpers
|
|
293
295
|
|
294
296
|
def get_sha1(str)
|
295
297
|
Digest::SHA1.hexdigest(str)
|
296
|
-
end
|
298
|
+
end
|
299
|
+
|
300
|
+
def do_bulk_data_job(params)
|
301
|
+
begin
|
302
|
+
BulkDataJob.perform(params)
|
303
|
+
ensure
|
304
|
+
BulkDataJob.after_perform_x(params)
|
305
|
+
end
|
306
|
+
end
|
297
307
|
|
298
308
|
end #TestHelpers
|
data/tasks/jasmine.rake
ADDED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhoconnect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196455
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 3.2.0.
|
11
|
+
- 2
|
12
|
+
version: 3.2.0.beta2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Rhomobile
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
20
|
+
date: 2012-05-02 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -193,6 +193,22 @@ dependencies:
|
|
193
193
|
prerelease: false
|
194
194
|
name: thor
|
195
195
|
type: :runtime
|
196
|
+
- !ruby/object:Gem::Dependency
|
197
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
198
|
+
none: false
|
199
|
+
requirements:
|
200
|
+
- - ~>
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
hash: 25
|
203
|
+
segments:
|
204
|
+
- 1
|
205
|
+
- 3
|
206
|
+
- 1
|
207
|
+
version: 1.3.1
|
208
|
+
requirement: *id012
|
209
|
+
prerelease: false
|
210
|
+
name: thin
|
211
|
+
type: :runtime
|
196
212
|
description: RhoConnect App Integration Server and related command-line utilities
|
197
213
|
email: dev@rhomobile.com
|
198
214
|
executables:
|
@@ -413,6 +429,7 @@ files:
|
|
413
429
|
- installer/windows/configUi.ini
|
414
430
|
- installer/windows/ServiceLib.nsh
|
415
431
|
- installer/utils/constants.rb
|
432
|
+
- installer/utils/package_upload/s3_single_file.rb
|
416
433
|
- installer/utils/package_upload/repos.rake
|
417
434
|
- installer/utils/package_upload/s3_upload.rb
|
418
435
|
- installer/utils/download_from_s3.rb
|
@@ -433,7 +450,6 @@ files:
|
|
433
450
|
- lib/rhoconnect/lock_ops.rb
|
434
451
|
- lib/rhoconnect/body_content_type_parser.rb
|
435
452
|
- lib/rhoconnect/console/server.rb
|
436
|
-
- lib/rhoconnect/console/rhoconnect_api.rb
|
437
453
|
- lib/rhoconnect/utilities.rb
|
438
454
|
- lib/rhoconnect/web-console/server.rb
|
439
455
|
- lib/rhoconnect/web-console/views/edit_user.js
|
@@ -550,6 +566,7 @@ files:
|
|
550
566
|
- lib/rhoconnect/console.rb
|
551
567
|
- lib/rhoconnect/read_state.rb
|
552
568
|
- lib/rhoconnect.rb
|
569
|
+
- tasks/jasmine.rake
|
553
570
|
- tasks/redis.rake
|
554
571
|
- spec/support/shared_examples.rb
|
555
572
|
- spec/source_adapter_spec.rb
|
@@ -570,7 +587,6 @@ files:
|
|
570
587
|
- spec/api/client/list_client_docs_spec.rb
|
571
588
|
- spec/api/client/create_client_spec.rb
|
572
589
|
- spec/api/client/list_clients_spec.rb
|
573
|
-
- spec/api/application/rhoconnect_api_spec.rb
|
574
590
|
- spec/api/user/delete_user_spec.rb
|
575
591
|
- spec/api/user/create_user_spec.rb
|
576
592
|
- spec/api/user/list_users_spec.rb
|
@@ -621,6 +637,7 @@ files:
|
|
621
637
|
- spec/javascripts/support/jasmine.yml
|
622
638
|
- spec/javascripts/support/jasmine_runner.rb
|
623
639
|
- spec/javascripts/edit_user_view_spec.js
|
640
|
+
- spec/javascripts/session_spec.js
|
624
641
|
- spec/javascripts/server_doc_view_spec.js
|
625
642
|
- spec/javascripts/users_view_spec.js
|
626
643
|
- spec/javascripts/PlayerSpec.js
|
@@ -723,7 +740,6 @@ test_files:
|
|
723
740
|
- spec/api/client/list_client_docs_spec.rb
|
724
741
|
- spec/api/client/create_client_spec.rb
|
725
742
|
- spec/api/client/list_clients_spec.rb
|
726
|
-
- spec/api/application/rhoconnect_api_spec.rb
|
727
743
|
- spec/api/user/delete_user_spec.rb
|
728
744
|
- spec/api/user/create_user_spec.rb
|
729
745
|
- spec/api/user/list_users_spec.rb
|
@@ -774,6 +790,7 @@ test_files:
|
|
774
790
|
- spec/javascripts/support/jasmine.yml
|
775
791
|
- spec/javascripts/support/jasmine_runner.rb
|
776
792
|
- spec/javascripts/edit_user_view_spec.js
|
793
|
+
- spec/javascripts/session_spec.js
|
777
794
|
- spec/javascripts/server_doc_view_spec.js
|
778
795
|
- spec/javascripts/users_view_spec.js
|
779
796
|
- spec/javascripts/PlayerSpec.js
|
@@ -1,245 +0,0 @@
|
|
1
|
-
require 'rest_client'
|
2
|
-
path = File.join(File.dirname(__FILE__),'..','..')
|
3
|
-
$:.unshift path
|
4
|
-
require 'rhoconnect'
|
5
|
-
include Rhoconnect
|
6
|
-
|
7
|
-
module RhoconnectApi
|
8
|
-
class << self
|
9
|
-
|
10
|
-
def get_token(server,login,password)
|
11
|
-
if directcall?(server)
|
12
|
-
Server.get_api_token(nil,User.authenticate(login,password))
|
13
|
-
else
|
14
|
-
do_login(server,login,password)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def list_users(server,token)
|
19
|
-
if directcall?(server) and verify_token(token)
|
20
|
-
JSON.parse(Server.list_users(nil,api_user(token)))
|
21
|
-
else
|
22
|
-
JSON.parse(RestClient.post("#{server}/api/user/list_users",
|
23
|
-
{:api_token => token}.to_json, :content_type => :json).body)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def save_adapter(server,token,adapter_url)
|
28
|
-
if directcall?(server) and verify_token(token)
|
29
|
-
Server.save_adapter({:attributes => {'adapter_url' => adapter_url}},nil)
|
30
|
-
else
|
31
|
-
RestClient.post("#{server}/api/source/save_adapter",
|
32
|
-
{:api_token => token,:adapter_url => adapter_url}.to_json,
|
33
|
-
:content_type => :json)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def create_user(server,token,login,password)
|
38
|
-
if directcall?(server) and verify_token(token)
|
39
|
-
Server.create_user({:attributes => {'login' => login, 'password' => password}},nil)
|
40
|
-
else
|
41
|
-
RestClient.post("#{server}/api/user/create_user",
|
42
|
-
{:api_token => token,:attributes => {:login => login, :password => password}}.to_json,
|
43
|
-
:content_type => :json)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def update_user(server,token,attributes)
|
48
|
-
if directcall?(server) and verify_token(token)
|
49
|
-
Server.update_user({:attributes => attributes},api_user(token))
|
50
|
-
else
|
51
|
-
RestClient.post("#{server}/api/user/update_user",
|
52
|
-
{:api_token => token,:attributes => attributes}.to_json,
|
53
|
-
:content_type => :json)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def delete_user(server,token,user_id)
|
58
|
-
if directcall?(server) and verify_token(token)
|
59
|
-
Server.delete_user({:user_id => user_id},nil)
|
60
|
-
else
|
61
|
-
RestClient.post("#{server}/api/user/delete_user",
|
62
|
-
{:api_token => token, :user_id => user_id}.to_json,
|
63
|
-
:content_type => :json)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def list_clients(server,token,user_id)
|
68
|
-
if directcall?(server) and verify_token(token)
|
69
|
-
JSON.parse(Server.list_clients({:user_id => user_id},nil))
|
70
|
-
else
|
71
|
-
JSON.parse(RestClient.post("#{server}/api/client/list_clients",
|
72
|
-
{:api_token => token, :user_id => user_id}.to_json, :content_type => :json).body)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def create_client(server,token,user_id)
|
77
|
-
if directcall?(server) and verify_token(token)
|
78
|
-
Server.create_client({:user_id => user_id},nil)
|
79
|
-
else
|
80
|
-
RestClient.post("#{server}/api/client/create_client",
|
81
|
-
{:api_token => token, :user_id => user_id}.to_json,
|
82
|
-
:content_type => :json).body
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def delete_client(server,token,user_id,client_id)
|
87
|
-
if directcall?(server) and verify_token(token)
|
88
|
-
Server.delete_client({:user_id => user_id,:client_id => client_id},nil)
|
89
|
-
else
|
90
|
-
RestClient.post("#{server}/api/client/delete_client",
|
91
|
-
{:api_token => token, :user_id => user_id,
|
92
|
-
:client_id => client_id}.to_json, :content_type => :json)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def get_client_params(server,token,client_id)
|
97
|
-
if directcall?(server) and verify_token(token)
|
98
|
-
JSON.parse(Server.get_client_params({:client_id => client_id},nil))
|
99
|
-
else
|
100
|
-
JSON.parse(RestClient.post("#{server}/api/client/get_client_params",
|
101
|
-
{:api_token => token, :client_id => client_id}.to_json, :content_type => :json).body)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def get_adapter(server,token)
|
106
|
-
if directcall?(server) and verify_token(token)
|
107
|
-
JSON.parse(Server.get_adapter({},nil))
|
108
|
-
else
|
109
|
-
JSON.parse(RestClient.post("#{server}/api/source/get_adapter",
|
110
|
-
{:api_token => token}.to_json, :content_type => :json).body)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def list_sources(server,token,partition='all')
|
115
|
-
if directcall?(server) and verify_token(token)
|
116
|
-
JSON.parse(Server.list_sources({:partition_type => partition.to_s},nil))
|
117
|
-
else
|
118
|
-
JSON.parse(RestClient.post("#{server}/api/source/list_sources",
|
119
|
-
{:api_token => token, :partition_type => partition}.to_json, :content_type => :json).body)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def get_source_params(server,token,source_id)
|
124
|
-
if directcall?(server) and verify_token(token)
|
125
|
-
JSON.parse(Server.get_source_params({:source_id => source_id},nil))
|
126
|
-
else
|
127
|
-
JSON.parse(RestClient.post("#{server}/api/source/get_source_params",
|
128
|
-
{:api_token => token, :source_id => source_id}.to_json, :content_type => :json).body)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def list_source_docs(server,token,source_id,user_id='*')
|
133
|
-
if directcall?(server) and verify_token(token)
|
134
|
-
JSON.parse(Server.list_source_docs({:source_id => source_id, :user_id => user_id},nil))
|
135
|
-
else
|
136
|
-
JSON.parse(RestClient.post("#{server}/api/source/list_source_docs",
|
137
|
-
{:api_token => token, :source_id => source_id, :user_id => user_id}.to_json, :content_type => :json).body)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def list_client_docs(server,token,source_id,client_id)
|
142
|
-
if directcall?(server) and verify_token(token)
|
143
|
-
JSON.parse(Server.list_client_docs({:source_id => source_id, :client_id => client_id},nil))
|
144
|
-
else
|
145
|
-
JSON.parse(RestClient.post("#{server}/api/client/list_client_docs",
|
146
|
-
{:api_token => token, :source_id => source_id, :client_id => client_id}.to_json, :content_type => :json).body)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
#TODO: figure out data_type programmatically
|
151
|
-
def get_db_doc(server,token,doc,data_type='')
|
152
|
-
res = ""
|
153
|
-
if directcall?(server) and verify_token(token)
|
154
|
-
res = Server.get_db_doc({:doc => doc, :data_type => data_type},nil)
|
155
|
-
else
|
156
|
-
res = RestClient.post("#{server}/api/source/get_db_doc",
|
157
|
-
{:api_token => token, :doc => doc, :data_type => data_type}.to_json, :content_type => :json).body
|
158
|
-
end
|
159
|
-
data_type=='' ? JSON.parse(res) : res
|
160
|
-
end
|
161
|
-
|
162
|
-
#TODO: figure out data_type programmatically
|
163
|
-
def set_db_doc(server,token,doc,data={},data_type='')
|
164
|
-
if directcall?(server) and verify_token(token)
|
165
|
-
Server.set_db_doc({:doc => doc, :data => data, :data_type => data_type},nil)
|
166
|
-
else
|
167
|
-
RestClient.post("#{server}/api/source/set_db_doc",
|
168
|
-
{:api_token => token, :doc => doc, :data => data, :data_type => data_type}.to_json, :content_type => :json)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def reset(server,token)
|
173
|
-
if directcall?(server) and verify_token(token)
|
174
|
-
Server.reset({:api_token => token},api_user(token))
|
175
|
-
else
|
176
|
-
RestClient.post("#{server}/api/admin/reset",
|
177
|
-
{:api_token => token}.to_json, :content_type => :json)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def ping(server,token,user_id,params)
|
182
|
-
ping_params = {'api_token' => token, 'user_id' => user_id}
|
183
|
-
[:message,:badge,:sound,:vibrate,:sources,:async].each do |part|
|
184
|
-
part = part.to_s
|
185
|
-
ping_params.merge!(part => params[part]) if params[part]
|
186
|
-
end
|
187
|
-
if directcall?(server) and verify_token(token)
|
188
|
-
Server.ping(ping_params,nil)
|
189
|
-
else
|
190
|
-
RestClient.post("#{server}/api/client/ping",ping_params.to_json, :content_type => :json)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
def get_license_info(server,token)
|
195
|
-
if directcall?(server) and verify_token(token)
|
196
|
-
JSON.parse(Server.get_license_info(nil,nil))
|
197
|
-
else
|
198
|
-
JSON.parse(RestClient.post("#{server}/api/admin/get_license_info",
|
199
|
-
{:api_token => token}.to_json, :content_type => :json).body)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
def stats(server,token,params)
|
204
|
-
if directcall?(server) and verify_token(token)
|
205
|
-
Server.stats(params,api_user(token))
|
206
|
-
else
|
207
|
-
RestClient.post("#{server}/api/admin/stats",
|
208
|
-
{:api_token => token}.merge!(params).to_json, :content_type => :json).body
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
private
|
213
|
-
|
214
|
-
def do_login(server,login,password)
|
215
|
-
RestClient.post("#{server}/api/admin/login",
|
216
|
-
{:login => login, :password => password}.to_json,
|
217
|
-
:content_type => :json).body
|
218
|
-
end
|
219
|
-
|
220
|
-
def directcall?(server)
|
221
|
-
server.nil? or server.length == 0
|
222
|
-
end
|
223
|
-
|
224
|
-
def api_user(token)
|
225
|
-
ApiToken.load(token).user
|
226
|
-
end
|
227
|
-
|
228
|
-
def verify_token(token)
|
229
|
-
raise ApiException.new(422, "Invalid/missing API user") unless api_user(token); true
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
class Server
|
234
|
-
def self.api(method_name,namespace = nil, verb = :post, &block)
|
235
|
-
self.class.send(:define_method, method_name, &block) unless namespace == :application
|
236
|
-
end
|
237
|
-
|
238
|
-
def self.app_api(method_name, namespace = nil, verb = :post, &block)
|
239
|
-
# this is not used in RhoconnectAPI::Server
|
240
|
-
end
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
include RhoconnectApi
|
245
|
-
Dir[File.join(File.dirname(__FILE__),'..','api','**','*.rb')].each { |api| load api }
|