rhoconnect 3.4.5 → 4.0.0.beta.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +57 -3
- data/Gemfile +9 -7
- data/Gemfile.lock +37 -37
- data/Rakefile +18 -7
- data/bench/benchapp/Gemfile +1 -1
- data/bench/benchapp/config.ru +0 -3
- data/bench/benchapp/controllers/ruby/application.rb +17 -0
- data/bench/benchapp/controllers/ruby/application_controller.rb +17 -0
- data/bench/benchapp/controllers/ruby/mock_adapter_controller.rb +8 -0
- data/bench/benchapp/controllers/ruby/queue_mock_adapter_controller.rb +8 -0
- data/bench/benchapp/{sources → models/ruby}/mock_adapter.rb +1 -1
- data/bench/benchapp/{sources → models/ruby}/queue_mock_adapter.rb +0 -0
- data/bench/benchapp/spec/{sources → models/ruby}/mock_adapter_spec.rb +1 -1
- data/bench/benchapp/spec/{sources → models/ruby}/queue_mock_adapter_spec.rb +1 -1
- data/bench/benchapp/spec/spec_helper.rb +2 -2
- data/bench/blobapp/Gemfile +1 -1
- data/bench/blobapp/config.ru +0 -3
- data/bench/blobapp/controllers/ruby/application_controller.rb +17 -0
- data/bench/blobapp/controllers/ruby/blob_adapter_controller.rb +8 -0
- data/bench/blobapp/{sources → models/ruby}/blob_adapter.rb +9 -2
- data/bench/blobapp/spec/{sources → models/ruby}/blob_adapter_spec.rb +1 -1
- data/bench/blobapp/spec/spec_helper.rb +1 -1
- data/bench/lib/bench/cli.rb +1 -1
- data/bench/scripts/blob_cud_script.rb +1 -1
- data/bench/scripts/query_md_script.rb +1 -1
- data/bench/scripts/query_only_script.rb +1 -1
- data/bench/scripts/query_script.rb +1 -1
- data/bench/scripts/test_query_script.rb +7 -1
- data/bench/spec/mock_adapter_spec.rb +1 -1
- data/bench/spec/result_spec.rb +3 -3
- data/bin/rhoconnect +5 -3
- data/commands/dtach/dtach_install.rb +2 -2
- data/commands/execute.rb +8 -3
- data/commands/generators/app.rb +3 -3
- data/commands/generators/controller.rb +6 -0
- data/commands/generators/model.rb +6 -0
- data/commands/generators/source.rb +3 -3
- data/commands/generators/update.rb +1 -1
- data/commands/redis/redis_about.rb +2 -2
- data/commands/redis/redis_download.rb +1 -1
- data/commands/redis/redis_install.rb +4 -3
- data/commands/redis/redis_restart.rb +4 -4
- data/commands/redis/redis_start.rb +5 -4
- data/commands/redis/redis_startbg.rb +5 -4
- data/commands/redis/redis_status.rb +13 -0
- data/commands/redis/redis_stop.rb +3 -3
- data/commands/rhoconnect/config.rb +28 -16
- data/commands/rhoconnect/flushdb.rb +1 -2
- data/commands/rhoconnect/get_token.rb +15 -11
- data/commands/rhoconnect/restart.rb +13 -5
- data/commands/rhoconnect/set_admin_password.rb +8 -8
- data/commands/rhoconnect/start.rb +74 -16
- data/commands/rhoconnect/startbg.rb +1 -1
- data/commands/rhoconnect/startdebug.rb +1 -1
- data/commands/rhoconnect/stop.rb +13 -1
- data/commands/rhoconnect/web.rb +5 -5
- data/commands/rhoconnect_console/console.rb +7 -5
- data/commands/{rhoconnect → rhoconnect_spec}/spec.rb +0 -0
- data/commands/rhoconnect_war/war.rb +9 -9
- data/commands/utilities/blank_app.ru +56 -0
- data/commands/utilities/redis_runner.rb +54 -19
- data/doc/authentication.txt +80 -6
- data/doc/blob-sync.txt +104 -97
- data/doc/bulk-sync.txt +1 -1
- data/doc/client-java.txt +3 -3
- data/doc/client-objc.txt +2 -2
- data/doc/client.txt +4 -4
- data/doc/command-line.txt +105 -200
- data/doc/data-partitioning.txt +40 -0
- data/doc/deploying.txt +249 -77
- data/doc/extending-rhoconnect-server.txt +40 -57
- data/doc/heroku-addon.txt +2 -0
- data/doc/install.txt +45 -95
- data/doc/introduction.txt +1 -1
- data/doc/java-plugin.txt +365 -190
- data/doc/metadata.txt +1 -1
- data/doc/migration.txt +108 -142
- data/doc/preparing-production.txt +1 -1
- data/doc/push-backend-setup.txt +2 -0
- data/doc/push-client-setup-android.txt +78 -0
- data/doc/push-client-setup-bb.txt +81 -0
- data/doc/push-client-setup-ios.txt +70 -0
- data/doc/push-client-setup-rps.txt +200 -0
- data/doc/push-client-setup.txt +63 -66
- data/doc/push-server-setup.txt +67 -40
- data/doc/push-testing.txt +29 -0
- data/doc/push.txt +21 -6
- data/doc/rest-api.txt +128 -55
- data/doc/rhoconnect-redis-stack.txt +120 -0
- data/doc/settings.txt +4 -12
- data/doc/source-adapters-intro.txt +28 -0
- data/doc/source-adapters.txt +235 -272
- data/doc/stats-middleware.txt +9 -29
- data/doc/supported-platforms.txt +21 -30
- data/doc/testing.txt +40 -42
- data/doc/tutorial.txt +72 -57
- data/examples/simple/Gemfile +1 -1
- data/examples/simple/application.rb +4 -5
- data/examples/simple/my_server.rb +2 -2
- data/examples/simple/settings/settings.yml +1 -1
- data/generators/rhoconnect.rb +151 -50
- data/generators/templates/application/Gemfile +1 -1
- data/generators/templates/application/Rakefile +3 -3
- data/generators/templates/application/config.ru +1 -4
- data/generators/templates/application/controllers/application_controller.rb +17 -0
- data/generators/templates/application/controllers/js/application_controller.js +14 -0
- data/generators/templates/application/controllers/ruby/application_controller.rb +17 -0
- data/generators/templates/application/package.json +8 -0
- data/generators/templates/application/rcgemfile +2 -5
- data/generators/templates/application/settings/settings.yml +3 -3
- data/generators/templates/application/spec/application_controller_spec.rb +23 -0
- data/generators/templates/application/spec/js_spec.rb +25 -0
- data/generators/templates/application/spec/spec_helper.rb +21 -7
- data/generators/templates/source/controllers/js/controller.js +7 -0
- data/generators/templates/source/controllers/ruby/controller.rb +8 -0
- data/generators/templates/source/controllers/ruby/controller_spec.rb +27 -0
- data/generators/templates/source/models/js/model.js +46 -0
- data/generators/templates/source/{source_adapter.rb → models/ruby/model.rb} +15 -10
- data/generators/templates/source/{source_spec.rb → models/ruby/model_spec.rb} +1 -1
- data/install.sh +5 -5
- data/installer/unix-like/create_texts.rb +2 -2
- data/installer/unix-like/rho_connect_install_constants.rb +2 -2
- data/installer/unix-like/rho_connect_install_utilities.rb +1 -1
- data/installer/utils/constants.rb +4 -4
- data/js-adapters/ballroom.js +216 -0
- data/js-adapters/node.rb +52 -0
- data/js-adapters/node_channel.rb +181 -0
- data/js-adapters/request.js +27 -0
- data/js-adapters/response.js +57 -0
- data/js-adapters/rhoconnect_helpers.js +60 -0
- data/js-adapters/router.js +60 -0
- data/js-adapters/server.js +5 -0
- data/lib/rhoconnect/api/app/ans_login.rb +3 -3
- data/lib/rhoconnect/api/app/bulk_data.rb +10 -10
- data/lib/rhoconnect/api/app/fast_delete.rb +11 -10
- data/lib/rhoconnect/api/app/fast_insert.rb +11 -10
- data/lib/rhoconnect/api/app/fast_update.rb +11 -10
- data/lib/rhoconnect/api/app/login.rb +5 -5
- data/lib/rhoconnect/api/app/push_deletes.rb +12 -11
- data/lib/rhoconnect/api/app/push_objects.rb +12 -11
- data/lib/rhoconnect/api/app/query.rb +8 -7
- data/lib/rhoconnect/api/app/queue_updates.rb +98 -94
- data/lib/rhoconnect/api/app/search.rb +8 -7
- data/lib/rhoconnect/api/client/client_get_db_doc.rb +5 -5
- data/lib/rhoconnect/api/client/client_set_db_doc.rb +8 -8
- data/lib/rhoconnect/api/client/create.rb +7 -7
- data/lib/rhoconnect/api/client/get_client_params.rb +4 -4
- data/lib/rhoconnect/api/client/list_client_docs.rb +17 -17
- data/lib/rhoconnect/api/client/register.rb +12 -12
- data/lib/rhoconnect/api/client/reset.rb +5 -5
- data/lib/rhoconnect/api/readstate/set_refresh_time.rb +9 -9
- data/lib/rhoconnect/api/source/get_source_params.rb +4 -4
- data/lib/rhoconnect/api/source/list_sources.rb +16 -16
- data/lib/rhoconnect/api/source/update_source_params.rb +6 -6
- data/lib/rhoconnect/api/store/get_db_doc.rb +4 -4
- data/lib/rhoconnect/api/store/set_db_doc.rb +7 -7
- data/lib/rhoconnect/api/system/get_adapter.rb +4 -4
- data/lib/rhoconnect/api/system/get_license_info.rb +8 -8
- data/lib/rhoconnect/api/system/login.rb +15 -15
- data/lib/rhoconnect/api/system/reset.rb +11 -11
- data/lib/rhoconnect/api/system/save_adapter.rb +4 -4
- data/lib/rhoconnect/api/system/stats.rb +22 -22
- data/lib/rhoconnect/api/user/create_user.rb +7 -7
- data/lib/rhoconnect/api/user/delete_client.rb +6 -6
- data/lib/rhoconnect/api/user/delete_user.rb +11 -10
- data/lib/rhoconnect/api/user/list_clients.rb +4 -4
- data/lib/rhoconnect/api/user/list_source_docs.rb +10 -10
- data/lib/rhoconnect/api/user/list_users.rb +3 -3
- data/lib/rhoconnect/api/user/ping.rb +3 -3
- data/lib/rhoconnect/api/user/show_user.rb +3 -3
- data/lib/rhoconnect/api/user/update_user.rb +5 -5
- data/lib/rhoconnect/api/user/user_get_db_doc.rb +5 -5
- data/lib/rhoconnect/api/user/user_set_db_doc.rb +10 -10
- data/lib/rhoconnect/api_token.rb +5 -6
- data/lib/rhoconnect/app.rb +6 -46
- data/lib/rhoconnect/application/init.rb +5 -2
- data/lib/rhoconnect/async.rb +76 -39
- data/lib/rhoconnect/bulk_data/bulk_data.rb +6 -4
- data/lib/rhoconnect/client.rb +59 -9
- data/lib/rhoconnect/condition/admin_required.rb +27 -0
- data/lib/rhoconnect/condition/client_required.rb +50 -0
- data/lib/rhoconnect/condition/login_required.rb +22 -0
- data/lib/rhoconnect/condition/source_required.rb +49 -0
- data/lib/rhoconnect/condition/verbs.rb +17 -0
- data/lib/rhoconnect/condition/verify_success.rb +19 -0
- data/lib/rhoconnect/controller/app_base.rb +74 -0
- data/lib/rhoconnect/controller/base.rb +68 -0
- data/lib/rhoconnect/controller/clients_controller.rb +79 -0
- data/lib/rhoconnect/controller/dynamic_adapter_controller.rb +93 -0
- data/lib/rhoconnect/controller/js_base.rb +124 -0
- data/lib/rhoconnect/controller/read_state_controller.rb +22 -0
- data/lib/rhoconnect/controller/source_adapter_base.rb +14 -0
- data/lib/rhoconnect/controller/sources_controller.rb +44 -0
- data/lib/rhoconnect/controller/store_controller.rb +25 -0
- data/lib/rhoconnect/controller/system_controller.rb +67 -0
- data/lib/rhoconnect/controller/users_controller.rb +99 -0
- data/lib/rhoconnect/db_adapter.rb +1 -3
- data/lib/rhoconnect/document.rb +159 -50
- data/lib/rhoconnect/handler/authenticate/execute_methods.rb +77 -0
- data/lib/rhoconnect/handler/authenticate/runner.rb +49 -0
- data/lib/rhoconnect/handler/authenticate.rb +3 -0
- data/lib/rhoconnect/handler/bulk_data.rb +28 -0
- data/lib/rhoconnect/handler/changes/engine.rb +271 -0
- data/lib/rhoconnect/handler/changes/execute_methods.rb +88 -0
- data/lib/rhoconnect/handler/changes/pass_through_runner.rb +11 -0
- data/lib/rhoconnect/handler/changes/runner.rb +53 -0
- data/lib/rhoconnect/handler/changes.rb +31 -0
- data/lib/rhoconnect/handler/helpers/auth_method.rb +29 -0
- data/lib/rhoconnect/handler/helpers/binding.rb +18 -0
- data/lib/rhoconnect/handler/helpers/bulk_data.rb +53 -0
- data/lib/rhoconnect/handler/helpers/source_job.rb +14 -0
- data/lib/rhoconnect/handler/helpers.rb +4 -0
- data/lib/rhoconnect/handler/plugin_callbacks/execute_methods.rb +99 -0
- data/lib/rhoconnect/handler/plugin_callbacks/runner.rb +28 -0
- data/lib/rhoconnect/handler/plugin_callbacks.rb +67 -0
- data/lib/rhoconnect/handler/query/engine.rb +93 -0
- data/lib/rhoconnect/handler/query/execute_methods.rb +21 -0
- data/lib/rhoconnect/handler/query/pass_through_runner.rb +35 -0
- data/lib/rhoconnect/handler/query/runner.rb +270 -0
- data/lib/rhoconnect/handler/query.rb +19 -0
- data/lib/rhoconnect/handler/search/engine.rb +60 -0
- data/lib/rhoconnect/handler/search/execute_methods.rb +32 -0
- data/lib/rhoconnect/handler/search/pass_through_runner.rb +18 -0
- data/lib/rhoconnect/handler/search/runner.rb +104 -0
- data/lib/rhoconnect/handler/search.rb +26 -0
- data/lib/rhoconnect/handler/sync.rb +29 -0
- data/lib/rhoconnect/jobs/source_job.rb +13 -4
- data/lib/rhoconnect/js_adapter.rb +79 -0
- data/lib/rhoconnect/license.rb +10 -2
- data/lib/rhoconnect/middleware/current_user.rb +14 -1
- data/lib/rhoconnect/middleware/helpers.rb +10 -93
- data/lib/rhoconnect/middleware/x_domain_session_wrapper.rb +1 -1
- data/lib/rhoconnect/model/base.rb +229 -0
- data/lib/rhoconnect/model/dynamic_adapter_model.rb +90 -0
- data/lib/rhoconnect/model/js_base.rb +121 -0
- data/lib/rhoconnect/ping/android.rb +1 -1
- data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +7 -4
- data/lib/rhoconnect/read_state.rb +3 -3
- data/lib/rhoconnect/server.rb +159 -190
- data/lib/rhoconnect/source.rb +100 -11
- data/lib/rhoconnect/stats/record.rb +10 -10
- data/lib/rhoconnect/store.rb +905 -591
- data/lib/rhoconnect/{model.rb → store_orm.rb} +53 -115
- data/lib/rhoconnect/tasks.rb +18 -4
- data/lib/rhoconnect/test_methods.rb +30 -17
- data/lib/rhoconnect/user.rb +35 -17
- data/lib/rhoconnect/utilities.rb +1 -1
- data/lib/rhoconnect/version.rb +2 -2
- data/lib/rhoconnect/web-console/server.rb +29 -14
- data/lib/rhoconnect/web-console/views/home.js +10 -10
- data/lib/rhoconnect/web-console/views/new_ping.js +1 -1
- data/lib/rhoconnect.rb +120 -51
- data/rhoconnect.gemspec +4 -3
- data/spec/api/api_helper.rb +1 -6
- data/spec/api/app/fast_delete_spec.rb +4 -4
- data/spec/api/app/fast_insert_spec.rb +4 -4
- data/spec/api/app/fast_update_spec.rb +8 -8
- data/spec/api/app/push_deletes_spec.rb +2 -2
- data/spec/api/app/push_objects_spec.rb +5 -5
- data/spec/api/client/client_get_db_doc_spec.rb +6 -4
- data/spec/api/client/client_set_db_doc_spec.rb +3 -2
- data/spec/api/client/get_client_params_spec.rb +14 -0
- data/spec/api/client/list_client_docs_spec.rb +30 -20
- data/spec/api/client/reset_spec.rb +36 -0
- data/spec/api/source/get_source_params_spec.rb +23 -17
- data/spec/api/system/get_license_info_spec.rb +0 -20
- data/spec/api/system/login_spec.rb +8 -0
- data/spec/api/system/reset_spec.rb +0 -1
- data/spec/api/system/stats_spec.rb +5 -5
- data/spec/api/user/create_user_spec.rb +14 -6
- data/spec/api/user/delete_user_spec.rb +20 -18
- data/spec/api/user/list_users_spec.rb +5 -6
- data/spec/api/user/update_user_spec.rb +5 -4
- data/spec/apps/rhotestapp/config.ru +16 -1
- data/spec/apps/rhotestapp/controllers/js/js_sample_controller.js +23 -0
- data/spec/apps/rhotestapp/controllers/js/sample2_controller.js +32 -0
- data/spec/apps/rhotestapp/controllers/ruby/application_controller.rb +21 -0
- data/spec/apps/rhotestapp/controllers/ruby/sample_adapter_controller.rb +8 -0
- data/spec/apps/rhotestapp/models/js/js_sample.js +55 -0
- data/spec/apps/rhotestapp/models/js/sample2.js +25 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/base_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/fixed_schema_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/other_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/sample_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/simple_adapter.rb +2 -2
- data/spec/apps/rhotestapp/{sources → models/ruby}/sub_adapter.rb +0 -0
- data/spec/apps/rhotestapp/settings/settings.yml +0 -1
- data/spec/bulk_data/bulk_data_spec.rb +20 -5
- data/spec/cli/cli_spec.rb +83 -0
- data/spec/client_spec.rb +20 -17
- data/spec/client_sync_spec.rb +244 -406
- data/spec/controllers/js_base_spec.rb +89 -0
- data/spec/doc/doc_spec.rb +18 -18
- data/spec/document_spec.rb +29 -13
- data/spec/dynamic_adapter_spec.rb +6 -6
- data/spec/generator/generator_spec.rb +7 -4
- data/spec/jobs/bulk_data_job_spec.rb +14 -10
- data/spec/jobs/source_job_spec.rb +8 -8
- data/spec/license_spec.rb +5 -2
- data/spec/models/js_model_spec.rb +39 -0
- data/spec/node_spec.rb +42 -0
- data/spec/perf/store_perf_spec.rb +67 -12
- data/spec/ping/android_spec.rb +1 -1
- data/spec/read_state_spec.rb +1 -1
- data/spec/rhoconnect_spec.rb +1 -1
- data/spec/server/cors_spec.rb +14 -18
- data/spec/server/server_spec.rb +265 -88
- data/spec/server/stats_spec.rb +1 -1
- data/spec/source_adapter_spec.rb +54 -27
- data/spec/source_spec.rb +8 -3
- data/spec/source_sync_spec.rb +538 -468
- data/spec/spec_helper.rb +35 -4
- data/spec/stats/record_spec.rb +10 -10
- data/spec/{model_spec.rb → store_orm_spec.rb} +56 -54
- data/spec/store_spec.rb +159 -179
- data/spec/support/shared_examples.rb +36 -27
- data/spec/sync_states_spec.rb +40 -33
- data/spec/test_methods_spec.rb +18 -14
- data/spec/user_spec.rb +17 -30
- metadata +156 -52
- data/bench/benchapp/application.rb +0 -39
- data/bench/blobapp/application.rb +0 -44
- data/commands/rhoconnect/clean_start.rb +0 -9
- data/commands/rhoconnect/create_user.rb +0 -18
- data/commands/rhoconnect/delete_device.rb +0 -9
- data/commands/rhoconnect/delete_user.rb +0 -8
- data/commands/rhoconnect/reset.rb +0 -16
- data/commands/rhoconnect/reset_refresh.rb +0 -11
- data/generators/templates/application/application.rb +0 -43
- data/lib/rhoconnect/client_sync.rb +0 -434
- data/lib/rhoconnect/dynamic_adapter.rb +0 -91
- data/lib/rhoconnect/middleware/admin_user.rb +0 -23
- data/lib/rhoconnect/middleware/current_request.rb +0 -16
- data/lib/rhoconnect/middleware/login_required.rb +0 -22
- data/lib/rhoconnect/source_adapter.rb +0 -132
- data/lib/rhoconnect/source_sync.rb +0 -464
- data/spec/apps/rhotestapp/application.rb +0 -23
data/doc/source-adapters.txt
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
RhoConnect Source Adapters
|
1
|
+
RhoConnect Source Adapters (Ruby)
|
2
2
|
===
|
3
3
|
|
4
|
-
Connecting to a backend service with RhoConnect requires that you write a small amount of code for the query, create, update and delete operations of your particular enterprise backend. One way to do this is through a RhoConnect source adapter, which is a collection of Ruby code for these operations.
|
5
|
-
|
6
|
-
You can generate a RhoConnect source adapter with RhoStudio or with the `rhoconnect` utility command line tool.
|
7
|
-
|
8
4
|
## Generating the Source Adapter from RhoStudio
|
9
5
|
|
10
|
-
To generate a RhoConnect source adapter and create the associated Controller templates, open your
|
6
|
+
To generate a RhoConnect source adapter and create the associated Controller/Model templates, open your RhoConnect project in RhoStudio. Then right-click on the project in the Project Explorer and select New->RhoConnect Source Adapter.
|
11
7
|
|
12
8
|
<img src="http://rhodocs.s3.amazonaws.com/rhoconnect-tutorial/menu-new-rhoconnect_source-adapter.png"/>
|
13
9
|
|
@@ -23,347 +19,314 @@ After pressing the Finish button, you'll see the RhoConnect source adapter gener
|
|
23
19
|
|
24
20
|
## Generating the Source Adapter from the Command Line
|
25
21
|
|
26
|
-
To generate a source for your RhoConnect application, you can run the `rhoconnect source` command within your application directory.
|
27
|
-
|
28
|
-
:::term
|
29
|
-
Usage: rhoconnect source name [options] [args]
|
30
|
-
|
31
|
-
Generates a new source adapter.
|
32
|
-
|
33
|
-
Required:
|
34
|
-
name - the source name(i.e. product)
|
22
|
+
To generate a source adapter for your RhoConnect application, you can run the `rhoconnect source` command within your application directory.
|
35
23
|
|
24
|
+
:::term
|
25
|
+
$ rhoconnect source
|
26
|
+
Usage: rhoconnect source name [options] [args]
|
36
27
|
|
37
|
-
|
28
|
+
Generates a new source adapter.
|
38
29
|
|
39
|
-
|
40
|
-
|
41
|
-
-f, --force Overwrite files that already exist.
|
42
|
-
-s, --skip Skip files that already exist.
|
43
|
-
-d, --delete Delete files that have previously been generated with this generator.
|
44
|
-
--no-color Don't colorize the output
|
45
|
-
-h, --help Show this message
|
46
|
-
--debug Do not catch errors
|
30
|
+
Required:
|
31
|
+
name - the source adapter name(i.e. product)
|
47
32
|
|
48
|
-
For the storeserver application example, within the sourceserver directory, run:
|
49
33
|
|
50
|
-
|
51
|
-
$ rhoconnect source product
|
52
|
-
Generating with source generator:
|
53
|
-
[ADDED] sources/product.rb
|
54
|
-
[ADDED] spec/sources/product_spec.rb
|
34
|
+
Options specific for this generator:
|
55
35
|
|
56
|
-
|
36
|
+
General options:
|
37
|
+
-p, --pretend Run, but do not make any changes.
|
38
|
+
-f, --force Overwrite files that already exist.
|
39
|
+
-s, --skip Skip files that already exist.
|
40
|
+
-d, --delete Delete files that have previously been generated with this generator.
|
41
|
+
--no-color Don't colorize the output
|
42
|
+
-h, --help Show this message
|
43
|
+
--debug Do not catch errors
|
57
44
|
|
58
|
-
|
45
|
+
For the storeserver application example, within the storeserver directory, run:
|
59
46
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
47
|
+
:::term
|
48
|
+
$ rhoconnect source product
|
49
|
+
Generating with source generator:
|
50
|
+
[ADDED] models/ruby/product.rb
|
51
|
+
[ADDED] controllers/ruby/product_controller.rb
|
52
|
+
[ADDED] spec/models/ruby/product_spec.rb
|
53
|
+
[ADDED] spec/controllers/ruby/product_controller_spec.rb
|
65
54
|
|
66
|
-
|
67
|
-
# TODO: Login to your data source here if necessary
|
68
|
-
end
|
55
|
+
## Understanding the Generated Controller File
|
69
56
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# @result = {
|
74
|
-
# "1"=>{"name"=>"Acme", "industry"=>"Electronics"},
|
75
|
-
# "2"=>{"name"=>"Best", "industry"=>"Software"}
|
76
|
-
# }
|
77
|
-
raise SourceAdapterException.new("Please provide some code to read records from the backend data source")
|
78
|
-
end
|
57
|
+
The generated source adapter's controller file (in this case, product_controller.rb) is similar to the code listing below.
|
58
|
+
Its purpose is to define the RhoConnect application HTTP end point and to register the corresponding SYNC routes.
|
59
|
+
Under the hood - it's an isolated Sinatra application designated to handle all incoming Product requests:
|
79
60
|
|
80
|
-
|
81
|
-
|
82
|
-
|
61
|
+
:::ruby
|
62
|
+
class ProductController < Rhoconnect::Controller::Base
|
63
|
+
register Rhoconnect::EndPoint
|
83
64
|
|
84
|
-
|
85
|
-
|
86
|
-
# If your rhodes rhom object contains image/binary data
|
87
|
-
# (has the image_uri attribute), then a blob will be provided
|
88
|
-
raise "Please provide some code to create a single record in the backend data source using the create_hash"
|
89
|
-
end
|
65
|
+
# add all SYNC routes
|
66
|
+
register Rhoconnect::Handler::Sync
|
90
67
|
|
91
|
-
|
92
|
-
|
93
|
-
raise "Please provide some code to update a single record in the backend data source using the update_hash"
|
94
|
-
end
|
68
|
+
# add your custom Product routes here
|
69
|
+
end
|
95
70
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
71
|
+
## Understanding the Generated Model File
|
72
|
+
|
73
|
+
The generated source adapter's model file (in this case, product.rb) is similar to the code listing below:
|
74
|
+
|
75
|
+
:::ruby
|
76
|
+
class Product < Rhoconnect::Model::Base
|
77
|
+
def initialize(source)
|
78
|
+
super(source)
|
79
|
+
end
|
80
|
+
|
81
|
+
def login
|
82
|
+
# TODO: Login to your data source here if necessary
|
83
|
+
end
|
84
|
+
|
85
|
+
def query
|
86
|
+
# TODO: Query your backend data source and assign the records
|
87
|
+
# to a nested hash structure called @result. For example:
|
88
|
+
# @result = {
|
89
|
+
# "1"=>{"name"=>"Acme", "industry"=>"Electronics"},
|
90
|
+
# "2"=>{"name"=>"Best", "industry"=>"Software"}
|
91
|
+
# }
|
92
|
+
raise Rhoconnect::Model::Exception.new("Please provide some code to read records from the backend data source")
|
93
|
+
end
|
94
|
+
|
95
|
+
def create(create_hash)
|
96
|
+
# TODO: Create a new record in your backend data source
|
97
|
+
# If your rhodes rhom object contains image/binary data
|
98
|
+
# (has the image_uri attribute), then a blob will be provided
|
99
|
+
raise "Please provide some code to create a single record in the backend data source using the create_hash"
|
100
|
+
end
|
101
|
+
|
102
|
+
def update(update_hash)
|
103
|
+
# TODO: Update an existing record in your backend data source
|
104
|
+
raise "Please provide some code to update a single record in the backend data source using the update_hash"
|
105
|
+
end
|
106
|
+
|
107
|
+
def delete(delete_hash)
|
108
|
+
# TODO: write some code here if applicable
|
109
|
+
# be sure to have a hash key and value for "object"
|
110
|
+
# for now, we'll say that its OK to not have a delete operation
|
111
|
+
# raise "Please provide some code to delete a single object in the backend application using the object_id"
|
112
|
+
end
|
113
|
+
|
114
|
+
def logoff
|
115
|
+
# TODO: Logout from the data source if necessary
|
116
|
+
end
|
117
|
+
end
|
102
118
|
|
103
|
-
|
104
|
-
# TODO: Logout from the data source if necessary
|
105
|
-
end
|
106
|
-
end
|
119
|
+
During generation of the model, the `settings/settings.yml` file will be updated with some default options for the corresponding source:
|
107
120
|
|
108
|
-
|
121
|
+
:::yaml
|
122
|
+
:sources:
|
123
|
+
Product:
|
124
|
+
:poll_interval: 300
|
109
125
|
|
110
|
-
:::yaml
|
111
|
-
:sources:
|
112
|
-
Product:
|
113
|
-
:poll_interval: 300
|
114
126
|
|
115
127
|
## Source Adapter API
|
116
|
-
The source adapter interface is described below, your source adapter can use any of these methods to interact with your backend service.
|
117
|
-
|
118
|
-
### `login`
|
119
|
-
Login to your backend service (optional).
|
120
|
-
|
121
|
-
:::ruby
|
122
|
-
def login
|
123
|
-
MyWebService.login(current_user.login)
|
124
|
-
end
|
125
|
-
|
126
|
-
### `logoff`
|
127
|
-
Logoff from your backend service (optional).
|
128
|
-
|
129
|
-
:::ruby
|
130
|
-
def logoff
|
131
|
-
MyWebService.logoff(current_user.login)
|
132
|
-
end
|
133
|
-
|
134
|
-
### `query(params = nil)`
|
135
|
-
Query your backend service and build a hash of hashes (required).
|
136
|
-
|
137
|
-
**NOTE: This method must assign `@result` to a hash of hashes. If @result is `nil` or `{}`, the master document will be erased from redis.**
|
138
|
-
|
139
|
-
:::ruby
|
140
|
-
def query
|
141
|
-
parsed = JSON.parse(RestClient.get("#{@base}.json").body)
|
142
|
-
|
143
|
-
@result = {}
|
144
|
-
parsed.each do |item|
|
145
|
-
@result[item["product"]["id"].to_s] = item["product"]
|
146
|
-
end if parsed
|
147
|
-
end
|
148
|
-
|
149
|
-
### `search(params)`
|
150
|
-
Search your backend based on params and build a hash of hashes (optional). Similar to query, however the master document accumulates the data in `@result` instead of replacing when it runs.
|
151
|
-
|
152
|
-
:::ruby
|
153
|
-
def search(params)
|
154
|
-
parsed = JSON.parse(RestClient.get("#{@base}.json").body)
|
155
|
-
|
156
|
-
@result = {}
|
157
|
-
parsed.each do |item|
|
158
|
-
if item["product"]["name"].downcase == params['name'].downcase
|
159
|
-
@result[item["product"]["id"].to_s] = item["product"]
|
160
|
-
end
|
161
|
-
end if parsed
|
162
|
-
end
|
163
|
-
|
164
|
-
Next, you will need to add search to your Rhodes application. For details, see the [Rhodes search section](/rhodes/synchronization#filtering-datasets-with-search).
|
165
128
|
|
166
|
-
###
|
167
|
-
Create a new record in the backend (optional).
|
129
|
+
### Source Adapter Controller API (Ruby)
|
168
130
|
|
169
|
-
|
131
|
+
You can use the following methods and techniques inside of your source adapter controller.
|
170
132
|
|
171
|
-
|
172
|
-
|
173
|
-
|
133
|
+
* [@model](/rhoconnectapi/source-adapter-controller-api-ruby#@model) - Access to the source adapter's model instance.
|
134
|
+
* [params,request,response](/rhoconnectapi/source-adapter-controller-api-ruby#sinatra-context) - Allows to use any standard Sinatra context objects.
|
135
|
+
* [Sinatra framework](/rhoconnectapi/source-adapter-controller-api-ruby#sinatra-features) - Allows to use any standard Sinatra features.
|
174
136
|
|
175
|
-
|
176
|
-
res.new_id
|
177
|
-
end
|
137
|
+
### Source Adapter Model API (Ruby)
|
178
138
|
|
179
|
-
|
180
|
-
Update an existing record in the backend (optional).
|
139
|
+
You can write the following methods for your source adapter model. These methods will be called by the controller at run-time and allow your source adapter model to interact with your backend service.
|
181
140
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
### `current_user`
|
195
|
-
Returns the current user which called the adapter. For example, you could filter results for a specific user in your query method:
|
196
|
-
|
197
|
-
:::ruby
|
198
|
-
def query
|
199
|
-
@result = MyWebService.get_records_for_user(current_user.login)
|
200
|
-
end
|
201
|
-
|
202
|
-
### `stash_result`
|
203
|
-
Saves the current state of `@result` to redis and assigns it to `nil`. Typically this is used when your adapter has to paginate through backend service data.
|
204
|
-
|
205
|
-
:::ruby
|
206
|
-
def query
|
207
|
-
@result = {}
|
208
|
-
('a'..'z').each_with_index do |letter,i|
|
209
|
-
@result ||= {}
|
210
|
-
@result.merge!( DictionaryService.get_records_for(letter) )
|
211
|
-
stash_result if i % 2 == 0
|
212
|
-
end
|
213
|
-
end
|
141
|
+
* [login](/rhoconnectapi/source-adapter-model-api-ruby#login) - Login to your backend service (optional).
|
142
|
+
* [logoff](/rhoconnectapi/source-adapter-model-api-ruby#logoff) - Logoff from your backend service (optional).
|
143
|
+
* [query](/rhoconnectapi/source-adapter-model-api-ruby#query) - Query your backend service and build a hash of hashes (required).
|
144
|
+
* [search](/rhoconnectapi/source-adapter-model-api-ruby#search) - Search your backend based on params and build a hash of hashes (optional).
|
145
|
+
* [create](/rhoconnectapi/source-adapter-model-api-ruby#create) - Create a new record in the backend (optional).
|
146
|
+
* [update](/rhoconnectapi/source-adapter-model-api-ruby#update) - Update an existing record in the backend.
|
147
|
+
* [delete](/rhoconnectapi/source-adapter-model-api-ruby#delete) - Delete an existing record in the backend.
|
148
|
+
* [current_user](/rhoconnectapi/source-adapter-model-api-ruby#currentuser) - Returns the current user which called the adapter's model.
|
149
|
+
* [stash_result](/rhoconnectapi/source-adapter-model-api-ruby#stashresult) - Saves the current state of `@result` to redis and assigns it to `nil`.
|
150
|
+
* [store_blob](/rhoconnectapi/source-adapter-model-api-ruby#store_blob) - Save the incoming blob data into permanent storage for the future processing.
|
151
|
+
* [get_data](/rhoconnectapi/source-adapter-model-api-ruby#get_data) - Get the model document data from Store.
|
214
152
|
|
215
153
|
## Data Partitioning
|
154
|
+
|
216
155
|
Data is stored in RhoConnect using [redis sets](http://redis.io/commands#set). The `@result` hash from the `query` method is stored in redis and referred to as the Master Document or MD.
|
217
156
|
|
218
|
-
The MD is referenced in RhoConnect by a corresponding partition. Source adapters can partition data in two ways: user and app. As you might have guessed, user partitioning stores a copy of the source adapter MD for each user (one copy shared across all devices for a user).
|
157
|
+
The MD is referenced in RhoConnect by a corresponding partition. Source adapters can partition data in two ways: user and app. As you might have guessed, user partitioning stores a copy of the source adapter MD for each user (one copy shared across all devices for a given user).
|
219
158
|
|
220
|
-
Likewise, app partitioning stores one copy of the source adapter MD for the entire application (all users and devices share the same data). App partitioning can be particularly useful if you have source
|
159
|
+
Likewise, app partitioning stores one copy of the source adapter MD for the entire application (all users and devices share the same data). App partitioning can be particularly useful if you have source adapter models which retrieve large amounts of data that is fixed from user to user, for example a global product catalog. Using app partitioning wherever possible ***greatly reduces*** the amount of data in redis.
|
221
160
|
|
222
161
|
### User Partition
|
223
|
-
User partitioning is the default
|
162
|
+
User partitioning is the default mode for source adapters, however you can explicitly define it in `settings/settings.yml` with:
|
224
163
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
164
|
+
:::yaml
|
165
|
+
:sources:
|
166
|
+
Product:
|
167
|
+
:poll_interval: 300
|
168
|
+
:partition_type: user
|
230
169
|
|
231
170
|
### App Partition
|
232
171
|
Enable app partitioning the same way:
|
233
172
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
173
|
+
:::yaml
|
174
|
+
:sources:
|
175
|
+
Product:
|
176
|
+
:poll_interval: 300
|
177
|
+
:partition_type: app
|
239
178
|
|
240
179
|
Now you have a single copy of the `Product` source adapter dataset for all users.
|
241
180
|
|
242
181
|
## Pass Through
|
243
|
-
RhoConnect provides a simple way to keep data out of redis. If you have sensitive data that you do not want saved in redis, add the pass_through option in settings/settings.yml for each source:
|
182
|
+
RhoConnect provides a simple way to keep data out of redis. If you have sensitive data that you do not want saved in redis, add the `pass_through` option in settings/settings.yml for each source:
|
244
183
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
184
|
+
:::yaml
|
185
|
+
:sources:
|
186
|
+
Product:
|
187
|
+
:pass_through: true
|
249
188
|
|
250
189
|
**NOTE: When running query or search the entire data set will be returned from your backend service. **
|
251
190
|
|
252
191
|
## Redis Interface
|
253
192
|
RhoConnect provides a simple redis interface for saving/retrieving arbitrary data. This is useful if you want to save data in your application to be used later (i.e. in an async job or a subsequent source adapter execution).
|
254
193
|
|
255
|
-
|
256
|
-
|
194
|
+
:::ruby
|
195
|
+
Store.put_value('hello','world')
|
257
196
|
|
258
|
-
|
197
|
+
Store.get_value('hello') #=> 'world'
|
259
198
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
199
|
+
# You can store nested hashes too!
|
200
|
+
Store.put_data(
|
201
|
+
'mydata',
|
202
|
+
{
|
203
|
+
'1' => { 'hello' => 'world' }
|
204
|
+
}
|
205
|
+
)
|
267
206
|
|
268
|
-
|
207
|
+
Store.get_data('mydata') #=> { '1' => { 'hello' => 'world' } }
|
269
208
|
|
270
209
|
## Handling Exceptions
|
271
|
-
If your source adapter raises an instance of `
|
210
|
+
If your source adapter model raises an instance of `Rhoconnect::Model::Exception`, the resulting message will be sent to the client's sync callback(in `@params['error_message']`). See the rhodes [sync exception handling docs](/rhodes/synchronization#handling-exceptions) for more details.
|
272
211
|
|
273
|
-
You can use `
|
212
|
+
You can use `Rhoconnect::Model::Exception` as a convenient way to notify your application of various error conditions.
|
274
213
|
|
275
214
|
For example, your delete method might check the web service HTTP response code was 200 to make sure the record was deleted:
|
276
215
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
216
|
+
:::ruby
|
217
|
+
def delete(delete_hash)
|
218
|
+
rest_result = RestClient.delete("#{@base}/#{delete_hash['id']}")
|
219
|
+
if rest_result.code != 200
|
220
|
+
raise Rhoconnect::Model::Exception.new("Error deleting record.")
|
221
|
+
end
|
222
|
+
end
|
284
223
|
|
285
224
|
**NOTE: When your adapter method raises an exception, no data is removed from the adapter's master document.**
|
286
225
|
|
287
226
|
The following exceptions are provided for convenience:
|
288
227
|
|
289
|
-
### `
|
290
|
-
Useful to raise in your
|
228
|
+
### `Rhoconnect::Model::LoginException`
|
229
|
+
Useful to raise in your model's login method if it failed.
|
291
230
|
|
292
|
-
### `
|
293
|
-
Similar to login, raise this if your
|
231
|
+
### `Rhoconnect::Model::LogoffException`
|
232
|
+
Similar to login, raise this if your model's logoff failed.
|
294
233
|
|
295
|
-
### `
|
234
|
+
### `Rhoconnect::Model::ServerTimeoutException`
|
296
235
|
Raise if your backend service connection times out.
|
297
236
|
|
298
|
-
### `
|
237
|
+
### `Rhoconnect::Model::ServerErrorException`
|
299
238
|
Raise this if your backend service returns a non-successful response.
|
300
239
|
|
301
240
|
|
302
241
|
## Handling Conflicts
|
303
242
|
|
304
|
-
Handling conflicts in RhoConnect follows the same pattern as handling exceptions. Once your
|
243
|
+
Handling conflicts in RhoConnect follows the same pattern as handling exceptions. Once your model method has detected a conflict, you can raise a `Rhoconnect::Model::ObjectConflictError` which will be sent to your application's sync callback.
|
305
244
|
|
306
|
-
### `
|
307
|
-
Raise this if your
|
245
|
+
### `Rhoconnect::Model::ObjectConflictError`
|
246
|
+
Raise this if your model has detected a conflict.
|
308
247
|
|
309
|
-
|
310
|
-
|
248
|
+
:::ruby
|
249
|
+
def update(update_hash)
|
311
250
|
obj_id = update_hash['id']
|
312
251
|
update_hash.delete('id')
|
313
252
|
rest_result = RestClient.put("#{@base}/#{obj_id}",:product => update_hash)
|
314
|
-
|
315
|
-
|
316
|
-
|
253
|
+
if rest_result.code != 200
|
254
|
+
raise Rhoconnect::Model::ObjectConflictError.new("Conflict detected updating the object.")
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
## Sample Model
|
259
|
+
Here's a complete example of how the completed [product model might look](https://github.com/rhomobile/store-server/blob/master/sources/product.rb):
|
260
|
+
|
261
|
+
:::ruby
|
262
|
+
require 'json'
|
263
|
+
require 'rest_client'
|
264
|
+
|
265
|
+
class Product < Rhoconnect::Model::Base
|
266
|
+
|
267
|
+
def initialize(source)
|
268
|
+
@base = 'http://rhostore.herokuapp.com/products'
|
269
|
+
super(source)
|
270
|
+
end
|
271
|
+
|
272
|
+
def query(params=nil)
|
273
|
+
rest_result = RestClient.get("#{@base}.json").body
|
274
|
+
|
275
|
+
if rest_result.code != 200
|
276
|
+
raise Rhoconnect::Model::Exception.new("Error connecting!")
|
277
|
+
end
|
278
|
+
parsed = JSON.parse(rest_result)
|
279
|
+
|
280
|
+
@result={}
|
281
|
+
parsed.each do |item|
|
282
|
+
@result[item["product"]["id"].to_s] = item["product"]
|
283
|
+
end if parsed
|
284
|
+
end
|
285
|
+
|
286
|
+
def create(create_hash)
|
287
|
+
res = RestClient.post(@base,:product => create_hash)
|
288
|
+
|
289
|
+
# After create we are redirected to the new record.
|
290
|
+
# We need to get the id of that record and return
|
291
|
+
# it as part of create so rhoconnect can establish a link
|
292
|
+
# from its temporary object on the client to this newly
|
293
|
+
# created object on the server
|
294
|
+
JSON.parse(
|
295
|
+
RestClient.get("#{res.headers[:location]}.json").body
|
296
|
+
)["product"]["id"]
|
297
|
+
end
|
298
|
+
|
299
|
+
def update(update_hash)
|
300
|
+
obj_id = update_hash['id']
|
301
|
+
update_hash.delete('id')
|
302
|
+
RestClient.put("#{@base}/#{obj_id}",:product => update_hash)
|
303
|
+
end
|
304
|
+
|
305
|
+
def delete(delete_hash)
|
306
|
+
RestClient.delete("#{@base}/#{delete_hash['id']}")
|
307
|
+
end
|
317
308
|
end
|
318
309
|
|
319
|
-
##
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
parsed.each do |item|
|
343
|
-
@result[item["product"]["id"].to_s] = item["product"]
|
344
|
-
end if parsed
|
345
|
-
end
|
346
|
-
|
347
|
-
def create(create_hash)
|
348
|
-
res = RestClient.post(@base,:product => create_hash)
|
349
|
-
|
350
|
-
# After create we are redirected to the new record.
|
351
|
-
# We need to get the id of that record and return
|
352
|
-
# it as part of create so rhoconnect can establish a link
|
353
|
-
# from its temporary object on the client to this newly
|
354
|
-
# created object on the server
|
355
|
-
JSON.parse(
|
356
|
-
RestClient.get("#{res.headers[:location]}.json").body
|
357
|
-
)["product"]["id"]
|
358
|
-
end
|
359
|
-
|
360
|
-
def update(update_hash)
|
361
|
-
obj_id = update_hash['id']
|
362
|
-
update_hash.delete('id')
|
363
|
-
RestClient.put("#{@base}/#{obj_id}",:product => update_hash)
|
364
|
-
end
|
365
|
-
|
366
|
-
def delete(delete_hash)
|
367
|
-
RestClient.delete("#{@base}/#{delete_hash['id']}")
|
368
|
-
end
|
369
|
-
end
|
310
|
+
## Compatibility with older versions of RhoConnect
|
311
|
+
|
312
|
+
The RhoConnect Source Adapter Controller/Model concept has been introduced in RhoConnect 4. In previous versions, a Source Adapter consisted only of one class - which is now has been moved to Source Adapter model. "Controller" part of the Source Adapter has been hidden inside of the RhoConnect library code. This posed a significant obstacle in a way how the developer could utilize the code and the common techniques. To overcome this obstacle, RhoConnect 4 provides you with direct access to the Controller allowing you to customize route behavior and utilize all of the powerful sinatra plugins/extensions that are available.
|
313
|
+
|
314
|
+
At the same time, applications that were written using the pre-4.0 versions of RhoConnect will still continue to function without modifications for at least one version cycle. This is accomplished by providing the "default" implementation of the controller for the pre-4.0 Source Adapters. All the Model APIs that are described throughout the documentation are still applicable to the pre-4.0 Source Adapters. In this sense - the RhoConnect 4 Source Adapter Model class and pre-4.0 Source Adapter are interchangeable.
|
315
|
+
|
316
|
+
However, we strongly recommend migrating your pre-4.0 application using this [guide](migration). RhoConnect 4 will print a warning at startup if it detects a pre-4.0 code structure.
|
317
|
+
|
318
|
+
RhoConnect has detected that you're using deprecated Application class.
|
319
|
+
|
320
|
+
Application class support will be removed in RhoConnect 4.1.
|
321
|
+
Please, migrate your Application class into ApplicationController.
|
322
|
+
|
323
|
+
For more details, see RhoConnect Migration guidelines at
|
324
|
+
docs.rhomobile.com
|
325
|
+
|
326
|
+
RhoConnect has detected that you're using deprecated SourceAdapter classes.
|
327
|
+
|
328
|
+
SourceAdapter class support will be removed in RhoConnect 4.1.
|
329
|
+
Please, migrate your SourceAdapter classes into RhoConnect Models.
|
330
|
+
|
331
|
+
For more details, see RhoConnect Migration guidelines at
|
332
|
+
docs.rhomobile.com
|
data/doc/stats-middleware.txt
CHANGED
@@ -11,37 +11,17 @@ To enable stats in your RhoConnect application, simply turn on the stats middlew
|
|
11
11
|
A complete config.ru might look like:
|
12
12
|
|
13
13
|
:::ruby
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
rescue LoadError
|
19
|
-
require 'rhoconnect/server'
|
20
|
-
require 'rhoconnect/console/server'
|
21
|
-
end
|
22
|
-
|
23
|
-
# By default, turn on the resque web console
|
24
|
-
require 'resque/server'
|
25
|
-
|
26
|
-
ROOT_PATH = File.expand_path(File.dirname(__FILE__))
|
27
|
-
|
28
|
-
# Rhoconnect server flags
|
29
|
-
Rhoconnect::Server.disable :run
|
30
|
-
Rhoconnect::Server.disable :clean_trace
|
31
|
-
Rhoconnect::Server.enable :raise_errors
|
32
|
-
Rhoconnect::Server.set :secret, '<changeme>'
|
33
|
-
Rhoconnect::Server.set :root, ROOT_PATH
|
34
|
-
Rhoconnect::Server.enable :stats
|
35
|
-
Rhoconnect::Server.use Rack::Static, :urls => ["/data"], :root => Rhoconnect::Server.root
|
14
|
+
require 'rhoconnect/application/init'
|
15
|
+
|
16
|
+
# secret is generated along with the app
|
17
|
+
Rhoconnect::Server.set :secret, 'my_secret'
|
36
18
|
|
37
|
-
#
|
38
|
-
|
19
|
+
# !!! Add your custom initializers and overrides here !!!
|
20
|
+
Rhoconnect::Server.enable :stats
|
39
21
|
|
40
|
-
#
|
41
|
-
run
|
42
|
-
|
43
|
-
"/resque" => Resque::Server.new, # If you don't want resque frontend, disable it here
|
44
|
-
"/console" => RhoconnectConsole::Server.new # If you don't want rhoconnect frontend, disable it here
|
22
|
+
# run RhoConnect Application
|
23
|
+
run Rhoconnect.app
|
24
|
+
|
45
25
|
|
46
26
|
Now just restart your rhoconnect application:
|
47
27
|
|