rhoconnect 4.0.4 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +5 -13
  2. data/CHANGELOG.md +54 -5
  3. data/CREDITS +219 -219
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +68 -79
  6. data/Rakefile +1 -2
  7. data/bench/benchapp/spec/models/ruby/mock_adapter_spec.rb +17 -17
  8. data/bench/benchapp/spec/models/ruby/queue_mock_adapter_spec.rb +17 -17
  9. data/bench/benchapp/spec/spec_helper.rb +3 -3
  10. data/bench/blobapp/spec/models/ruby/blob_adapter_spec.rb +17 -17
  11. data/bench/blobapp/spec/spec_helper.rb +3 -3
  12. data/bench/lib/bench/runner.rb +1 -69
  13. data/bench/lib/bench.rb +18 -18
  14. data/bench/spec/mock_adapter_spec.rb +54 -55
  15. data/bench/spec/mock_client_spec.rb +47 -48
  16. data/bench/spec/result_spec.rb +41 -44
  17. data/bench/spec/utils_spec.rb +24 -25
  18. data/commands/generators/app.rb +7 -5
  19. data/commands/generators/controller.rb +7 -5
  20. data/commands/generators/model.rb +7 -5
  21. data/commands/generators/source.rb +7 -5
  22. data/commands/parser.rb +1 -1
  23. data/commands/redis/redis_download.rb +1 -1
  24. data/doc/async-jobs.txt +9 -9
  25. data/doc/supported-platforms.txt +0 -2
  26. data/generators/rhoconnect.rb +92 -212
  27. data/generators/templates/application/rcgemfile +3 -3
  28. data/generators/templates/application/spec/application_controller_spec.rb +14 -16
  29. data/generators/templates/application/spec/js_spec.rb +20 -20
  30. data/generators/templates/application/spec/spec_helper.rb +1 -1
  31. data/generators/templates/source/controllers/ruby/controller_spec.rb +18 -19
  32. data/generators/templates/source/models/ruby/model_spec.rb +17 -17
  33. data/install.sh +10 -21
  34. data/installer/unix-like/rho_connect_install_constants.rb +5 -5
  35. data/installer/unix-like/rho_connect_install_installers.rb +4 -4
  36. data/installer/utils/constants.rb +6 -6
  37. data/installer/utils/nix_install_test.rb +29 -29
  38. data/installer/utils/package_upload/repos.rake +16 -26
  39. data/js-adapters/node.rb +4 -4
  40. data/js-adapters/node_channel.rb +4 -8
  41. data/lib/rhoconnect/db_adapter.rb +13 -13
  42. data/lib/rhoconnect/handler/changes/engine.rb +1 -1
  43. data/lib/rhoconnect/jobs/bulk_data_job.rb +29 -29
  44. data/lib/rhoconnect/license.rb +7 -7
  45. data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +13 -13
  46. data/lib/rhoconnect/ping/apple.rb +4 -4
  47. data/lib/rhoconnect/server.rb +2 -2
  48. data/lib/rhoconnect/source.rb +2 -2
  49. data/lib/rhoconnect/store.rb +12 -6
  50. data/lib/rhoconnect/utilities.rb +2 -2
  51. data/lib/rhoconnect/version.rb +1 -1
  52. data/lib/rhoconnect.rb +6 -4
  53. data/rhoconnect.gemspec +5 -6
  54. data/spec/api/api_helper.rb +1 -1
  55. data/spec/api/app/fast_delete_spec.rb +22 -22
  56. data/spec/api/app/fast_insert_spec.rb +23 -23
  57. data/spec/api/app/fast_update_spec.rb +63 -63
  58. data/spec/api/app/push_deletes_spec.rb +11 -13
  59. data/spec/api/app/push_objects_spec.rb +39 -39
  60. data/spec/api/client/client_get_db_doc_spec.rb +29 -29
  61. data/spec/api/client/client_set_db_doc_spec.rb +11 -11
  62. data/spec/api/client/get_client_params_spec.rb +29 -29
  63. data/spec/api/client/list_client_docs_spec.rb +32 -34
  64. data/spec/api/client/reset_spec.rb +30 -30
  65. data/spec/api/readstate/set_refresh_time_spec.rb +43 -43
  66. data/spec/api/source/get_source_params_spec.rb +32 -34
  67. data/spec/api/source/list_sources_spec.rb +13 -13
  68. data/spec/api/source/update_source_params_spec.rb +19 -19
  69. data/spec/api/store/get_db_doc_spec.rb +27 -27
  70. data/spec/api/store/set_db_doc_spec.rb +38 -38
  71. data/spec/api/system/adapter_spec.rb +27 -29
  72. data/spec/api/system/get_license_info_spec.rb +11 -11
  73. data/spec/api/system/login_spec.rb +37 -37
  74. data/spec/api/system/reset_spec.rb +15 -15
  75. data/spec/api/system/stats_spec.rb +70 -71
  76. data/spec/api/user/create_user_spec.rb +37 -37
  77. data/spec/api/user/delete_client_spec.rb +7 -7
  78. data/spec/api/user/delete_user_spec.rb +62 -62
  79. data/spec/api/user/list_clients_spec.rb +24 -24
  80. data/spec/api/user/list_source_docs_spec.rb +29 -29
  81. data/spec/api/user/list_users_spec.rb +22 -22
  82. data/spec/api/user/ping_spec.rb +18 -18
  83. data/spec/api/user/show_user_spec.rb +10 -10
  84. data/spec/api/user/update_user_spec.rb +43 -43
  85. data/spec/api/user/user_get_db_doc_spec.rb +12 -12
  86. data/spec/api/user/user_set_db_doc_spec.rb +37 -37
  87. data/spec/api_token_spec.rb +8 -8
  88. data/spec/app_spec.rb +18 -17
  89. data/spec/apps/jstestapp/settings/settings.yml +2 -0
  90. data/spec/async_spec.rb +9 -11
  91. data/spec/bulk_data/bulk_data_spec.rb +120 -120
  92. data/spec/cli/cli_spec.rb +50 -53
  93. data/spec/client_spec.rb +105 -105
  94. data/spec/client_sync_spec.rb +529 -528
  95. data/spec/controllers/js_base_spec.rb +147 -141
  96. data/spec/doc/doc_spec.rb +51 -52
  97. data/spec/document_spec.rb +58 -58
  98. data/spec/dynamic_adapter_spec.rb +33 -36
  99. data/spec/generator/generator_spec.rb +76 -42
  100. data/spec/jobs/bulk_data_job_spec.rb +101 -102
  101. data/spec/jobs/ping_job_spec.rb +176 -177
  102. data/spec/jobs/source_job_spec.rb +24 -25
  103. data/spec/license_spec.rb +54 -55
  104. data/spec/models/js_base_spec.rb +121 -120
  105. data/spec/perf/bulk_data_perf_spec.rb +23 -24
  106. data/spec/perf/perf_spec_helper.rb +7 -7
  107. data/spec/perf/store_perf_spec.rb +139 -140
  108. data/spec/ping/apple_spec.rb +65 -65
  109. data/spec/ping/gcm_spec.rb +83 -84
  110. data/spec/ping/rhoconnect_push_spec.rb +52 -53
  111. data/spec/predefined_adapters/rho_internal_bench_adapter_controller_js_spec.rb +100 -101
  112. data/spec/predefined_adapters/rho_internal_js_bench_adapter_js_spec.rb +29 -31
  113. data/spec/read_state_spec.rb +24 -25
  114. data/spec/rhoconnect_spec.rb +7 -7
  115. data/spec/server/server_spec.rb +664 -662
  116. data/spec/server/stats_spec.rb +12 -12
  117. data/spec/source_adapter_spec.rb +124 -125
  118. data/spec/source_spec.rb +148 -149
  119. data/spec/source_sync_spec.rb +736 -736
  120. data/spec/spec_helper.rb +4 -5
  121. data/spec/stats/record_spec.rb +22 -21
  122. data/spec/store_orm_spec.rb +48 -48
  123. data/spec/store_spec.rb +428 -426
  124. data/spec/support/shared_examples.rb +5 -7
  125. data/spec/sync_states_spec.rb +67 -67
  126. data/spec/test_methods_spec.rb +121 -123
  127. data/spec/testdata/10000-data.txt +0 -0
  128. data/spec/testdata/5000-data.txt +0 -0
  129. data/spec/user_spec.rb +102 -102
  130. data/tasks/redis.rake +3 -3
  131. metadata +154 -195
  132. data/bench/benchapp/tmp/pids/passenger.9292.pid.lock +0 -0
  133. data/bench/benchapp/tmp/restart.txt +0 -0
  134. data/bench/blobapp/settings/license.key.bak +0 -2
  135. data/bench/blobapp/tmp/restart.txt +0 -0
  136. data/bench/lib/testdata/1-data.txt +0 -0
  137. data/bench/lib/testdata/10-data.txt +0 -0
  138. data/bench/lib/testdata/2-data.txt +0 -0
  139. data/bench/lib/testdata/250-data.txt +0 -0
  140. data/bench/lib/testdata/5-blob_data.txt +0 -0
  141. data/bench/lib/testdata/5-data.txt +0 -0
  142. data/bench/lib/testdata/50-data.txt +0 -0
  143. data/bench/lib/testdata/500-data.txt +0 -0
  144. data/doc/protocol.html +0 -1993
  145. data/spec/coverage/rcov/assets/0.2.3/jquery-1.3.2.min.js +0 -19
  146. data/spec/coverage/rcov/assets/0.2.3/jquery.tablesorter.min.js +0 -15
  147. data/spec/coverage/rcov/assets/0.2.3/print.css +0 -12
  148. data/spec/coverage/rcov/assets/0.2.3/rcov.js +0 -42
  149. data/spec/coverage/rcov/assets/0.2.3/screen.css +0 -270
  150. data/spec/coverage/rcov/index.html +0 -88
  151. data/spec/generator/generator_spec_helper.rb +0 -9
@@ -3,59 +3,58 @@ require 'bench_spec_helper'
3
3
  require 'benchapp/models/ruby/mock_adapter'
4
4
 
5
5
  describe "MockAdapter" do
6
- # it_should_behave_like "BenchSpecHelper"
7
- it_behaves_like "BenchSpecHelper" do
8
- before(:each) do
9
- @s_fields = {
10
- :source_id => 1,
11
- :name => 'SampleAdapter',
12
- :url => 'http://example.com',
13
- :login => 'testuser',
14
- :password => 'testpass',
15
- }
16
- @s_params = {
17
- :user_id => 'mock_user_id',
18
- :app_id => 'mock_app_id'
19
- }
20
- @s = Source.create(@s_fields,@s_params)
21
- @ma = MockAdapter.new(@s)
22
- end
23
-
24
- it "should return db name" do
25
- @ma.db_name.should == "test_db_storage:mock_app_id:mock_user_id"
26
- end
27
-
28
- it "should return db lock name" do
29
- @ma.lock_name.should == "lock:test_db_storage:mock_app_id:mock_user_id"
30
- end
31
-
32
- it "should login" do
33
- @ma.login.should == true
34
- end
35
-
36
- it "should query data from db" do
37
- set_state(@ma.db_name => @data)
38
- @ma.query.should == @data
39
- end
40
-
41
- it "should create object in the db" do
42
- @product1.merge!('mock_id'=>'1')
43
- @ma.create(@product1).should == '1'
44
- verify_result(@ma.db_name => {'1' => @product1})
45
- end
46
-
47
- it "should update object in db" do
48
- set_state(@ma.db_name => @data)
49
- @ma.update('id' => '3','price' => '99.99')
50
- @product3['price'] = '99.99'
51
- verify_result(@ma.db_name => @data)
52
- end
53
-
54
- it "should delete object in db" do
55
- set_state(@ma.db_name => @data)
56
- del_object = {}.merge!(@product2).merge!('id'=>'2')
57
- @ma.delete(del_object)
58
- verify_result(@ma.db_name => {'1' => @product1, '3' => @product3})
59
- end
60
- end
6
+ include_examples "BenchSpecHelper"
7
+
8
+ before(:each) do
9
+ @s_fields = {
10
+ :source_id => 1,
11
+ :name => 'SampleAdapter',
12
+ :url => 'http://example.com',
13
+ :login => 'testuser',
14
+ :password => 'testpass',
15
+ }
16
+ @s_params = {
17
+ :user_id => 'mock_user_id',
18
+ :app_id => 'mock_app_id'
19
+ }
20
+ @s = Source.create(@s_fields,@s_params)
21
+ @ma = MockAdapter.new(@s)
22
+ end
23
+
24
+ it "should return db name" do
25
+ @ma.db_name.should == "test_db_storage:mock_app_id:mock_user_id"
26
+ end
27
+
28
+ it "should return db lock name" do
29
+ @ma.lock_name.should == "lock:test_db_storage:mock_app_id:mock_user_id"
30
+ end
31
+
32
+ it "should login" do
33
+ @ma.login.should == true
34
+ end
35
+
36
+ it "should query data from db" do
37
+ set_state(@ma.db_name => @data)
38
+ @ma.query.should == @data
39
+ end
40
+
41
+ it "should create object in the db" do
42
+ @product1.merge!('mock_id'=>'1')
43
+ @ma.create(@product1).should == '1'
44
+ verify_result(@ma.db_name => {'1' => @product1})
45
+ end
46
+
47
+ it "should update object in db" do
48
+ set_state(@ma.db_name => @data)
49
+ @ma.update('id' => '3','price' => '99.99')
50
+ @product3['price'] = '99.99'
51
+ verify_result(@ma.db_name => @data)
52
+ end
53
+
54
+ it "should delete object in db" do
55
+ set_state(@ma.db_name => @data)
56
+ del_object = {}.merge!(@product2).merge!('id'=>'2')
57
+ @ma.delete(del_object)
58
+ verify_result(@ma.db_name => {'1' => @product1, '3' => @product3})
59
+ end
61
60
  end
@@ -2,64 +2,63 @@ $:.unshift File.join(File.dirname(__FILE__))
2
2
  require 'bench_spec_helper'
3
3
 
4
4
  describe "MockClient" do
5
- # it_should_behave_like "BenchSpecHelper"
6
- it_behaves_like "BenchSpecHelper" do
7
- before(:each) do
8
- @mc = MockClient.new(1,2,123)
9
- end
5
+ include_examples "BenchSpecHelper"
10
6
 
11
- it "should return document type" do
12
- @mc.doc_type.should == "123:mock:cd"
13
- end
7
+ before(:each) do
8
+ @mc = MockClient.new(1,2,123)
9
+ end
14
10
 
15
- it "should insert objects into the client document" do
16
- @mc.insert(@data)
17
- verify_result(@mc.doc_type => @data)
18
- end
11
+ it "should return document type" do
12
+ @mc.doc_type.should == "123:mock:cd"
13
+ end
19
14
 
20
- it "should delete objects from the client document" do
21
- set_state(@mc.doc_type => @data)
22
- @mc.delete('1' => @product1,'3' => @product3)
23
- verify_result(@mc.doc_type => {'2' => @product2})
24
- end
15
+ it "should insert objects into the client document" do
16
+ @mc.insert(@data)
17
+ verify_result(@mc.doc_type => @data)
18
+ end
25
19
 
26
- it "should verify state of the client document" do
27
- set_state(@mc.doc_type => @data)
28
- @mc.verify(@data).should == true
29
- @mc.verify('1' => @product1,'3' => @product3).should == false
30
- end
20
+ it "should delete objects from the client document" do
21
+ set_state(@mc.doc_type => @data)
22
+ @mc.delete('1' => @product1,'3' => @product3)
23
+ verify_result(@mc.doc_type => {'2' => @product2})
24
+ end
31
25
 
32
- it "should parse server message and insert objects into the client document" do
33
- message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},{:insert=>@data}].to_json
34
- @mc.parse message
35
- verify_result(@mc.doc_type => @data)
36
- end
26
+ it "should verify state of the client document" do
27
+ set_state(@mc.doc_type => @data)
28
+ @mc.verify(@data).should == true
29
+ @mc.verify('1' => @product1,'3' => @product3).should == false
30
+ end
37
31
 
38
- it "should parse server message and delete objects for the client document" do
39
- set_state(@mc.doc_type => @data)
40
- message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},{:delete=>{'2'=>@product2}}].to_json
41
- @mc.parse message
42
- verify_result(@mc.doc_type => {'1' => @product1,'3' => @product3})
43
- end
32
+ it "should parse server message and insert objects into the client document" do
33
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},{:insert=>@data}].to_json
34
+ @mc.parse message
35
+ verify_result(@mc.doc_type => @data)
36
+ end
44
37
 
45
- it "should parse server message and insert/delete objects to/from client document" do
46
- set_state(@mc.doc_type => {'1' => @product1,'2' => @product2})
47
- message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},
48
- {:insert=>{'3'=>@product3}},{:delete=>{'2'=>@product2}}].to_json
49
- @mc.parse message
50
- verify_result(@mc.doc_type => {'1' => @product1,'3' => @product3})
51
- end
38
+ it "should parse server message and delete objects for the client document" do
39
+ set_state(@mc.doc_type => @data)
40
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},{:delete=>{'2'=>@product2}}].to_json
41
+ @mc.parse message
42
+ verify_result(@mc.doc_type => {'1' => @product1,'3' => @product3})
43
+ end
52
44
 
53
- it "should raise exception on wrong message format" do
54
- message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0}].to_json
55
- lambda { @mc.parse message }.should raise_error(Exception,
56
- '[T:001|I:002] Wrong message format. Message: "[{\"version\":3},{\"token\":\"123\"},{\"count\":3},{\"progress_count\":0}]"')
57
- end
45
+ it "should parse server message and insert/delete objects to/from client document" do
46
+ set_state(@mc.doc_type => {'1' => @product1,'2' => @product2})
47
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},
48
+ {:insert=>{'3'=>@product3}},{:delete=>{'2'=>@product2}}].to_json
49
+ @mc.parse message
50
+ verify_result(@mc.doc_type => {'1' => @product1,'3' => @product3})
51
+ end
58
52
 
59
- it "should raise exception on wrong protocol version" do
53
+ it "should raise exception on wrong message format" do
54
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0}].to_json
55
+ lambda { @mc.parse message }.should raise_error(Exception,
56
+ '[T:001|I:002] Wrong message format. Message: "[{\"version\":3},{\"token\":\"123\"},{\"count\":3},{\"progress_count\":0}]"')
57
+ end
58
+
59
+ it "should raise exception on wrong protocol version" do
60
60
  message = [{:version => 1},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>0},{}].to_json
61
61
  lambda { @mc.parse message }.should raise_error(Exception,
62
62
  '[T:001|I:002] Wrong protocol version. Message: "[{\"version\":1},{\"token\":\"123\"},{\"count\":3},{\"progress_count\":0},{\"total_count\":0},{}]"')
63
- end
64
- end
63
+ end
65
64
  end
@@ -3,59 +3,56 @@ require 'bench_spec_helper'
3
3
  require 'rest_client'
4
4
 
5
5
  describe "ResultSpec" do
6
- # it_should_behave_like "BenchSpecHelper"
7
-
8
6
  include Utils
9
- it_behaves_like "BenchSpecHelper" do
10
- before(:each) do
11
- @s1 = [{"foo" => {"bar" => "cake"}}]
12
- @s2 = [{"foo" => {"bar" => "cake1"}},{"hello" => "world"}]
13
- @result = Result.new("marker",:get,"some/url",0,1)
14
- client = mock("RestClient")
15
- client.stub!(:headers).and_return({'header1'=>'headervalue1'})
16
- client.stub!(:cookies).and_return({'session1'=>'sessval1'})
17
- client.stub!(:code).and_return(200)
18
- client.stub!(:to_s).and_return(@s1.to_json)
19
- @result.last_response = client
20
- end
21
-
22
- describe "test @last_response wrapper" do
23
-
24
- it "should return 'code'" do
25
- @result.code.should == 200
26
- end
7
+ include_examples "BenchSpecHelper"
8
+
9
+ before(:each) do
10
+ @s1 = [{"foo" => {"bar" => "cake"}}]
11
+ @s2 = [{"foo" => {"bar" => "cake1"}},{"hello" => "world"}]
12
+ @result = Result.new("marker",:get,"some/url",0,1)
13
+ client = double("RestClient")
14
+ client.stub(:headers).and_return({'header1'=>'headervalue1'})
15
+ client.stub(:cookies).and_return({'session1'=>'sessval1'})
16
+ client.stub(:code).and_return(200)
17
+ client.stub(:to_s).and_return(@s1.to_json)
18
+ @result.last_response = client
19
+ end
27
20
 
28
- it "should return 'body'" do
29
- JSON.parse(@result.body).should == @s1
30
- end
21
+ describe "test @last_response wrapper" do
31
22
 
32
- it "should return 'cookies'" do
33
- @result.cookies.should == {'session1'=>'sessval1'}
34
- end
23
+ it "should return 'code'" do
24
+ @result.code.should == 200
25
+ end
35
26
 
36
- it "shhould return 'headers'" do
37
- @result.headers.should == {'header1'=>'headervalue1'}
38
- end
27
+ it "should return 'body'" do
28
+ JSON.parse(@result.body).should == @s1
29
+ end
39
30
 
31
+ it "should return 'cookies'" do
32
+ @result.cookies.should == {'session1'=>'sessval1'}
40
33
  end
41
34
 
42
- it "should compare two array/hash structures" do
43
- compare(:expected,@s1,:actual,@s2).should == [{:expected=>"cake",
44
- :path=>[0, "foo", "bar"], :actual=>"cake1"},
45
- {:expected=>nil, :path=>[1], :actual=>{"hello"=>"world"}}]
35
+ it "shhould return 'headers'" do
36
+ @result.headers.should == {'header1'=>'headervalue1'}
46
37
  end
47
38
 
48
- it "should verify body" do
49
- @result.should_receive(:bench_log).exactly(8).times
50
- @result.verify_body(@s2.to_json)
51
- @result.verification_error.should == 1
52
- end
39
+ end
53
40
 
54
- it "should verify code" do
55
- @result.should_receive(:bench_log).exactly(4).times
56
- @result.verify_code(500)
57
- @result.verification_error.should == 1
58
- end
41
+ it "should compare two array/hash structures" do
42
+ compare(:expected,@s1,:actual,@s2).should == [{:expected=>"cake",
43
+ :path=>[0, "foo", "bar"], :actual=>"cake1"},
44
+ {:expected=>nil, :path=>[1], :actual=>{"hello"=>"world"}}]
45
+ end
46
+
47
+ it "should verify body" do
48
+ @result.should_receive(:bench_log).exactly(8).times
49
+ @result.verify_body(@s2.to_json)
50
+ @result.verification_error.should == 1
51
+ end
52
+
53
+ it "should verify code" do
54
+ @result.should_receive(:bench_log).exactly(4).times
55
+ @result.verify_code(500)
56
+ @result.verification_error.should == 1
59
57
  end
60
-
61
58
  end
@@ -2,35 +2,34 @@ $:.unshift File.join(File.dirname(__FILE__))
2
2
  require 'bench_spec_helper'
3
3
 
4
4
  describe "UtilsSpec" do
5
- # it_should_behave_like "BenchSpecHelper"
6
5
  include Utils
7
6
  include Logging
8
7
 
9
- it_behaves_like "BenchSpecHelper" do
10
- it "should compare two identical hashes" do
11
- h1 = {'key1' => {'key2' => 'value2'}}
12
- h2 = {'key1' => {'key2' => 'value2'}}
13
- compare(:expected,h1,:actual,h2).should == []
14
- end
8
+ include_examples "BenchSpecHelper"
15
9
 
16
- it "should compare two different hashes" do
17
- h1 = {'key1' => {'key2' => 'value2'}}
18
- h2 = {'key1' => {'key2' => 'value3'}}
19
- compare(:expected,h1,:actual,h2).should ==
20
- [{:actual=>"value3", :path=>["key1", "key2"], :expected=>"value2"}]
21
- end
10
+ it "should compare two identical hashes" do
11
+ h1 = {'key1' => {'key2' => 'value2'}}
12
+ h2 = {'key1' => {'key2' => 'value2'}}
13
+ compare(:expected,h1,:actual,h2).should == []
14
+ end
22
15
 
23
- it "should compare_and_log two identical hashes" do
24
- h1 = {'key1' => {'key2' => 'value2'}}
25
- h2 = {'key1' => {'key2' => 'value2'}}
26
- Bench::Utils.should_not_receive(:bench_log)
27
- compare_and_log(h1,h2,'the caller').should == 0
28
- end
16
+ it "should compare two different hashes" do
17
+ h1 = {'key1' => {'key2' => 'value2'}}
18
+ h2 = {'key1' => {'key2' => 'value3'}}
19
+ compare(:expected,h1,:actual,h2).should ==
20
+ [{:actual=>"value3", :path=>["key1", "key2"], :expected=>"value2"}]
21
+ end
29
22
 
30
- it "should compare_and_log two different hashes" do
31
- h1 = {'key1' => {'key2' => 'value2'}}
32
- h2 = {'key1' => {'key2' => 'value3'}}
33
- compare_and_log(h1,h2,'the caller').should == 1
34
- end
35
- end
23
+ it "should compare_and_log two identical hashes" do
24
+ h1 = {'key1' => {'key2' => 'value2'}}
25
+ h2 = {'key1' => {'key2' => 'value2'}}
26
+ Bench::Utils.should_not_receive(:bench_log)
27
+ compare_and_log(h1,h2,'the caller').should == 0
28
+ end
29
+
30
+ it "should compare_and_log two different hashes" do
31
+ h1 = {'key1' => {'key2' => 'value2'}}
32
+ h2 = {'key1' => {'key2' => 'value3'}}
33
+ compare_and_log(h1,h2,'the caller').should == 1
34
+ end
36
35
  end
@@ -1,6 +1,8 @@
1
1
  Execute.define_task do
2
- desc "app NAME [options]", "Generate a new rhoconnect application"
3
- def app(name,platform=nil)
4
- Rhoconnect.run_cli(Dir.pwd, 'rhoconnect', Rhoconnect::VERSION, ARGV)
5
- end #app
6
- end #do
2
+ desc "app NAME [--js]", "Generate a new rhoconnect application"
3
+ def app(name, platform=nil)
4
+ # ARGV = [command, argument, ... option, ...]
5
+ ARGV.shift
6
+ invoke :app_generator
7
+ end
8
+ end
@@ -1,6 +1,8 @@
1
1
  Execute.define_task do
2
- desc "source NAME", "Generate a new source adapter controller", :hide => true
3
- def controller(name,platform='ruby')
4
- Rhoconnect.run_cli(Dir.pwd, 'thorhoconnect', Rhoconnect::VERSION, ARGV)
5
- end #source
6
- end #do
2
+ desc "controller NAME [--js]", "Generate a new source adapter controller", :hide => true
3
+ def controller(name, platform='ruby')
4
+ # ARGV = [command, argument, ... option, ...]
5
+ ARGV.shift
6
+ invoke :controller_generator
7
+ end
8
+ end
@@ -1,6 +1,8 @@
1
1
  Execute.define_task do
2
- desc "source NAME", "Generate a new source adapter model", :hide => true
3
- def model(name,platform='ruby')
4
- Rhoconnect.run_cli(Dir.pwd, 'thorhoconnect', Rhoconnect::VERSION, ARGV)
5
- end #model
6
- end #do
2
+ desc "model NAME [--js]", "Generate a new source adapter model", :hide => true
3
+ def model(name, platform='ruby')
4
+ # ARGV = [command, argument, ... option, ...]
5
+ ARGV.shift
6
+ invoke :model_generator
7
+ end
8
+ end
@@ -1,6 +1,8 @@
1
1
  Execute.define_task do
2
- desc "source NAME [options]", "Generate a new source adapter"
3
- def source(name,platform=nil)
4
- Rhoconnect.run_cli(Dir.pwd, 'rhoconnect', Rhoconnect::VERSION, ARGV)
5
- end #source
6
- end #do
2
+ desc "source NAME [--js]", "Generate a new source adapter"
3
+ def source(name, platform=nil)
4
+ # ARGV = [command, argument, ... option, ...]
5
+ ARGV.shift
6
+ invoke :source_generator
7
+ end
8
+ end
data/commands/parser.rb CHANGED
@@ -134,7 +134,7 @@ end
134
134
 
135
135
  # rhoconnect get-token|set-admin-password
136
136
  module AdminCommands
137
- def self.match?(input); input == 'get-token' || input == 'set_admin_password'; end
137
+ def self.match?(input); input =~ /get[-_]token/ || input =~ /set[-_]admin[-_]password/; end
138
138
  def self.execute(input)
139
139
  require_relative '../commands/rhoconnect/config'
140
140
  require_relative '../commands/rhoconnect/get_token'
@@ -1,4 +1,4 @@
1
- REDIS_RELEASE = "2.6.16"
1
+ REDIS_RELEASE = "2.8.17"
2
2
  Execute.define_task do
3
3
  desc "redis-download", "Download redis release #{REDIS_RELEASE}"
4
4
  def redis_download
data/doc/async-jobs.txt CHANGED
@@ -12,21 +12,21 @@ RhoConnect supports three job types: BulkDataJob, PingJob, SourceJob
12
12
  ### PingJob
13
13
  Ping jobs are used to execute a [device ping](/rhoconnect/push). A PingJob can be queued from anywhere in your RhoConnect application (i.e. at the end of another job or adapter query method).
14
14
 
15
- Example:
16
-
15
+ Example:
16
+
17
17
  :::ruby
18
18
  Resque.enqueue(
19
19
  PingJob,
20
20
  {
21
21
  "user_id" => current_user.login,
22
- "message" => "New products available!",
23
- "badge" => 1,
22
+ "message" => "New products available!",
23
+ "badge" => 1,
24
24
  "sources" => ['Product']
25
25
  }
26
26
  )
27
27
 
28
28
  ### SourceJob
29
- Source jobs are used to execute source adapter queues asynchronously.
29
+ Source jobs are used to execute source adapter queues asynchronously.
30
30
 
31
31
  To make your source adapters always run asynchronously, define a queue in `settings/settings.yml`:
32
32
 
@@ -37,14 +37,14 @@ To make your source adapters always run asynchronously, define a queue in `setti
37
37
  Then run a resque worker so the job will execute.
38
38
 
39
39
  Example that queues a new source adapter job manually:
40
-
40
+
41
41
  :::ruby
42
42
  Resque.enqueue(
43
43
  SourceJob,
44
44
  :query,
45
45
  APP_NAME,
46
46
  'Joe',
47
- 'some-client-id
47
+ 'some-client-id'
48
48
  )
49
49
 
50
50
  ## Running Async Jobs
@@ -55,11 +55,11 @@ Running RhoConnect jobs requires one or more [resque](http://github.com/defunkt/
55
55
  $ QUEUE=* rake resque:work
56
56
 
57
57
  To start multiple workers(in this case 5):
58
-
58
+
59
59
  :::term
60
60
  $ cd <your rhoconnect app>
61
61
  $ QUEUE=* COUNT=5 rake resque:workers
62
-
62
+
63
63
  For more information on the options available when running resque workers, please refer to the [resque readme](https://github.com/defunkt/resque#readme).
64
64
 
65
65
  If you want to run resque workers in daemon mode, we recommend using [nohup](http://en.wikipedia.org/wiki/Nohup), [god](http://github.com/defunkt/resque/tree/master/examples/god/), or [monit](http://github.com/defunkt/resque/tree/master/examples/monit):
@@ -67,5 +67,3 @@ The components you should have for this environment are:
67
67
 
68
68
  * Usually JDK is shipped with only weak encryption, and that simply will not allow the proper key sizes being created by openssl. RhoConnect uses strong encryption for license keys and to function properly in JRuby environment installation of Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction policy files might be required.
69
69
  * Path to user’s gems, warbler data should not include white spaces (i.e. in user's account name).
70
-
71
-