rhoconnect 5.5.18 → 7.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +18 -11
- data/Gemfile.lock +178 -100
- data/README.md +2 -0
- data/Rakefile +4 -3
- data/commands/dtach/dtach_install.rb +29 -24
- data/commands/rhoconnect/start.rb +5 -4
- data/generators/templates/application/rcgemfile +1 -1
- data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +1 -1
- data/lib/rhoconnect/ping/fcm.rb +74 -0
- data/lib/rhoconnect/ping.rb +1 -1
- data/lib/rhoconnect/store.rb +3 -3
- data/lib/rhoconnect/version.rb +1 -1
- data/rhoconnect.gemspec +15 -11
- data/spec/api/client/get_client_params_spec.rb +4 -0
- data/spec/apps/rhotestapp/models/ruby/sample_adapter.rb +1 -1
- data/spec/client_sync_spec.rb +7 -7
- data/spec/dynamic_adapter_spec.rb +13 -13
- data/spec/generator/generator_spec.rb +7 -7
- data/spec/jobs/ping_job_spec.rb +229 -105
- data/spec/perf/perf_spec_helper.rb +5 -5
- data/spec/ping/apple_spec.rb +24 -26
- data/spec/ping/fcm_spec.rb +116 -0
- data/spec/ping/gcm_spec.rb +27 -29
- data/spec/ping/rhoconnect_push_spec.rb +13 -13
- data/spec/rhoconnect_spec.rb +2 -2
- data/spec/server/cors_spec.rb +22 -22
- data/spec/server/server_spec.rb +308 -310
- data/spec/server/stats_spec.rb +7 -7
- data/spec/server/x_domain_session_wrapper_spec.rb +40 -40
- data/spec/source_adapter_spec.rb +2 -2
- data/spec/source_sync_spec.rb +4 -4
- data/spec/spec_helper.rb +8 -8
- data/spec/stats/record_spec.rb +7 -7
- data/spec/store_orm_spec.rb +97 -94
- data/spec/store_spec.rb +23 -23
- data/spec/user_spec.rb +3 -3
- metadata +98 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c099bf011ac9d86069e43c087202b4d081f4335
|
4
|
+
data.tar.gz: 145a100fe9af03dc3f9d4e89d7d1030fc9d774e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f3190d8eb2b9373edcd6a3131abe0fca94c895a5ce7fe8bf3cece8521c841db825a20964f5b9fd454baf05b07a7270e041ff11c8ac9f21a230473fe6c80621
|
7
|
+
data.tar.gz: 858ca815f2d4dff5c39e19abdc524b529fbf5b9823f68ec61ef8e4a0a8a2e57e8ceeb90384543935c3b605a1f572725a338d102f005a6cae0de482bfa760d3f6
|
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ platforms :ruby, :mingw do
|
|
13
13
|
# for async framework
|
14
14
|
# for Async, Eventful execution
|
15
15
|
gem 'rack-fiber_pool'
|
16
|
-
gem 'async-rack'
|
16
|
+
gem 'async-rack', :git => 'https://github.com/tauplatform/async-rack.git'
|
17
17
|
end
|
18
18
|
|
19
19
|
platforms :jruby do
|
@@ -27,21 +27,28 @@ end
|
|
27
27
|
|
28
28
|
group :development do
|
29
29
|
# gem 'debugger'
|
30
|
-
gem 'aws-s3', '>= 0.6.
|
31
|
-
gem 'sqlite3', ">= 1.
|
32
|
-
gem "excon", "~> 0.
|
33
|
-
gem "
|
34
|
-
gem
|
35
|
-
gem '
|
30
|
+
gem 'aws-s3', '>= 0.6.3', :require => 'aws/s3'
|
31
|
+
gem 'sqlite3', ">= 1.4.0", :platforms => [:ruby, :mswin, :mingw]
|
32
|
+
gem "excon", "~> 0.72.0"
|
33
|
+
gem "net-ssh", "~> 5.2.0"
|
34
|
+
gem "fog-aws", "~> 3.4.0"
|
35
|
+
gem 'ffaker', '~> 2.10.0'
|
36
|
+
gem 'webmock', '~> 3.5.1'
|
36
37
|
end
|
37
38
|
|
38
39
|
group :test do
|
39
|
-
gem 'rspec', '~>
|
40
|
-
gem 'simplecov', '>= 0.
|
40
|
+
gem 'rspec', '~> 3.8.0'
|
41
|
+
gem 'simplecov', '>= 0.16.1', :require => false
|
41
42
|
gem 'simplecov-rcov', '~> 0.2.3'
|
42
|
-
gem 'rack-test', '~> 0
|
43
|
+
gem 'rack-test', '~> 1.1.0', :require => 'rack/test'
|
44
|
+
#gem 'jasmine', :platforms => [:ruby,:jruby]
|
45
|
+
#gem 'jasmine-headless-webkit', '~> 0.8.4', :platforms => [:ruby,:jruby]
|
43
46
|
end
|
44
47
|
|
45
48
|
group :build do
|
46
|
-
gem 'fpm', '>=
|
49
|
+
gem 'fpm', '>= 1.11.00'
|
47
50
|
end
|
51
|
+
|
52
|
+
gem 'signet', '~> 0.7'
|
53
|
+
gem 'google-api-client', '~> 0.31.0'
|
54
|
+
gem 'google-api-fcm', '~> 0.1.7'
|
data/Gemfile.lock
CHANGED
@@ -1,176 +1,254 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/tauplatform/async-rack.git
|
3
|
+
revision: 4f411e7b416894a52426eb3b26c2415e5ead927e
|
4
|
+
specs:
|
5
|
+
async-rack (0.5.2)
|
6
|
+
rack (~> 2.0)
|
7
|
+
|
1
8
|
PATH
|
2
9
|
remote: .
|
3
10
|
specs:
|
4
|
-
rhoconnect (
|
5
|
-
bundler (~> 1.
|
6
|
-
connection_pool (~>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
rhoconnect (7.1.0)
|
12
|
+
bundler (~> 1.17.3)
|
13
|
+
connection_pool (~> 2.2.2)
|
14
|
+
google-api-client (~> 0.31.0)
|
15
|
+
google-api-fcm (~> 0.1.7)
|
16
|
+
json (>= 1.8, < 2.0)
|
17
|
+
rack (~> 2.0.6)
|
18
|
+
rake (~> 12.3.2)
|
19
|
+
redis (~> 4.1.0)
|
20
|
+
redis-namespace (~> 1.6.0)
|
21
|
+
resque (>= 2.0.0)
|
22
|
+
rest-client (~> 2.0.2)
|
23
|
+
rubyzip (>= 1.2.2, < 2.1.0)
|
24
|
+
signet (~> 0.11.0)
|
25
|
+
sinatra (~> 2.0.5)
|
26
|
+
thor (~> 0.20.3)
|
16
27
|
|
17
28
|
GEM
|
18
29
|
remote: https://rubygems.org/
|
19
30
|
specs:
|
20
|
-
addressable (2.
|
21
|
-
public_suffix (
|
22
|
-
archive-tar-minitar (0.5.2)
|
31
|
+
addressable (2.7.0)
|
32
|
+
public_suffix (>= 2.0.2, < 5.0)
|
23
33
|
arr-pm (0.0.10)
|
24
34
|
cabin (> 0)
|
25
|
-
async-rack (0.5.1)
|
26
|
-
rack (~> 1.1)
|
27
35
|
aws-s3 (0.6.3)
|
28
36
|
builder
|
29
37
|
mime-types
|
30
38
|
xml-simple
|
31
|
-
backports (3.
|
32
|
-
builder (3.2.
|
39
|
+
backports (3.16.1)
|
40
|
+
builder (3.2.4)
|
33
41
|
cabin (0.9.0)
|
34
|
-
childprocess (0.
|
42
|
+
childprocess (0.9.0)
|
35
43
|
ffi (~> 1.0, >= 1.0.11)
|
36
44
|
clamp (1.0.1)
|
37
|
-
connection_pool (
|
45
|
+
connection_pool (2.2.2)
|
38
46
|
crack (0.4.3)
|
39
47
|
safe_yaml (~> 1.0.0)
|
40
|
-
daemons (1.
|
48
|
+
daemons (1.3.1)
|
49
|
+
declarative (0.0.10)
|
50
|
+
declarative-option (0.1.0)
|
41
51
|
diff-lcs (1.3)
|
42
|
-
docile (1.
|
43
|
-
|
52
|
+
docile (1.3.2)
|
53
|
+
domain_name (0.5.20190701)
|
54
|
+
unf (>= 0.0.5, < 1.0.0)
|
55
|
+
dotenv (2.7.5)
|
44
56
|
eventmachine (1.0.9.1)
|
45
|
-
excon (0.
|
46
|
-
|
47
|
-
|
48
|
-
|
57
|
+
excon (0.72.0)
|
58
|
+
faraday (0.17.3)
|
59
|
+
multipart-post (>= 1.2, < 3)
|
60
|
+
ffaker (2.10.0)
|
61
|
+
ffi (1.12.2)
|
62
|
+
fog-aws (3.4.0)
|
63
|
+
fog-core (~> 2.1)
|
64
|
+
fog-json (~> 1.1)
|
65
|
+
fog-xml (~> 0.1)
|
66
|
+
ipaddress (~> 0.8)
|
67
|
+
fog-core (2.2.0)
|
49
68
|
builder
|
50
|
-
excon (~> 0.
|
51
|
-
formatador (~> 0.2
|
52
|
-
json (~> 1.7)
|
69
|
+
excon (~> 0.71)
|
70
|
+
formatador (~> 0.2)
|
53
71
|
mime-types
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
72
|
+
fog-json (1.2.0)
|
73
|
+
fog-core
|
74
|
+
multi_json (~> 1.10)
|
75
|
+
fog-xml (0.1.3)
|
76
|
+
fog-core
|
77
|
+
nokogiri (>= 1.5.11, < 2.0.0)
|
58
78
|
formatador (0.2.5)
|
59
|
-
fpm (1.
|
60
|
-
archive-tar-minitar (= 0.5.2)
|
79
|
+
fpm (1.11.0)
|
61
80
|
arr-pm (~> 0.0.10)
|
62
81
|
backports (>= 2.6.2)
|
63
82
|
cabin (>= 0.6.0)
|
64
|
-
childprocess
|
83
|
+
childprocess (= 0.9.0)
|
65
84
|
clamp (~> 1.0.0)
|
66
85
|
ffi
|
67
86
|
json (>= 1.7.7, < 2.0)
|
68
|
-
pleaserun (~> 0.0.
|
69
|
-
ruby-xz
|
87
|
+
pleaserun (~> 0.0.29)
|
88
|
+
ruby-xz (~> 0.2.3)
|
89
|
+
stud
|
90
|
+
google-api-client (0.31.0)
|
91
|
+
addressable (~> 2.5, >= 2.5.1)
|
92
|
+
googleauth (>= 0.5, < 0.10.0)
|
93
|
+
httpclient (>= 2.8.1, < 3.0)
|
94
|
+
mini_mime (~> 1.0)
|
95
|
+
representable (~> 3.0)
|
96
|
+
retriable (>= 2.0, < 4.0)
|
97
|
+
signet (~> 0.10)
|
98
|
+
google-api-fcm (0.1.7)
|
99
|
+
google-api-client (~> 0.17)
|
100
|
+
googleauth (0.9.0)
|
101
|
+
faraday (~> 0.12)
|
102
|
+
jwt (>= 1.4, < 3.0)
|
103
|
+
memoist (~> 0.16)
|
104
|
+
multi_json (~> 1.11)
|
105
|
+
os (>= 0.9, < 2.0)
|
106
|
+
signet (~> 0.7)
|
107
|
+
hashdiff (1.0.0)
|
108
|
+
http-cookie (1.0.3)
|
109
|
+
domain_name (~> 0.5)
|
110
|
+
httpclient (2.8.3)
|
70
111
|
insist (1.0.0)
|
71
|
-
io-like (0.3.
|
112
|
+
io-like (0.3.1)
|
113
|
+
ipaddress (0.8.3)
|
72
114
|
json (1.8.6)
|
73
|
-
|
115
|
+
jwt (2.2.1)
|
116
|
+
memoist (0.16.2)
|
117
|
+
mime-types (3.3.1)
|
118
|
+
mime-types-data (~> 3.2015)
|
119
|
+
mime-types-data (3.2019.1009)
|
120
|
+
mini_mime (1.0.2)
|
121
|
+
mini_portile2 (2.4.0)
|
74
122
|
mono_logger (1.1.0)
|
75
|
-
multi_json (1.
|
123
|
+
multi_json (1.14.1)
|
124
|
+
multipart-post (2.1.1)
|
76
125
|
mustache (0.99.8)
|
77
|
-
|
78
|
-
|
79
|
-
net-ssh (
|
80
|
-
|
81
|
-
|
126
|
+
mustermann (1.1.1)
|
127
|
+
ruby2_keywords (~> 0.0.1)
|
128
|
+
net-ssh (5.2.0)
|
129
|
+
netrc (0.11.0)
|
130
|
+
nokogiri (1.10.8)
|
131
|
+
mini_portile2 (~> 2.4.0)
|
132
|
+
os (1.0.1)
|
133
|
+
pleaserun (0.0.30)
|
82
134
|
cabin (> 0)
|
83
135
|
clamp
|
84
136
|
dotenv
|
85
137
|
insist
|
86
138
|
mustache (= 0.99.8)
|
87
139
|
stud
|
88
|
-
public_suffix (
|
89
|
-
rack (
|
140
|
+
public_suffix (4.0.3)
|
141
|
+
rack (2.0.9)
|
90
142
|
rack-fiber_pool (0.9.3)
|
91
|
-
rack-protection (
|
143
|
+
rack-protection (2.0.8.1)
|
92
144
|
rack
|
93
|
-
rack-test (
|
94
|
-
rack (>= 1.0)
|
95
|
-
rake (
|
96
|
-
redis (
|
97
|
-
redis-namespace (1.
|
98
|
-
redis (
|
99
|
-
|
145
|
+
rack-test (1.1.0)
|
146
|
+
rack (>= 1.0, < 3)
|
147
|
+
rake (12.3.3)
|
148
|
+
redis (4.1.3)
|
149
|
+
redis-namespace (1.6.0)
|
150
|
+
redis (>= 3.0.4)
|
151
|
+
representable (3.0.4)
|
152
|
+
declarative (< 0.1.0)
|
153
|
+
declarative-option (< 0.2.0)
|
154
|
+
uber (< 0.2.0)
|
155
|
+
resque (2.0.0)
|
100
156
|
mono_logger (~> 1.0)
|
101
157
|
multi_json (~> 1.0)
|
102
|
-
redis-namespace (~> 1.
|
158
|
+
redis-namespace (~> 1.6)
|
103
159
|
sinatra (>= 0.9.2)
|
104
160
|
vegas (~> 0.1.2)
|
105
|
-
rest-client (
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
rspec-
|
115
|
-
|
161
|
+
rest-client (2.0.2)
|
162
|
+
http-cookie (>= 1.0.2, < 2.0)
|
163
|
+
mime-types (>= 1.16, < 4.0)
|
164
|
+
netrc (~> 0.8)
|
165
|
+
retriable (3.1.2)
|
166
|
+
rspec (3.8.0)
|
167
|
+
rspec-core (~> 3.8.0)
|
168
|
+
rspec-expectations (~> 3.8.0)
|
169
|
+
rspec-mocks (~> 3.8.0)
|
170
|
+
rspec-core (3.8.2)
|
171
|
+
rspec-support (~> 3.8.0)
|
172
|
+
rspec-expectations (3.8.6)
|
173
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
174
|
+
rspec-support (~> 3.8.0)
|
175
|
+
rspec-mocks (3.8.2)
|
176
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
177
|
+
rspec-support (~> 3.8.0)
|
178
|
+
rspec-support (3.8.3)
|
116
179
|
ruby-xz (0.2.3)
|
117
180
|
ffi (~> 1.9)
|
118
181
|
io-like (~> 0.3)
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
182
|
+
ruby2_keywords (0.0.2)
|
183
|
+
rubyzip (2.0.0)
|
184
|
+
safe_yaml (1.0.5)
|
185
|
+
signet (0.11.0)
|
186
|
+
addressable (~> 2.3)
|
187
|
+
faraday (~> 0.9)
|
188
|
+
jwt (>= 1.5, < 3.0)
|
189
|
+
multi_json (~> 1.10)
|
190
|
+
simplecov (0.18.2)
|
191
|
+
docile (~> 1.1)
|
192
|
+
simplecov-html (~> 0.11)
|
193
|
+
simplecov-html (0.12.0)
|
126
194
|
simplecov-rcov (0.2.3)
|
127
195
|
simplecov (>= 0.4.1)
|
128
|
-
sinatra (
|
129
|
-
|
130
|
-
rack
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
196
|
+
sinatra (2.0.8.1)
|
197
|
+
mustermann (~> 1.0)
|
198
|
+
rack (~> 2.0)
|
199
|
+
rack-protection (= 2.0.8.1)
|
200
|
+
tilt (~> 2.0)
|
201
|
+
sqlite3 (1.4.2)
|
202
|
+
stud (0.0.23)
|
203
|
+
thin (1.7.2)
|
135
204
|
daemons (~> 1.0, >= 1.0.9)
|
136
205
|
eventmachine (~> 1.0, >= 1.0.4)
|
137
206
|
rack (>= 1, < 3)
|
138
|
-
thor (0.
|
139
|
-
tilt (2.0.
|
207
|
+
thor (0.20.3)
|
208
|
+
tilt (2.0.10)
|
209
|
+
uber (0.1.0)
|
210
|
+
unf (0.1.4)
|
211
|
+
unf_ext
|
212
|
+
unf_ext (0.0.7.6)
|
140
213
|
vegas (0.1.11)
|
141
214
|
rack (>= 1.0.0)
|
142
|
-
webmock (
|
143
|
-
addressable (>= 2.
|
215
|
+
webmock (3.5.1)
|
216
|
+
addressable (>= 2.3.6)
|
144
217
|
crack (>= 0.3.2)
|
218
|
+
hashdiff
|
145
219
|
xml-simple (1.1.5)
|
146
220
|
|
147
221
|
PLATFORMS
|
148
222
|
ruby
|
149
223
|
|
150
224
|
DEPENDENCIES
|
151
|
-
async-rack
|
152
|
-
aws-s3 (>= 0.6.
|
225
|
+
async-rack!
|
226
|
+
aws-s3 (>= 0.6.3)
|
153
227
|
dbd-jdbc (>= 0.1.4)
|
154
228
|
dbi (>= 0.4.5)
|
155
229
|
eventmachine (~> 1.0.5)
|
156
|
-
excon (~> 0.
|
157
|
-
ffaker (~>
|
158
|
-
fog (~>
|
159
|
-
fpm (>=
|
230
|
+
excon (~> 0.72.0)
|
231
|
+
ffaker (~> 2.10.0)
|
232
|
+
fog-aws (~> 3.4.0)
|
233
|
+
fpm (>= 1.11.00)
|
234
|
+
google-api-client (~> 0.31.0)
|
235
|
+
google-api-fcm (~> 0.1.7)
|
160
236
|
jdbc-sqlite3 (>= 3.7.2)
|
161
237
|
jruby-openssl (>= 0.7.4)
|
238
|
+
net-ssh (~> 5.2.0)
|
162
239
|
puma (~> 1.6.3)
|
163
240
|
rack-fiber_pool
|
164
|
-
rack-test (~> 0
|
241
|
+
rack-test (~> 1.1.0)
|
165
242
|
rhoconnect!
|
166
|
-
rspec (~>
|
167
|
-
|
243
|
+
rspec (~> 3.8.0)
|
244
|
+
signet (~> 0.7)
|
245
|
+
simplecov (>= 0.16.1)
|
168
246
|
simplecov-rcov (~> 0.2.3)
|
169
|
-
sqlite3 (>= 1.
|
247
|
+
sqlite3 (>= 1.4.0)
|
170
248
|
thin
|
171
249
|
warbler
|
172
|
-
webmock (~>
|
250
|
+
webmock (~> 3.5.1)
|
173
251
|
win32-process
|
174
252
|
|
175
253
|
BUNDLED WITH
|
176
|
-
1.
|
254
|
+
1.17.3
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/rhomobile/rhoconnect.svg?branch=master)](https://travis-ci.org/rhomobile/rhoconnect)
|
2
|
+
|
1
3
|
RhoConnect App Integration Server
|
2
4
|
-------------------------------------------------------------
|
3
5
|
RhoConnect is an app integration server which keeps enterprise data current and available on users’ devices.
|
data/Rakefile
CHANGED
@@ -12,7 +12,8 @@ require 'rhoconnect'
|
|
12
12
|
|
13
13
|
include Rake::DSL
|
14
14
|
#task :default => 'spec:all'
|
15
|
-
task :default => ["npm_install","spec:all","jasmine:headless"]
|
15
|
+
#task :default => ["npm_install","spec:all","jasmine:headless"]
|
16
|
+
task :default => ["npm_install","spec:all"]
|
16
17
|
task :spec => 'spec:spec'
|
17
18
|
|
18
19
|
begin
|
@@ -39,7 +40,7 @@ begin
|
|
39
40
|
RSpec::Core::RakeTask.new("spec:#{type}") do |t|
|
40
41
|
t.rspec_opts = ["-b", "-c", "-fd"]
|
41
42
|
t.pattern = FileList[TYPES[type]]
|
42
|
-
t.rcov = false
|
43
|
+
#t.rcov = false
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -52,7 +53,7 @@ begin
|
|
52
53
|
desc "Run doc generator - dumps out doc/protocol.html"
|
53
54
|
RSpec::Core::RakeTask.new('doc') do |t|
|
54
55
|
t.pattern = FileList['spec/doc/*_spec.rb']
|
55
|
-
t.rcov = false
|
56
|
+
#t.rcov = false
|
56
57
|
end
|
57
58
|
|
58
59
|
rescue LoadError
|
@@ -1,58 +1,63 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'net/https'
|
3
|
+
|
4
|
+
|
5
|
+
def fetch(uri_str, version, limit = 10)
|
2
6
|
|
3
|
-
def fetch(uri_str, limit = 10)
|
4
7
|
raise ArgumentError, 'Too many HTTP redirects' if limit == 0
|
5
8
|
|
6
9
|
url = URI(uri_str)
|
7
10
|
response = Net::HTTP.get_response(url)
|
8
|
-
|
9
11
|
case response
|
10
12
|
when Net::HTTPOK then
|
11
|
-
Net::HTTP.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
download_file.close
|
13
|
+
http = Net::HTTP.new(url.host, url.port)
|
14
|
+
http.use_ssl = true
|
15
|
+
file_name = "dtach-#{version}.tar.gz"
|
16
|
+
download_file = open(file_name, "wb")
|
17
|
+
begin
|
18
|
+
http.request_get(url.path) do |resp|
|
19
|
+
resp.read_body {|segment| download_file.write(segment)}
|
19
20
|
end
|
21
|
+
ensure
|
22
|
+
download_file.close
|
20
23
|
end
|
24
|
+
|
21
25
|
when Net::HTTPRedirection then
|
22
26
|
location = response['location']
|
23
27
|
puts "Redirected to #{location}"
|
24
|
-
fetch(location, limit - 1)
|
28
|
+
fetch(location, version, limit - 1)
|
25
29
|
else
|
26
|
-
puts "Failed to download dtach
|
30
|
+
puts "Failed to download dtach-#{version}.tar.gz file. Response code: #{response.value}"
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
30
34
|
Execute.define_task do
|
31
35
|
desc 'dtach-install', 'Install dtach program from sources'
|
32
36
|
def dtach_install
|
37
|
+
version = '0.9'
|
33
38
|
dtach_about
|
34
39
|
|
35
40
|
unless windows?
|
36
41
|
Dir.chdir('/tmp/')
|
37
|
-
system "rm /tmp/dtach
|
38
|
-
system "rm -rf /tmp/dtach
|
42
|
+
system "rm /tmp/dtach-#{version}.tar.gz" if File.exists?("/tmp/dtach-#{version}.tar.gz")
|
43
|
+
system "rm -rf /tmp/dtach-#{version}" if File.directory?("/tmp/dtach-#{version}")
|
39
44
|
|
40
|
-
uri_str = "
|
41
|
-
fetch(uri_str, limit = 10)
|
45
|
+
uri_str = "https://sourceforge.net/projects/dtach/files/dtach/#{version}/dtach-#{version}.tar.gz"
|
46
|
+
fetch(uri_str, version, limit = 10)
|
42
47
|
|
43
|
-
raise "Failed to download dtach
|
48
|
+
raise "Failed to download dtach-#{version}.tar.gz file." unless File.exists?("dtach-#{version}.tar.gz") && File.stat("dtach-#{version}.tar.gz").size != 0
|
44
49
|
|
45
|
-
system(
|
46
|
-
Dir.chdir(
|
47
|
-
system
|
50
|
+
system("tar xzf dtach-#{version}.tar.gz")
|
51
|
+
Dir.chdir("/tmp/dtach-#{version}/")
|
52
|
+
system "cd /tmp/dtach-#{version}/ && ./configure && make"
|
48
53
|
|
49
54
|
ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = "#{RedisRunner.prefix}bin"
|
50
55
|
mkdir_p(bin_dir) unless File.exists?(bin_dir)
|
51
|
-
system "sudo cp /tmp/dtach
|
56
|
+
system "sudo cp /tmp/dtach-#{version}/dtach #{bin_dir}"
|
52
57
|
|
53
|
-
system "rm /tmp/dtach
|
54
|
-
system "rm -rf /tmp/dtach
|
58
|
+
system "rm /tmp/dtach-#{version}.tar.gz"
|
59
|
+
system "rm -rf /tmp/dtach-#{version}"
|
55
60
|
puts "Dtach successfully installed to #{bin_dir}"
|
56
61
|
end
|
57
62
|
end
|
58
|
-
end
|
63
|
+
end
|
@@ -19,6 +19,7 @@ Execute.define_task do
|
|
19
19
|
settings = config(options[:config])
|
20
20
|
|
21
21
|
port = (params[:port]) ? params[:port] : URI.parse(settings[:syncserver]).port
|
22
|
+
host = (params[:host]) ? params[:host] : URI.parse(settings[:syncserver]).host
|
22
23
|
|
23
24
|
redis_url = (params[:redis]) ? params[:redis] : settings[:redis]
|
24
25
|
redis_url = [redis_url] if redis_url.is_a?(String)
|
@@ -63,17 +64,17 @@ Execute.define_task do
|
|
63
64
|
|
64
65
|
if jruby?
|
65
66
|
puts 'Starting rhoconnect in jruby environment...'
|
66
|
-
system(env, "#{command} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
67
|
+
system(env, "#{command} --host #{host} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
67
68
|
elsif windows?
|
68
69
|
puts 'Starting rhoconnect...'
|
69
|
-
system(env, "#{command} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
70
|
+
system(env, "#{command} --host #{host} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
70
71
|
else
|
71
72
|
if dtach_installed?
|
72
73
|
puts 'Detach with Ctrl+\ Re-attach with rhoconnect attach'
|
73
74
|
sleep 2
|
74
|
-
system(env, "dtach -A #{rhoconnect_socket} #{command} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
75
|
+
system(env, "dtach -A #{rhoconnect_socket} #{command} --host #{host} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
75
76
|
else
|
76
|
-
system(env, "#{command} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
77
|
+
system(env, "#{command} --host #{host} --port #{port} -P #{rhoconnect_pid} #{rackup_config}")
|
77
78
|
end
|
78
79
|
end
|
79
80
|
end
|
@@ -37,7 +37,7 @@ module Rhoconnect
|
|
37
37
|
invalid_meta[index] ||= {}
|
38
38
|
invalid_meta[index][source_id] ||= {}
|
39
39
|
invalid_meta[index][source_id][objindex] ||= {}
|
40
|
-
invalid_meta[index][source_id][objindex][:error] = "Error during #{operation}: object
|
40
|
+
invalid_meta[index][source_id][objindex][:error] = "Error during #{operation}: object conflict detected"
|
41
41
|
else
|
42
42
|
invalid_meta[index] ||= {}
|
43
43
|
invalid_meta[index][source_id] ||= {}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'google/apis/messages'
|
2
|
+
|
3
|
+
# https://firebase.google.com/docs/cloud-messaging/auth-server
|
4
|
+
# https://github.com/oniksfly/google-api-fcm
|
5
|
+
|
6
|
+
module Rhoconnect
|
7
|
+
class Fcm
|
8
|
+
class InvalidProjectId < Exception; end
|
9
|
+
class InvalidPackageName < Exception; end
|
10
|
+
class FCMPingError < Exception; end
|
11
|
+
|
12
|
+
def self.ping(params)
|
13
|
+
begin
|
14
|
+
fcm_project_id = Rhoconnect.settings[:fcm_project_id]
|
15
|
+
raise InvalidProjectId.new("Missing `:fcm_project_id:` option in settings/settings.yml") unless fcm_project_id
|
16
|
+
|
17
|
+
package_name = Rhoconnect.settings[:package_name]
|
18
|
+
raise InvalidPackageName.new("Missing `:package_name:` option in settings/settings.yml") unless package_name
|
19
|
+
|
20
|
+
send_ping_to_device(fcm_project_id, package_name, params)
|
21
|
+
rescue InvalidProjectId => error
|
22
|
+
log error
|
23
|
+
log error.backtrace.join("\n")
|
24
|
+
raise error
|
25
|
+
rescue InvalidPackageName => error
|
26
|
+
log error
|
27
|
+
log error.backtrace.join("\n")
|
28
|
+
raise error
|
29
|
+
rescue Exception => error
|
30
|
+
log error
|
31
|
+
log error.backtrace.join("\n")
|
32
|
+
raise error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.send_ping_to_device(project_id,package_name,params)
|
37
|
+
|
38
|
+
scope = Google::Apis::Messages::AUTH_MESSAGES
|
39
|
+
authorization = Google::Auth.get_application_default(scope)
|
40
|
+
|
41
|
+
service = Google::Apis::Messages::MessagesService.new(project_id: project_id)
|
42
|
+
service.authorization = authorization
|
43
|
+
|
44
|
+
service.notify(fcm_message(package_name,params))
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.fcm_message(package_name,params)
|
49
|
+
params.reject! {|k,v| v.nil? || v.length == 0}
|
50
|
+
data = {}
|
51
|
+
data['do_sync'] = params['sources'] ? params['sources'].join(',') : ''
|
52
|
+
data['alert'] = params['message'] if params['message']
|
53
|
+
data['vibrate'] = params['vibrate'] if params['vibrate']
|
54
|
+
data['sound'] = params['sound'] if params['sound']
|
55
|
+
data['phone_id'] = params['phone_id'] if params['phone_id']
|
56
|
+
|
57
|
+
android = {}
|
58
|
+
android['collapse_key'] = (rand * 100000000).to_i.to_s
|
59
|
+
android['priority'] = 'high'
|
60
|
+
android['restricted_package_name'] = package_name
|
61
|
+
android['data'] = data
|
62
|
+
android['notification'] = {}
|
63
|
+
# android['notification']['title'] = 'Test message'
|
64
|
+
android['notification']['body'] = params['message']
|
65
|
+
|
66
|
+
message = Google::Apis::Messages::Message.new(
|
67
|
+
token: params['device_pin'].to_s,
|
68
|
+
android: android
|
69
|
+
)
|
70
|
+
|
71
|
+
message
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|