rhoconnect 3.3.6 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. data/CHANGELOG.md +40 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +27 -25
  4. data/bench/benchapp/Gemfile +7 -27
  5. data/bench/benchapp/config.ru +9 -31
  6. data/bench/blobapp/Gemfile +7 -27
  7. data/bench/blobapp/config.ru +9 -29
  8. data/bench/lib/bench.rb +8 -1
  9. data/bench/lib/bench/test_data.rb +4 -1
  10. data/bench/scripts/blob_cud_script.rb +4 -0
  11. data/bench/scripts/cud_script.rb +7 -1
  12. data/bench/scripts/helpers.rb +1 -1
  13. data/bench/scripts/test_query_script.rb +20 -7
  14. data/bench/spec/bench_spec_helper.rb +3 -1
  15. data/bin/rhoconnect +22 -12
  16. data/commands/{commands/dtach_commands → dtach}/dtach_about.rb +0 -0
  17. data/commands/{commands/dtach_commands → dtach}/dtach_install.rb +0 -0
  18. data/commands/{commands/redis_commands → dtach}/redis_attach.rb +0 -0
  19. data/commands/execute.rb +14 -15
  20. data/commands/generators/update.rb +26 -0
  21. data/commands/{commands/redis_commands → redis}/redis_about.rb +0 -0
  22. data/commands/redis/redis_download.rb +13 -0
  23. data/commands/redis/redis_install.rb +26 -0
  24. data/commands/{commands/redis_commands → redis}/redis_make.rb +0 -0
  25. data/commands/{commands/redis_commands → redis}/redis_restart.rb +3 -2
  26. data/commands/{commands/redis_commands → redis}/redis_start.rb +0 -0
  27. data/commands/{commands/redis_commands → redis}/redis_startbg.rb +0 -0
  28. data/commands/{commands/redis_commands → redis}/redis_stop.rb +3 -2
  29. data/commands/{commands/rhoconnect → rhoconnect}/clean_start.rb +0 -0
  30. data/commands/{commands/rhoconnect → rhoconnect}/config.rb +7 -2
  31. data/commands/{commands/rhoconnect → rhoconnect}/create_user.rb +0 -0
  32. data/commands/{commands/rhoconnect → rhoconnect}/delete_device.rb +0 -0
  33. data/commands/{commands/rhoconnect → rhoconnect}/delete_user.rb +0 -0
  34. data/commands/{commands/rhoconnect → rhoconnect}/flushdb.rb +4 -4
  35. data/commands/{commands/rhoconnect → rhoconnect}/get_token.rb +0 -0
  36. data/commands/{commands/rhoconnect → rhoconnect}/reset.rb +0 -0
  37. data/commands/{commands/rhoconnect → rhoconnect}/reset_refresh.rb +0 -0
  38. data/commands/{commands/rhoconnect → rhoconnect}/restart.rb +0 -0
  39. data/commands/{commands/rhoconnect → rhoconnect}/secret.rb +0 -0
  40. data/commands/{commands/rhoconnect → rhoconnect}/set_admin_password.rb +0 -0
  41. data/commands/{commands/rhoconnect → rhoconnect}/spec.rb +0 -0
  42. data/commands/rhoconnect/start.rb +27 -0
  43. data/commands/{commands/rhoconnect → rhoconnect}/startbg.rb +0 -0
  44. data/commands/{commands/rhoconnect → rhoconnect}/startdebug.rb +2 -2
  45. data/commands/{commands/rhoconnect → rhoconnect}/stop.rb +3 -4
  46. data/commands/{commands/rhoconnect → rhoconnect}/version.rb +0 -0
  47. data/commands/{commands/rhoconnect → rhoconnect}/web.rb +0 -0
  48. data/commands/rhoconnect_attach/attach.rb +10 -0
  49. data/commands/rhoconnect_console/console.rb +16 -0
  50. data/commands/{commands/rhoconnect → rhoconnect_console}/console_helper.rb +0 -0
  51. data/commands/{commands/rhoconnect → rhoconnect_war}/war.rb +0 -0
  52. data/commands/{commands/redis_commands → utilities}/redis_runner.rb +22 -19
  53. data/commands/utilities/utilities.rb +6 -0
  54. data/doc/benchmarks.txt +2 -2
  55. data/doc/bulk-sync.txt +12 -1
  56. data/doc/client-java.txt +3 -3
  57. data/doc/client-objc.txt +1 -1
  58. data/doc/client.txt +5 -5
  59. data/doc/command-line.txt +80 -135
  60. data/doc/deploying.txt +119 -12
  61. data/doc/extending-rhoconnect-server.txt +1 -1
  62. data/doc/heroku-addon.txt +119 -23
  63. data/doc/install.txt +101 -39
  64. data/doc/java-plugin.txt +2 -2
  65. data/doc/licensing.txt +1 -1
  66. data/doc/plugin-intro.txt +3 -1
  67. data/doc/preparing-production.txt +4 -4
  68. data/doc/public/cli.txt +2 -2
  69. data/doc/push-backend-setup.txt +11 -1
  70. data/doc/push-client-setup.txt +72 -2
  71. data/doc/push-server-setup.txt +129 -8
  72. data/doc/rails-plugin.txt +245 -40
  73. data/doc/rest-api.txt +10 -6
  74. data/doc/rhoconnect-calculator.txt +237 -0
  75. data/doc/rhoconnect-redis-stack.txt +35 -0
  76. data/doc/session-and-configuration.txt +24 -0
  77. data/doc/settings.txt +51 -41
  78. data/doc/source-adapters.txt +45 -45
  79. data/doc/stats-middleware.txt +2 -2
  80. data/doc/supported-platforms.txt +6 -6
  81. data/doc/testing.txt +2 -2
  82. data/doc/tutorial.txt +63 -63
  83. data/examples/simple/Gemfile +7 -35
  84. data/examples/simple/config.ru +8 -26
  85. data/examples/simple/sources/product.rb +6 -6
  86. data/generators/rhoconnect.rb +5 -0
  87. data/generators/templates/application/Gemfile +7 -37
  88. data/generators/templates/application/Rakefile +8 -0
  89. data/generators/templates/application/config.ru +12 -31
  90. data/generators/templates/application/rcgemfile +44 -0
  91. data/generators/templates/application/settings/settings.yml +7 -5
  92. data/install.sh +4 -4
  93. data/installer/unix-like/create_texts.rb +7 -2
  94. data/installer/unix-like/rho_connect_install_constants.rb +2 -2
  95. data/installer/unix-like/rho_connect_install_installers.rb +1 -16
  96. data/lib/rhoconnect.rb +51 -38
  97. data/lib/rhoconnect/api/app/query.rb +4 -1
  98. data/lib/rhoconnect/api/app/search.rb +4 -1
  99. data/lib/rhoconnect/api/client/list_client_docs.rb +3 -1
  100. data/lib/rhoconnect/api/user/ping.rb +1 -5
  101. data/lib/rhoconnect/application/init.rb +43 -0
  102. data/lib/rhoconnect/async.rb +11 -6
  103. data/lib/rhoconnect/client_sync.rb +30 -37
  104. data/lib/rhoconnect/document.rb +4 -0
  105. data/lib/rhoconnect/graph_helper.rb +74 -56
  106. data/lib/rhoconnect/middleware/helpers.rb +4 -0
  107. data/lib/rhoconnect/ping.rb +1 -0
  108. data/lib/rhoconnect/ping/gcm.rb +58 -0
  109. data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +7 -1
  110. data/lib/rhoconnect/source.rb +70 -56
  111. data/lib/rhoconnect/source_sync.rb +33 -5
  112. data/lib/rhoconnect/store.rb +358 -110
  113. data/lib/rhoconnect/user.rb +8 -0
  114. data/lib/rhoconnect/utilities.rb +16 -14
  115. data/lib/rhoconnect/version.rb +1 -1
  116. data/lib/rhoconnect/web-console/models/client.js +1 -1
  117. data/lib/rhoconnect/web-console/public/UNVR67bold.ttf +0 -0
  118. data/lib/rhoconnect/web-console/public/bootstrap.css +6 -0
  119. data/lib/rhoconnect/web-console/public/logo.png +0 -0
  120. data/lib/rhoconnect/web-console/server.rb +13 -11
  121. data/lib/rhoconnect/web-console/templates/index.erb +5 -5
  122. data/lib/rhoconnect/web-console/templates/jqplot.erb +1 -0
  123. data/lib/rhoconnect/web-console/views/doc.js +0 -4
  124. data/lib/rhoconnect/web-console/views/home.js +2 -1
  125. data/lib/rhoconnect/web-console/views/new_ping.js +11 -6
  126. data/lib/rhoconnect/web-console/views/stats.js +9 -5
  127. data/rhoconnect.gemspec +6 -4
  128. data/spec/api/app/fast_update_spec.rb +2 -2
  129. data/spec/api/source/get_source_params_spec.rb +1 -0
  130. data/spec/apps/rhotestapp/settings/settings.yml +5 -5
  131. data/spec/client_sync_spec.rb +3 -14
  132. data/spec/perf/perf_spec_helper.rb +11 -7
  133. data/spec/perf/store_perf_spec.rb +88 -11
  134. data/spec/ping/gcm_spec.rb +99 -0
  135. data/spec/server/server_spec.rb +7 -0
  136. data/spec/server/stats_spec.rb +9 -2
  137. data/spec/source_sync_spec.rb +29 -0
  138. data/spec/spec_helper.rb +40 -38
  139. data/spec/stats/record_spec.rb +18 -9
  140. data/spec/store_spec.rb +128 -19
  141. data/spec/testdata/10000-data.txt +0 -0
  142. data/spec/testdata/5-data.txt +0 -0
  143. data/spec/testdata/5000-data.txt +0 -0
  144. data/tasks/jasmine.rake +1 -0
  145. data/tasks/redis.rake +16 -13
  146. metadata +71 -39
  147. data/commands/commands/redis_commands/redis_download.rb +0 -33
  148. data/commands/commands/redis_commands/redis_install.rb +0 -26
  149. data/commands/commands/rhoconnect/attach.rb +0 -8
  150. data/commands/commands/rhoconnect/console.rb +0 -15
  151. data/commands/commands/rhoconnect/start.rb +0 -18
  152. data/commands/utilities/dtach_installed.rb +0 -10
@@ -15,8 +15,8 @@ describe "Record" do
15
15
  end
16
16
 
17
17
  it "should add metric to the record and trim record size" do
18
- Time.stub!(:now).and_return { @now += 1; @now }
19
- 10.times { Rhoconnect::Stats::Record.add('foo') }
18
+ Time.stub!(:now).and_return { @now }
19
+ 10.times { @now += 1; Rhoconnect::Stats::Record.add('foo') }
20
20
  Store.db.zrange('stat:foo', 0, -1).should == ["2:12", "2:14", "2:16", "2:18"]
21
21
  end
22
22
 
@@ -48,9 +48,10 @@ describe "Record" do
48
48
  end
49
49
 
50
50
  it "should add absolute metric value" do
51
- Time.stub!(:now).and_return { @now += 1; @now }
51
+ Time.stub!(:now).and_return { @now }
52
52
  time = 0
53
53
  4.times do
54
+ @now += 1
54
55
  Rhoconnect::Stats::Record.save_average('foo',time)
55
56
  time += 1
56
57
  end
@@ -59,10 +60,18 @@ describe "Record" do
59
60
 
60
61
  it "should update metric" do
61
62
  Rhoconnect.stats = true
62
- Time.stub!(:now).and_return { @now += 1; @now }
63
+ @incr = 0
64
+ Time.stub!(:now).and_return do
65
+ if @incr > 0
66
+ @now += 1
67
+ @incr -= 1
68
+ end
69
+ @now
70
+ end
63
71
  4.times do
72
+ @now += 1
64
73
  Rhoconnect::Stats::Record.update('foo') do
65
- # something interesting
74
+ @incr = 2
66
75
  end
67
76
  end
68
77
  Store.db.zrange('stat:foo', 0, -1).should == ["1,1.0:14", "1,1.0:18", "1,1.0:20"]
@@ -70,14 +79,14 @@ describe "Record" do
70
79
  end
71
80
 
72
81
  it "should get range of metric values" do
73
- Time.stub!(:now).and_return { @now += 1; @now }
74
- 10.times { Rhoconnect::Stats::Record.add('foo') }
82
+ Time.stub!(:now).and_return { @now }
83
+ 10.times { @now += 1; Rhoconnect::Stats::Record.add('foo') }
75
84
  Rhoconnect::Stats::Record.range('foo', 0, 1).should == ["2:12", "2:14"]
76
85
  end
77
86
 
78
87
  it "should reset metric" do
79
- Time.stub!(:now).and_return { @now += 1; @now }
80
- 10.times { Rhoconnect::Stats::Record.add('foo') }
88
+ Time.stub!(:now).and_return { @now }
89
+ 10.times { @now += 1; Rhoconnect::Stats::Record.add('foo') }
81
90
  Store.db.zrange('stat:foo', 0, -1).should == ["2:12", "2:14", "2:16", "2:18"]
82
91
  Rhoconnect::Stats::Record.reset('foo')
83
92
  Store.db.zrange('stat:foo', 0, -1).should == []
data/spec/store_spec.rb CHANGED
@@ -4,7 +4,11 @@ describe "Store" do
4
4
  it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
5
5
  describe "store methods" do
6
6
  it "should create db class method" do
7
- Store.db.class.name.should match(/Redis/)
7
+ if RUBY_VERSION =~ /1.9/
8
+ Store.db.class.name.should match(/ConnectionPool/)
9
+ else
10
+ Store.db.class.name.should match(/Redis/)
11
+ end
8
12
  end
9
13
 
10
14
  it "should set redis connection" do
@@ -16,7 +20,11 @@ describe "Store" do
16
20
 
17
21
  it "should create default redis connection" do
18
22
  Store.db = nil
19
- Store.db.class.name.should match(/Redis/)
23
+ if RUBY_VERSION =~ /1.9/
24
+ Store.db.class.name.should match(/ConnectionPool/)
25
+ else
26
+ Store.db.class.name.should match(/Redis/)
27
+ end
20
28
  end
21
29
 
22
30
  it "should assign redis to existing redis" do
@@ -26,7 +34,11 @@ describe "Store" do
26
34
 
27
35
  it "should create redis connection based on ENV" do
28
36
  ENV[REDIS_URL] = 'redis://localhost:6379'
29
- Redis.should_receive(:connect).with(:url => 'redis://localhost:6379').and_return { Redis.new }
37
+ if RUBY_VERSION =~ /1.9/
38
+ Redis.should_receive(:connect).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).exactly(5).times.and_return { Redis.new }
39
+ else
40
+ Redis.should_receive(:connect).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).and_return { Redis.new }
41
+ end
30
42
  Store.db = nil
31
43
  Store.db.should_not == nil
32
44
  ENV.delete(REDIS_URL)
@@ -34,7 +46,11 @@ describe "Store" do
34
46
 
35
47
  it "should create redis connection based on REDISTOGO_URL ENV" do
36
48
  ENV[REDISTOGO_URL] = 'redis://localhost:6379'
37
- Redis.should_receive(:connect).with(:url => 'redis://localhost:6379').and_return { Redis.new }
49
+ if RUBY_VERSION =~ /1.9/
50
+ Redis.should_receive(:connect).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).exactly(5).times.and_return { Redis.new }
51
+ else
52
+ Redis.should_receive(:connect).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).and_return { Redis.new }
53
+ end
38
54
  Store.db = nil
39
55
  Store.db.should_not == nil
40
56
  ENV.delete(REDISTOGO_URL)
@@ -72,7 +88,7 @@ describe "Store" do
72
88
  '2' => {'whole_new_object' => 'new_value' } }
73
89
  Store.put_data('mydata', data)
74
90
  Store.db.should_receive(:srem).exactly(1).times
75
- Store.db.should_receive(:sadd).exactly(3).times
91
+ Store.db.should_receive(:sadd).exactly(2).times
76
92
  Store.update_objects('mydata', update_data)
77
93
  end
78
94
 
@@ -86,7 +102,7 @@ describe "Store" do
86
102
  it "should delete_objects with simple data and verify that srem is called only on affected fields" do
87
103
  data = { '1' => { 'hello' => 'world', "attr1" => 'value1' } }
88
104
  Store.put_data('mydata', data)
89
- Store.db.should_receive(:srem).exactly(2).times
105
+ Store.db.should_receive(:srem).exactly(1).times
90
106
  Store.db.should_receive(:sadd).exactly(0).times
91
107
  Store.delete_objects('mydata', ['1'])
92
108
  end
@@ -124,12 +140,14 @@ describe "Store" do
124
140
  Store.decr('foo').should == 9
125
141
  end
126
142
 
127
- it "should return attributes modified in doc2" do
143
+ it "should return modified objs in doc2" do
128
144
  Store.put_data(@s.docname(:md),@data).should == true
129
145
  Store.get_data(@s.docname(:md)).should == @data
130
146
 
131
147
  @product3['price'] = '59.99'
132
- expected = { '3' => { 'price' => '59.99' } }
148
+ elem_3 = Store.send(:set_obj_element, '3', @product3)
149
+ keypairs_3 = Store.send(:get_obj_key_and_pairs, elem_3)
150
+ expected = {elem_3 => keypairs_3}
133
151
  @data1,@data1['1'],@data1['2'],@data1['3'] = {},@product1,@product2,@product3
134
152
 
135
153
  Store.put_data(@c.docname(:cd),@data1)
@@ -137,13 +155,18 @@ describe "Store" do
137
155
  Store.get_diff_data(@s.docname(:md),@c.docname(:cd)).should == expected
138
156
  end
139
157
 
140
- it "should return attributes modified and missed in doc2" do
158
+ it "should return objects with attributes modified and missed in doc2" do
141
159
  Store.put_data(@s.docname(:md),@data).should == true
142
160
  Store.get_data(@s.docname(:md)).should == @data
143
161
 
144
- @product2['price'] = '59.99'
145
- expected = { '2' => { 'price' => '99.99' },'3' => @product3 }
146
- @data1,@data1['1'],@data1['2'] = {},@product1,@product2
162
+ mod_product2 = @product2.dup
163
+ mod_product2['price'] = '59.99'
164
+ elem_2 = Store.send(:set_obj_element, '2', @data['2'])
165
+ elem_3 = Store.send(:set_obj_element, '3', @product3)
166
+ keypairs_2 = Store.send(:get_obj_key_and_pairs, elem_2)
167
+ keypairs_3 = Store.send(:get_obj_key_and_pairs, elem_3)
168
+ expected = {elem_2 => keypairs_2, elem_3 => keypairs_3}
169
+ @data1,@data1['1'],@data1['2'] = {},@product1,mod_product2
147
170
 
148
171
  Store.put_data(@c.docname(:cd),@data1)
149
172
  Store.get_data(@c.docname(:cd)).should == @data1
@@ -223,12 +246,6 @@ describe "Store" do
223
246
  keys.should == [assoc_key,assoc_key]
224
247
  end
225
248
 
226
- it "should return empty list on non-existing get_zdata" do
227
- zdata,keys = Store.get_zdata('wrong_doc2')
228
- zdata.should == []
229
- keys.should == []
230
- end
231
-
232
249
  it "should flush_zdata" do
233
250
  create_doc = {'1' => {'foo' => 'bar'}}
234
251
  assoc_key = 'my_assoc_key'
@@ -240,6 +257,98 @@ describe "Store" do
240
257
  zdocs = Store.get_data('doc1:1:my_assoc_key:1')
241
258
  zdocs.should == {}
242
259
  end
260
+
261
+ it "should put_multi_zdata and get_multi_zdata for transaction's queue" do
262
+ create_doc = {'1' => {'foo' => 'bar'}}
263
+ update_doc = {'2' => {'foo1' => 'bar1'}}
264
+ delete_doc = {'3' => {'foo2' => 'bar2'}}
265
+ sources_doc = {'source1' => {'create' => create_doc,
266
+ 'delete' => delete_doc}}
267
+ sources_doc['source2'] = {'update' => update_doc}
268
+ sources = ['source2', 'source1']
269
+ assoc_key = 'my_assoc_key'
270
+ Store.put_multi_zdata('transactions',assoc_key,sources,sources_doc)
271
+ zdata,ordered_sources,keys = Store.get_multi_zdata('transactions')
272
+ zdata.should == [sources_doc]
273
+ ordered_sources.should == [sources]
274
+ keys.should == [assoc_key]
275
+ end
276
+
277
+ it "should return empty list on non-existing get_multi_zdata" do
278
+ zdata,ordered_sources,keys = Store.get_multi_zdata('wrong_doc2')
279
+ zdata.should == []
280
+ ordered_sources.should == []
281
+ keys.should == []
282
+ end
283
+
284
+ it "should append duplicate data in put_multi_zdata" do
285
+ create_doc = {'1' => {'foo' => 'bar'}}
286
+ update_doc = {'2' => {'foo1' => 'bar1'}}
287
+ delete_doc = {'3' => {'foo2' => 'bar2'}}
288
+ sources_doc = {'source1' => {'create' => create_doc,
289
+ 'delete' => delete_doc}}
290
+ sources_doc['source2'] = {'update' => update_doc}
291
+ sources1 = ['source2', 'source1']
292
+ sources2 = ['source1', 'source2']
293
+ assoc_key = 'my_assoc_key'
294
+ Store.put_multi_zdata('doc1',assoc_key,sources1,sources_doc)
295
+ Store.put_multi_zdata('doc1',assoc_key,sources2,sources_doc, true)
296
+ zdata,ordered_sources,keys = Store.get_multi_zdata('doc1')
297
+ zdata.should == [sources_doc,sources_doc]
298
+ ordered_sources.should == [sources1, sources2]
299
+ keys.should == [assoc_key,assoc_key]
300
+ end
301
+
302
+ it "should flush_multi_zdata and all its related documents" do
303
+ create_doc = {'1' => {'foo' => 'bar'}}
304
+ update_doc = {'2' => {'foo1' => 'bar1'}}
305
+ delete_doc = {'3' => {'foo2' => 'bar2'}}
306
+ sources_doc = {'source1' => {'create' => create_doc,
307
+ 'delete' => delete_doc}}
308
+ sources_doc['source2'] = {'update' => update_doc}
309
+ sources1 = ['source2', 'source1']
310
+ sources2 = ['source1', 'source2']
311
+ assoc_key = 'my_assoc_key'
312
+ Store.put_multi_zdata('doc1',assoc_key,sources1,sources_doc)
313
+ Store.put_multi_zdata('doc1',assoc_key,sources2,sources_doc,true)
314
+ zsources1 = Store.get_data('doc1:1:my_assoc_key:sources',Array)
315
+ zsources1.should == sources1
316
+ zsources2 = Store.get_data('doc1:2:my_assoc_key:sources',Array)
317
+ zsources2.should == sources2
318
+ zdata_create1 = Store.get_data('doc1:1,my_assoc_key:source1:create')
319
+ zdata_create1.should == create_doc
320
+ zdata_update1 = Store.get_data('doc1:1,my_assoc_key:source2:update')
321
+ zdata_update1.should == update_doc
322
+ zdata_delete1 = Store.get_data('doc1:1,my_assoc_key:source1:delete')
323
+ zdata_delete1.should == delete_doc
324
+ zdata_create2 = Store.get_data('doc1:2,my_assoc_key:source1:create')
325
+ zdata_create2.should == create_doc
326
+ zdata_update2 = Store.get_data('doc1:2,my_assoc_key:source2:update')
327
+ zdata_update2.should == update_doc
328
+ zdata_delete2 = Store.get_data('doc1:2,my_assoc_key:source1:delete')
329
+ zdata_delete2.should == delete_doc
330
+ Store.flush_multi_zdata('doc1')
331
+ zdata,ordered_sources,keys = Store.get_multi_zdata('doc1')
332
+ zdata.should == []
333
+ ordered_sources.should == []
334
+ keys.should == []
335
+ zsources1 = Store.get_data('doc1:1:my_assoc_key:sources',Array)
336
+ zsources1.should == []
337
+ zsources2 = Store.get_data('doc1:2:my_assoc_key:sources',Array)
338
+ zsources2.should == []
339
+ zdata_create1 = Store.get_data('doc1:1,my_assoc_key:source1:create')
340
+ zdata_create1.should == {}
341
+ zdata_update1 = Store.get_data('doc1:1,my_assoc_key:source2:update')
342
+ zdata_update1.should == {}
343
+ zdata_delete1 = Store.get_data('doc1:1,my_assoc_key:source1:delete')
344
+ zdata_delete1.should == {}
345
+ zdata_create2 = Store.get_data('doc1:2,my_assoc_key:source1:create')
346
+ zdata_create2.should == {}
347
+ zdata_update2 = Store.get_data('doc1:2,my_assoc_key:source2:update')
348
+ zdata_update2.should == {}
349
+ zdata_delete2 = Store.get_data('doc1:2,my_assoc_key:source1:delete')
350
+ zdata_delete2.should == {}
351
+ end
243
352
 
244
353
  if defined?(JRUBY_VERSION)
245
354
  it "should lock document" do
@@ -311,7 +420,7 @@ describe "Store" do
311
420
  doc = "locked_data"
312
421
  Rhoconnect.lock_duration = 2
313
422
  Store.get_lock(doc)
314
- Store.should_receive(:sleep).exactly(3).times.with(1).and_return { sleep 1 }
423
+ Store.should_receive(:sleep).at_least(1).times.with(1).and_return { sleep 1 }
315
424
  Store.get_lock(doc)
316
425
  Rhoconnect.lock_duration = nil
317
426
  end
Binary file
Binary file
Binary file
data/tasks/jasmine.rake CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'jasmine-headless-webkit'
2
+ load 'jasmine/tasks/jasmine.rake'
2
3
 
3
4
  Jasmine::Headless::Task.new('jasmine:headless') do |t|
4
5
  t.colors = true
data/tasks/redis.rake CHANGED
@@ -1,13 +1,15 @@
1
1
  # Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master
2
2
  require 'fileutils'
3
3
  require 'open-uri'
4
+ require 'rbconfig'
4
5
 
5
6
  include Rake::DSL
6
7
 
7
8
  REDIS_RELEASE = "2.4.10"
8
9
 
10
+ # See: http://rbjl.net/35-how-to-properly-check-for-your-ruby-interpreter-version-and-os
9
11
  def windows?
10
- RUBY_PLATFORM =~ /(win|w)32$/
12
+ RbConfig::CONFIG['host_os'] =~ /(win|w)32$/
11
13
  end
12
14
 
13
15
  if windows?
@@ -16,6 +18,7 @@ if windows?
16
18
  $redis_dest = "C:/"
17
19
  end
18
20
 
21
+
19
22
  def redis_home
20
23
  ENV['REDIS_HOME'] || File.join($redis_dest,$redis_ver)
21
24
  end
@@ -28,9 +31,9 @@ def mk_bin_dir(bin_dir)
28
31
  exit 1
29
32
  end
30
33
  end
31
-
34
+
32
35
  class RedisRunner
33
-
36
+
34
37
  def self.prefix
35
38
  "/usr/local/"
36
39
  end
@@ -61,7 +64,7 @@ class RedisRunner
61
64
  if windows?
62
65
  puts "Starting redis in a new window..."
63
66
  sh "start #{File.join(redis_home,'redis-server')} #{File.join(redis_home,'redis.conf')}" rescue
64
- "redis-server not installed on your path, please run 'rake redis:install' first."
67
+ "redis-server not installed on your path, please install redis."
65
68
  elsif defined?(JRUBY_VERSION)
66
69
  puts "Starting redis ..."
67
70
  sh "redis-server #{redisconfdir}"
@@ -72,13 +75,13 @@ class RedisRunner
72
75
  sh command
73
76
  end
74
77
  end
75
-
78
+
76
79
  # this function is used with Rhostudio where there is no terminal
77
80
  def self.startbg
78
81
  if windows?
79
82
  puts "Starting redis in a new window..."
80
83
  sh "start #{File.join(redis_home,'redis-server')} #{File.join(redis_home,'redis.conf')}" rescue
81
- "redis-server not installed on your path, please run 'rake redis:install' first."
84
+ "redis-server not installed on your path, please install redis."
82
85
  else
83
86
  puts "Starting redis ..."
84
87
  system("redis-server #{redisconfdir} &")
@@ -106,7 +109,7 @@ namespace :redis do
106
109
  task :start do
107
110
  RedisRunner.start
108
111
  end
109
-
112
+
110
113
  # desc 'Start redis' without dtach - for Rhostudio (internal)
111
114
  task :startbg do
112
115
  RedisRunner.startbg
@@ -132,15 +135,15 @@ namespace :redis do
132
135
  task :install => [:about, :download, :make] do
133
136
  unless windows?
134
137
  ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = "#{RedisRunner.prefix}bin"
135
-
138
+
136
139
  mk_bin_dir(bin_dir)
137
-
140
+
138
141
  %w(redis-benchmark redis-cli redis-server).each do |bin|
139
142
  sh "cp /tmp/redis/src/#{bin} #{bin_dir}"
140
143
  end
141
-
144
+
142
145
  puts "Installed redis-benchmark, redis-cli and redis-server to #{bin_dir}"
143
-
146
+
144
147
  ENV['PREFIX'] and conf_dir = "#{ENV['PREFIX']}/etc" or conf_dir = "#{RedisRunner.prefix}etc"
145
148
  unless File.exists?("#{conf_dir}/redis.conf")
146
149
  sh "mkdir #{conf_dir}" unless File.exists?("#{conf_dir}")
@@ -214,9 +217,9 @@ namespace :dtach do
214
217
  end
215
218
 
216
219
  ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = "#{RedisRunner.prefix}bin"
217
-
220
+
218
221
  mk_bin_dir(bin_dir)
219
-
222
+
220
223
  Dir.chdir('/tmp/dtach-0.8/')
221
224
  sh 'cd /tmp/dtach-0.8/ && ./configure && make'
222
225
  sh "cp /tmp/dtach-0.8/dtach #{bin_dir}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhoconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.6
4
+ version: 3.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-05 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: 2.1.1
110
+ - !ruby/object:Gem::Dependency
111
+ name: connection_pool
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.9.2
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 0.9.2
110
126
  - !ruby/object:Gem::Dependency
111
127
  name: redis
112
128
  requirement: !ruby/object:Gem::Requirement
@@ -279,45 +295,47 @@ files:
279
295
  - bench/bench
280
296
  - bench/run_bench.sh
281
297
  - bench/run_query_md_script.sh
282
- - commands/utilities/dtach_installed.rb
298
+ - commands/rhoconnect/delete_user.rb
299
+ - commands/rhoconnect/secret.rb
300
+ - commands/rhoconnect/delete_device.rb
301
+ - commands/rhoconnect/restart.rb
302
+ - commands/rhoconnect/config.rb
303
+ - commands/rhoconnect/reset.rb
304
+ - commands/rhoconnect/create_user.rb
305
+ - commands/rhoconnect/web.rb
306
+ - commands/rhoconnect/spec.rb
307
+ - commands/rhoconnect/clean_start.rb
308
+ - commands/rhoconnect/set_admin_password.rb
309
+ - commands/rhoconnect/reset_refresh.rb
310
+ - commands/rhoconnect/startbg.rb
311
+ - commands/rhoconnect/flushdb.rb
312
+ - commands/rhoconnect/startdebug.rb
313
+ - commands/rhoconnect/version.rb
314
+ - commands/rhoconnect/stop.rb
315
+ - commands/rhoconnect/start.rb
316
+ - commands/rhoconnect/get_token.rb
317
+ - commands/rhoconnect_attach/attach.rb
318
+ - commands/utilities/redis_runner.rb
319
+ - commands/utilities/utilities.rb
283
320
  - commands/generators/app.rb
284
321
  - commands/generators/source.rb
285
- - commands/commands/dtach_commands/dtach_about.rb
286
- - commands/commands/dtach_commands/dtach_install.rb
287
- - commands/commands/rhoconnect/delete_user.rb
288
- - commands/commands/rhoconnect/secret.rb
289
- - commands/commands/rhoconnect/delete_device.rb
290
- - commands/commands/rhoconnect/restart.rb
291
- - commands/commands/rhoconnect/config.rb
292
- - commands/commands/rhoconnect/reset.rb
293
- - commands/commands/rhoconnect/create_user.rb
294
- - commands/commands/rhoconnect/web.rb
295
- - commands/commands/rhoconnect/spec.rb
296
- - commands/commands/rhoconnect/clean_start.rb
297
- - commands/commands/rhoconnect/attach.rb
298
- - commands/commands/rhoconnect/war.rb
299
- - commands/commands/rhoconnect/console.rb
300
- - commands/commands/rhoconnect/set_admin_password.rb
301
- - commands/commands/rhoconnect/reset_refresh.rb
302
- - commands/commands/rhoconnect/startbg.rb
303
- - commands/commands/rhoconnect/console_helper.rb
304
- - commands/commands/rhoconnect/flushdb.rb
305
- - commands/commands/rhoconnect/startdebug.rb
306
- - commands/commands/rhoconnect/version.rb
307
- - commands/commands/rhoconnect/stop.rb
308
- - commands/commands/rhoconnect/start.rb
309
- - commands/commands/rhoconnect/get_token.rb
310
- - commands/commands/redis_commands/redis_download.rb
311
- - commands/commands/redis_commands/redis_runner.rb
312
- - commands/commands/redis_commands/redis_make.rb
313
- - commands/commands/redis_commands/redis_restart.rb
314
- - commands/commands/redis_commands/redis_install.rb
315
- - commands/commands/redis_commands/redis_start.rb
316
- - commands/commands/redis_commands/redis_stop.rb
317
- - commands/commands/redis_commands/redis_attach.rb
318
- - commands/commands/redis_commands/redis_about.rb
319
- - commands/commands/redis_commands/redis_startbg.rb
322
+ - commands/generators/update.rb
320
323
  - commands/execute.rb
324
+ - commands/rhoconnect_war/war.rb
325
+ - commands/rhoconnect_console/console.rb
326
+ - commands/rhoconnect_console/console_helper.rb
327
+ - commands/redis/redis_download.rb
328
+ - commands/redis/redis_make.rb
329
+ - commands/redis/redis_restart.rb
330
+ - commands/redis/redis_install.rb
331
+ - commands/redis/redis_start.rb
332
+ - commands/redis/redis_stop.rb
333
+ - commands/redis/redis_about.rb
334
+ - commands/redis/redis_startbg.rb
335
+ - commands/dtach/dtach_about.rb
336
+ - commands/dtach/redis_attach.rb
337
+ - commands/dtach/dtach_install.rb
338
+ - doc/session-and-configuration.txt
321
339
  - doc/command-line.txt
322
340
  - doc/source-adapters.txt
323
341
  - doc/testing.txt
@@ -330,6 +348,7 @@ files:
330
348
  - doc/introduction.txt
331
349
  - doc/push-server-setup.txt
332
350
  - doc/push.txt
351
+ - doc/rhoconnect-calculator.txt
333
352
  - doc/cud-conflicts.txt
334
353
  - doc/hosting-rhohub.txt
335
354
  - doc/settings.txt
@@ -375,6 +394,7 @@ files:
375
394
  - generators/rhoconnect.rb
376
395
  - generators/templates/application/Gemfile
377
396
  - generators/templates/application/application.rb
397
+ - generators/templates/application/rcgemfile
378
398
  - generators/templates/application/gitignore
379
399
  - generators/templates/application/settings/settings.yml
380
400
  - generators/templates/application/settings/license.key
@@ -446,6 +466,7 @@ files:
446
466
  - lib/rhoconnect/bulk_data/syncdb.index.schema
447
467
  - lib/rhoconnect/bulk_data/bulk_data.rb
448
468
  - lib/rhoconnect/async.rb
469
+ - lib/rhoconnect/application/init.rb
449
470
  - lib/rhoconnect/web-console/public/jqplot/jquery.jqplot.min.js
450
471
  - lib/rhoconnect/web-console/public/jqplot/jqplot.cursor.js
451
472
  - lib/rhoconnect/web-console/public/jqplot/jquery.jqplot.min.css
@@ -462,9 +483,11 @@ files:
462
483
  - lib/rhoconnect/web-console/public/rhoconnect-web.js
463
484
  - lib/rhoconnect/web-console/public/underscore.js
464
485
  - lib/rhoconnect/web-console/public/bootstrap.css
486
+ - lib/rhoconnect/web-console/public/logo.png
465
487
  - lib/rhoconnect/web-console/public/backbone.js
466
488
  - lib/rhoconnect/web-console/public/jquery-1.7.1.min.js
467
489
  - lib/rhoconnect/web-console/public/bootstrap-collapse.js
490
+ - lib/rhoconnect/web-console/public/UNVR67bold.ttf
468
491
  - lib/rhoconnect/web-console/views/server_doc.js
469
492
  - lib/rhoconnect/web-console/views/new_user.js
470
493
  - lib/rhoconnect/web-console/views/home.js
@@ -548,6 +571,7 @@ files:
548
571
  - lib/rhoconnect/api_token.rb
549
572
  - lib/rhoconnect/generator.rb
550
573
  - lib/rhoconnect/ping/rhoconnect_push.rb
574
+ - lib/rhoconnect/ping/gcm.rb
551
575
  - lib/rhoconnect/ping/blackberry.rb
552
576
  - lib/rhoconnect/ping/apple.rb
553
577
  - lib/rhoconnect/ping/android.rb
@@ -561,6 +585,9 @@ files:
561
585
  - spec/client_sync_spec.rb
562
586
  - spec/app_spec.rb
563
587
  - spec/factories/factories.rb
588
+ - spec/testdata/5-data.txt
589
+ - spec/testdata/10000-data.txt
590
+ - spec/testdata/5000-data.txt
564
591
  - spec/testdata/compressed/compress-data.txt
565
592
  - spec/testdata/1000-data.txt
566
593
  - spec/testdata/upload1.txt
@@ -656,6 +683,7 @@ files:
656
683
  - spec/ping/android_spec.rb
657
684
  - spec/ping/apple_spec.rb
658
685
  - spec/ping/blackberry_spec.rb
686
+ - spec/ping/gcm_spec.rb
659
687
  - spec/license_spec.rb
660
688
  - spec/apps/emptyapp/application.rb
661
689
  - spec/apps/emptyapp/settings/settings.yml
@@ -690,7 +718,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
690
718
  version: '0'
691
719
  segments:
692
720
  - 0
693
- hash: -1009647506811252622
721
+ hash: 781878080452453246
694
722
  required_rubygems_version: !ruby/object:Gem::Requirement
695
723
  none: false
696
724
  requirements:
@@ -711,6 +739,9 @@ test_files:
711
739
  - spec/client_sync_spec.rb
712
740
  - spec/app_spec.rb
713
741
  - spec/factories/factories.rb
742
+ - spec/testdata/5-data.txt
743
+ - spec/testdata/10000-data.txt
744
+ - spec/testdata/5000-data.txt
714
745
  - spec/testdata/compressed/compress-data.txt
715
746
  - spec/testdata/1000-data.txt
716
747
  - spec/testdata/upload1.txt
@@ -806,6 +837,7 @@ test_files:
806
837
  - spec/ping/android_spec.rb
807
838
  - spec/ping/apple_spec.rb
808
839
  - spec/ping/blackberry_spec.rb
840
+ - spec/ping/gcm_spec.rb
809
841
  - spec/license_spec.rb
810
842
  - spec/apps/emptyapp/application.rb
811
843
  - spec/apps/emptyapp/settings/settings.yml