rhoconnect 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. data/CHANGELOG +208 -0
  2. data/CREDITS +38 -0
  3. data/Gemfile +18 -0
  4. data/Gemfile.lock +97 -0
  5. data/LICENSE +75 -0
  6. data/README.md +10 -0
  7. data/Rakefile +82 -0
  8. data/bench/bench +7 -0
  9. data/bench/bench_runner.rb +112 -0
  10. data/bench/benchapp/Gemfile +21 -0
  11. data/bench/benchapp/Gemfile.lock +76 -0
  12. data/bench/benchapp/Rakefile +22 -0
  13. data/bench/benchapp/application.rb +39 -0
  14. data/bench/benchapp/config.ru +36 -0
  15. data/bench/benchapp/settings/license.key +1 -0
  16. data/bench/benchapp/settings/settings.yml +20 -0
  17. data/bench/benchapp/sources/mock_adapter.rb +55 -0
  18. data/bench/benchapp/sources/queue_mock_adapter.rb +2 -0
  19. data/bench/benchapp/spec/sources/mock_adapter_spec.rb +25 -0
  20. data/bench/benchapp/spec/sources/queue_mock_adapter_spec.rb +25 -0
  21. data/bench/benchapp/spec/spec_helper.rb +42 -0
  22. data/bench/blobapp/Gemfile +31 -0
  23. data/bench/blobapp/Gemfile.lock +103 -0
  24. data/bench/blobapp/Rakefile +25 -0
  25. data/bench/blobapp/application.rb +44 -0
  26. data/bench/blobapp/config.ru +36 -0
  27. data/bench/blobapp/settings/license.key +1 -0
  28. data/bench/blobapp/settings/settings.yml +16 -0
  29. data/bench/blobapp/sources/blob_adapter.rb +71 -0
  30. data/bench/blobapp/spec/sources/blob_adapter_spec.rb +25 -0
  31. data/bench/blobapp/spec/spec_helper.rb +42 -0
  32. data/bench/lib/bench/cli.rb +16 -0
  33. data/bench/lib/bench/logging.rb +13 -0
  34. data/bench/lib/bench/mock_client.rb +41 -0
  35. data/bench/lib/bench/result.rb +50 -0
  36. data/bench/lib/bench/runner.rb +107 -0
  37. data/bench/lib/bench/session.rb +67 -0
  38. data/bench/lib/bench/statistics.rb +56 -0
  39. data/bench/lib/bench/test_data.rb +98 -0
  40. data/bench/lib/bench/timer.rb +10 -0
  41. data/bench/lib/bench/utils.rb +49 -0
  42. data/bench/lib/bench.rb +129 -0
  43. data/bench/lib/testdata/100-data.txt +148 -0
  44. data/bench/lib/testdata/5-data.txt +9 -0
  45. data/bench/lib/testdata/images/icon.ico +0 -0
  46. data/bench/lib/testdata/images/icon.png +0 -0
  47. data/bench/lib/testdata/images/loading-Landscape.png +0 -0
  48. data/bench/lib/testdata/images/loading-LandscapeLeft.png +0 -0
  49. data/bench/lib/testdata/images/loading-LandscapeRight.png +0 -0
  50. data/bench/lib/testdata/images/loading-Portrait.png +0 -0
  51. data/bench/lib/testdata/images/loading-PortraitUpsideDown.png +0 -0
  52. data/bench/lib/testdata/images/loading.png +0 -0
  53. data/bench/lib/testdata/images/loading@2x.png +0 -0
  54. data/bench/run_bench.sh +42 -0
  55. data/bench/run_blob_script.sh +3 -0
  56. data/bench/run_cud_script.sh +3 -0
  57. data/bench/run_query_md_script.sh +3 -0
  58. data/bench/run_query_only_script.sh +3 -0
  59. data/bench/run_query_script.sh +3 -0
  60. data/bench/scripts/blob_cud_script.rb +98 -0
  61. data/bench/scripts/cud_script.rb +92 -0
  62. data/bench/scripts/helpers.rb +101 -0
  63. data/bench/scripts/query_md_script.rb +45 -0
  64. data/bench/scripts/query_only_script.rb +51 -0
  65. data/bench/scripts/query_script.rb +45 -0
  66. data/bench/spec/bench_spec_helper.rb +33 -0
  67. data/bench/spec/logging_spec.rb +15 -0
  68. data/bench/spec/mock_adapter_spec.rb +61 -0
  69. data/bench/spec/mock_client_spec.rb +65 -0
  70. data/bench/spec/result_spec.rb +61 -0
  71. data/bench/spec/utils_spec.rb +36 -0
  72. data/bin/rhoconnect +34 -0
  73. data/bin/rhoconnect-setup +84 -0
  74. data/doc/async-jobs.txt +69 -0
  75. data/doc/authentication.txt +76 -0
  76. data/doc/benchmarks.txt +168 -0
  77. data/doc/blob-sync.txt +130 -0
  78. data/doc/bulk-sync.txt +102 -0
  79. data/doc/client.txt +432 -0
  80. data/doc/command-line.txt +210 -0
  81. data/doc/contributing.txt +60 -0
  82. data/doc/deploying.txt +82 -0
  83. data/doc/install.txt +28 -0
  84. data/doc/introduction.txt +20 -0
  85. data/doc/licensing.txt +18 -0
  86. data/doc/metadata.txt +458 -0
  87. data/doc/migration.txt +182 -0
  88. data/doc/public/css/print.css +29 -0
  89. data/doc/public/css/screen.css +257 -0
  90. data/doc/public/css/style.css +20 -0
  91. data/doc/push.txt +135 -0
  92. data/doc/release.txt +41 -0
  93. data/doc/rest-api.txt +367 -0
  94. data/doc/source-adapters.txt +325 -0
  95. data/doc/stats-middleware.txt +69 -0
  96. data/doc/testing.txt +222 -0
  97. data/doc/tutorial.txt +315 -0
  98. data/doc/web-console.txt +35 -0
  99. data/examples/simple/Rakefile +14 -0
  100. data/examples/simple/application.rb +27 -0
  101. data/examples/simple/config.ru +49 -0
  102. data/examples/simple/settings/license.key +1 -0
  103. data/examples/simple/settings/settings.yml +23 -0
  104. data/examples/simple/sources/sample_adapter.rb +5 -0
  105. data/examples/simple/sources/simple_adapter.rb +5 -0
  106. data/generators/rhoconnect.rb +119 -0
  107. data/generators/templates/application/Gemfile +21 -0
  108. data/generators/templates/application/Rakefile +22 -0
  109. data/generators/templates/application/application.rb +39 -0
  110. data/generators/templates/application/config.ru +36 -0
  111. data/generators/templates/application/settings/license.key +1 -0
  112. data/generators/templates/application/settings/settings.yml +14 -0
  113. data/generators/templates/application/spec/spec_helper.rb +42 -0
  114. data/generators/templates/source/source_adapter.rb +47 -0
  115. data/generators/templates/source/source_spec.rb +25 -0
  116. data/install.sh +408 -0
  117. data/installer/unix-like/rho_connect_install_checkers.rb +140 -0
  118. data/installer/unix-like/rho_connect_install_constants.rb +51 -0
  119. data/installer/unix-like/rho_connect_install_debian.rb +63 -0
  120. data/installer/unix-like/rho_connect_install_dnd.rb +58 -0
  121. data/installer/unix-like/rho_connect_install_get_params.rb +30 -0
  122. data/installer/unix-like/rho_connect_install_installers.rb +142 -0
  123. data/installer/unix-like/rho_connect_install_utilities.rb +85 -0
  124. data/installer/unix-like/rho_connect_install_yum.rb +63 -0
  125. data/installer/unix-like/rhoinstaller.rb +89 -0
  126. data/installer/utils/create_texts.rb +366 -0
  127. data/installer/utils/install_test.rb +140 -0
  128. data/installer/windows/EnvVarUpdate.nsh +328 -0
  129. data/installer/windows/ServiceLib.nsh +369 -0
  130. data/installer/windows/configUi.ini +44 -0
  131. data/installer/windows/icon.ico +0 -0
  132. data/installer/windows/rhosync.nsi +418 -0
  133. data/installer/windows/uninstall.bat +7 -0
  134. data/lib/rhoconnect/api/admin/get_api_token.rb +14 -0
  135. data/lib/rhoconnect/api/admin/get_license_info.rb +8 -0
  136. data/lib/rhoconnect/api/admin/login.rb +6 -0
  137. data/lib/rhoconnect/api/admin/reset.rb +10 -0
  138. data/lib/rhoconnect/api/admin/stats.rb +21 -0
  139. data/lib/rhoconnect/api/application/bulk_data.rb +7 -0
  140. data/lib/rhoconnect/api/application/clientcreate.rb +8 -0
  141. data/lib/rhoconnect/api/application/clientlogin.rb +6 -0
  142. data/lib/rhoconnect/api/application/clientregister.rb +6 -0
  143. data/lib/rhoconnect/api/application/clientreset.rb +6 -0
  144. data/lib/rhoconnect/api/application/query.rb +7 -0
  145. data/lib/rhoconnect/api/application/queue_updates.rb +6 -0
  146. data/lib/rhoconnect/api/application/search.rb +6 -0
  147. data/lib/rhoconnect/api/client/create_client.rb +3 -0
  148. data/lib/rhoconnect/api/client/delete_client.rb +5 -0
  149. data/lib/rhoconnect/api/client/get_client_params.rb +3 -0
  150. data/lib/rhoconnect/api/client/list_client_docs.rb +12 -0
  151. data/lib/rhoconnect/api/client/list_clients.rb +3 -0
  152. data/lib/rhoconnect/api/client/ping.rb +7 -0
  153. data/lib/rhoconnect/api/source/get_adapter.rb +3 -0
  154. data/lib/rhoconnect/api/source/get_db_doc.rb +7 -0
  155. data/lib/rhoconnect/api/source/get_source_params.rb +3 -0
  156. data/lib/rhoconnect/api/source/list_source_docs.rb +10 -0
  157. data/lib/rhoconnect/api/source/list_sources.rb +15 -0
  158. data/lib/rhoconnect/api/source/push_deletes.rb +8 -0
  159. data/lib/rhoconnect/api/source/push_objects.rb +8 -0
  160. data/lib/rhoconnect/api/source/save_adapter.rb +3 -0
  161. data/lib/rhoconnect/api/source/set_db_doc.rb +8 -0
  162. data/lib/rhoconnect/api/source/set_refresh_time.rb +8 -0
  163. data/lib/rhoconnect/api/source/upload_file.rb +4 -0
  164. data/lib/rhoconnect/api/user/create_user.rb +7 -0
  165. data/lib/rhoconnect/api/user/delete_user.rb +9 -0
  166. data/lib/rhoconnect/api/user/list_users.rb +3 -0
  167. data/lib/rhoconnect/api/user/update_user.rb +4 -0
  168. data/lib/rhoconnect/api_token.rb +19 -0
  169. data/lib/rhoconnect/app.rb +76 -0
  170. data/lib/rhoconnect/bulk_data/bulk_data.rb +88 -0
  171. data/lib/rhoconnect/bulk_data/syncdb.index.schema +4 -0
  172. data/lib/rhoconnect/bulk_data/syncdb.schema +41 -0
  173. data/lib/rhoconnect/bulk_data.rb +2 -0
  174. data/lib/rhoconnect/client.rb +96 -0
  175. data/lib/rhoconnect/client_sync.rb +412 -0
  176. data/lib/rhoconnect/console/app/helpers/auth_helper.rb +22 -0
  177. data/lib/rhoconnect/console/app/helpers/extensions.rb +19 -0
  178. data/lib/rhoconnect/console/app/helpers/helpers.rb +57 -0
  179. data/lib/rhoconnect/console/app/public/ThickBox.css +649 -0
  180. data/lib/rhoconnect/console/app/public/home.css +438 -0
  181. data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
  182. data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
  183. data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
  184. data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
  185. data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
  186. data/lib/rhoconnect/console/app/public/images/rhomobile_rhohub_logo.png +0 -0
  187. data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
  188. data/lib/rhoconnect/console/app/public/jqplot/excanvas.min.js +35 -0
  189. data/lib/rhoconnect/console/app/public/jqplot/jqplot.barRenderer.min.js +34 -0
  190. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisLabelRenderer.js +187 -0
  191. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisTickRenderer.js +226 -0
  192. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasTextRenderer.js +408 -0
  193. data/lib/rhoconnect/console/app/public/jqplot/jqplot.categoryAxisRenderer.min.js +34 -0
  194. data/lib/rhoconnect/console/app/public/jqplot/jqplot.cursor.js +952 -0
  195. data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.js +313 -0
  196. data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.min.js +34 -0
  197. data/lib/rhoconnect/console/app/public/jqplot/jqplot.pointLabels.min.js +34 -0
  198. data/lib/rhoconnect/console/app/public/jqplot/jquery-1.4.2.min.js +154 -0
  199. data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.css +1 -0
  200. data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.js +34 -0
  201. data/lib/rhoconnect/console/app/public/main.css +7 -0
  202. data/lib/rhoconnect/console/app/public/reset.css +76 -0
  203. data/lib/rhoconnect/console/app/public/style.css +2201 -0
  204. data/lib/rhoconnect/console/app/public/text.txt +0 -0
  205. data/lib/rhoconnect/console/app/routes/adapter.rb +28 -0
  206. data/lib/rhoconnect/console/app/routes/auth.rb +29 -0
  207. data/lib/rhoconnect/console/app/routes/client.rb +31 -0
  208. data/lib/rhoconnect/console/app/routes/docs.rb +145 -0
  209. data/lib/rhoconnect/console/app/routes/heroku.rb +19 -0
  210. data/lib/rhoconnect/console/app/routes/home.rb +63 -0
  211. data/lib/rhoconnect/console/app/routes/timing.rb +242 -0
  212. data/lib/rhoconnect/console/app/routes/user.rb +117 -0
  213. data/lib/rhoconnect/console/app/views/adapter.erb +16 -0
  214. data/lib/rhoconnect/console/app/views/client.erb +30 -0
  215. data/lib/rhoconnect/console/app/views/content.erb +14 -0
  216. data/lib/rhoconnect/console/app/views/doc.erb +8 -0
  217. data/lib/rhoconnect/console/app/views/docdata.erb +28 -0
  218. data/lib/rhoconnect/console/app/views/docs.erb +30 -0
  219. data/lib/rhoconnect/console/app/views/edituser.erb +13 -0
  220. data/lib/rhoconnect/console/app/views/headermenu.erb +40 -0
  221. data/lib/rhoconnect/console/app/views/home.erb +24 -0
  222. data/lib/rhoconnect/console/app/views/index.erb +58 -0
  223. data/lib/rhoconnect/console/app/views/jqplot.erb +52 -0
  224. data/lib/rhoconnect/console/app/views/layout.erb +165 -0
  225. data/lib/rhoconnect/console/app/views/login.erb +26 -0
  226. data/lib/rhoconnect/console/app/views/newuser.erb +17 -0
  227. data/lib/rhoconnect/console/app/views/ping.erb +28 -0
  228. data/lib/rhoconnect/console/app/views/result.erb +11 -0
  229. data/lib/rhoconnect/console/app/views/rightboxlinks.erb +15 -0
  230. data/lib/rhoconnect/console/app/views/select_doc.erb +17 -0
  231. data/lib/rhoconnect/console/app/views/upload_doc.erb +23 -0
  232. data/lib/rhoconnect/console/app/views/user.erb +29 -0
  233. data/lib/rhoconnect/console/app/views/users.erb +12 -0
  234. data/lib/rhoconnect/console/rhoconnect_api.rb +245 -0
  235. data/lib/rhoconnect/console/server.rb +32 -0
  236. data/lib/rhoconnect/console.rb +3 -0
  237. data/lib/rhoconnect/cors.rb +229 -0
  238. data/lib/rhoconnect/credential.rb +9 -0
  239. data/lib/rhoconnect/db_adapter.rb +46 -0
  240. data/lib/rhoconnect/document.rb +49 -0
  241. data/lib/rhoconnect/dynamic_adapter.rb +91 -0
  242. data/lib/rhoconnect/generator.rb +1 -0
  243. data/lib/rhoconnect/jobs/bulk_data_job.rb +203 -0
  244. data/lib/rhoconnect/jobs/ping_job.rb +46 -0
  245. data/lib/rhoconnect/jobs/source_job.rb +16 -0
  246. data/lib/rhoconnect/license.rb +86 -0
  247. data/lib/rhoconnect/lock_ops.rb +11 -0
  248. data/lib/rhoconnect/model.rb +414 -0
  249. data/lib/rhoconnect/ping/android.rb +56 -0
  250. data/lib/rhoconnect/ping/apple.rb +52 -0
  251. data/lib/rhoconnect/ping/blackberry.rb +56 -0
  252. data/lib/rhoconnect/ping.rb +3 -0
  253. data/lib/rhoconnect/read_state.rb +31 -0
  254. data/lib/rhoconnect/rho_indifferent_access.rb +88 -0
  255. data/lib/rhoconnect/server/views/index.erb +13 -0
  256. data/lib/rhoconnect/server.rb +286 -0
  257. data/lib/rhoconnect/source.rb +289 -0
  258. data/lib/rhoconnect/source_adapter.rb +123 -0
  259. data/lib/rhoconnect/source_sync.rb +302 -0
  260. data/lib/rhoconnect/stats/middleware.rb +20 -0
  261. data/lib/rhoconnect/stats/record.rb +108 -0
  262. data/lib/rhoconnect/store.rb +232 -0
  263. data/lib/rhoconnect/tasks.rb +350 -0
  264. data/lib/rhoconnect/test_methods.rb +220 -0
  265. data/lib/rhoconnect/user.rb +95 -0
  266. data/lib/rhoconnect/version.rb +3 -0
  267. data/lib/rhoconnect/x_domain_session_wrapper.rb +53 -0
  268. data/lib/rhoconnect.rb +285 -0
  269. data/rhoconnect.gemspec +67 -0
  270. data/spec/api/admin/api_token_spec.rb +14 -0
  271. data/spec/api/admin/get_api_token_spec.rb +36 -0
  272. data/spec/api/admin/get_license_info_spec.rb +38 -0
  273. data/spec/api/admin/reset_spec.rb +22 -0
  274. data/spec/api/admin/stats_spec.rb +66 -0
  275. data/spec/api/api_helper.rb +21 -0
  276. data/spec/api/application/rhoconnect_api_spec.rb +548 -0
  277. data/spec/api/client/create_client_spec.rb +13 -0
  278. data/spec/api/client/delete_client_spec.rb +13 -0
  279. data/spec/api/client/get_client_params_spec.rb +18 -0
  280. data/spec/api/client/list_client_docs_spec.rb +32 -0
  281. data/spec/api/client/list_clients_spec.rb +22 -0
  282. data/spec/api/client/ping_spec.rb +23 -0
  283. data/spec/api/rhosync_api_spec.rb.orig +606 -0
  284. data/spec/api/source/adapter_spec.rb +29 -0
  285. data/spec/api/source/get_db_doc_spec.rb +21 -0
  286. data/spec/api/source/get_source_params_spec.rb +32 -0
  287. data/spec/api/source/list_source_docs_spec.rb +25 -0
  288. data/spec/api/source/list_sources_spec.rb +26 -0
  289. data/spec/api/source/push_deletes_spec.rb +18 -0
  290. data/spec/api/source/push_objects_spec.rb +27 -0
  291. data/spec/api/source/set_db_doc_spec.rb +19 -0
  292. data/spec/api/source/set_refresh_time_spec.rb +43 -0
  293. data/spec/api/source/upload_file_spec.rb +26 -0
  294. data/spec/api/user/create_user_spec.rb +16 -0
  295. data/spec/api/user/delete_user_spec.rb +36 -0
  296. data/spec/api/user/list_users_spec.rb +30 -0
  297. data/spec/api/user/update_user_spec.rb +31 -0
  298. data/spec/api_token_spec.rb +14 -0
  299. data/spec/app_spec.rb +18 -0
  300. data/spec/apps/emptyapp/application.rb +27 -0
  301. data/spec/apps/emptyapp/settings/license.key +1 -0
  302. data/spec/apps/emptyapp/settings/settings.yml +14 -0
  303. data/spec/apps/rhotestapp/Rakefile +1 -0
  304. data/spec/apps/rhotestapp/application.rb +19 -0
  305. data/spec/apps/rhotestapp/config.ru +1 -0
  306. data/spec/apps/rhotestapp/settings/apple_fake_cert.pem +1 -0
  307. data/spec/apps/rhotestapp/settings/license.key +1 -0
  308. data/spec/apps/rhotestapp/settings/settings.yml +36 -0
  309. data/spec/apps/rhotestapp/sources/base_adapter.rb +9 -0
  310. data/spec/apps/rhotestapp/sources/fixed_schema_adapter.rb +28 -0
  311. data/spec/apps/rhotestapp/sources/sample_adapter.rb +71 -0
  312. data/spec/apps/rhotestapp/sources/simple_adapter.rb +41 -0
  313. data/spec/apps/rhotestapp/sources/sub_adapter.rb +7 -0
  314. data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem/mygem.rb +8 -0
  315. data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem.rb +1 -0
  316. data/spec/bulk_data/bulk_data_spec.rb +97 -0
  317. data/spec/client_spec.rb +124 -0
  318. data/spec/client_sync_spec.rb +774 -0
  319. data/spec/doc/base.html +72 -0
  320. data/spec/doc/doc_spec.rb +376 -0
  321. data/spec/doc/footer.html +4 -0
  322. data/spec/doc/header.html +30 -0
  323. data/spec/document_spec.rb +31 -0
  324. data/spec/dynamic_adapter_spec.rb +43 -0
  325. data/spec/factories/factories.rb +17 -0
  326. data/spec/generator/generator_spec.rb +58 -0
  327. data/spec/generator/generator_spec_helper.rb +9 -0
  328. data/spec/jobs/bulk_data_job_spec.rb +125 -0
  329. data/spec/jobs/ping_job_spec.rb +102 -0
  330. data/spec/jobs/source_job_spec.rb +29 -0
  331. data/spec/license_spec.rb +66 -0
  332. data/spec/model_spec.rb +273 -0
  333. data/spec/perf/bulk_data_perf_spec.rb +32 -0
  334. data/spec/perf/perf_spec_helper.rb +50 -0
  335. data/spec/perf/store_perf_spec.rb +27 -0
  336. data/spec/ping/android_spec.rb +91 -0
  337. data/spec/ping/apple_spec.rb +70 -0
  338. data/spec/ping/blackberry_spec.rb +62 -0
  339. data/spec/read_state_spec.rb +35 -0
  340. data/spec/rhosync_spec.rb +75 -0
  341. data/spec/server/cors_spec.rb +287 -0
  342. data/spec/server/server_spec.rb +470 -0
  343. data/spec/server/x_domain_session_wrapper_spec.rb +150 -0
  344. data/spec/source_adapter_spec.rb +125 -0
  345. data/spec/source_spec.rb +114 -0
  346. data/spec/source_sync_spec.rb +328 -0
  347. data/spec/spec.opts +4 -0
  348. data/spec/spec_helper.rb +231 -0
  349. data/spec/stats/middleware_spec.rb +53 -0
  350. data/spec/stats/record_spec.rb +92 -0
  351. data/spec/store_spec.rb +251 -0
  352. data/spec/support/shared_examples.rb +168 -0
  353. data/spec/sync_states_spec.rb +72 -0
  354. data/spec/test_methods_spec.rb +134 -0
  355. data/spec/testdata/1000-data.txt +1414 -0
  356. data/spec/testdata/compressed/compress-data.txt +1 -0
  357. data/spec/testdata/upload1.txt +1 -0
  358. data/spec/testdata/upload2.txt +1 -0
  359. data/spec/user_spec.rb +139 -0
  360. data/tasks/redis.rake +206 -0
  361. metadata +706 -0
data/doc/client.txt ADDED
@@ -0,0 +1,432 @@
1
+ Using RhoConnect with the RhoConnect Client
2
+ ===
3
+
4
+ Rhoconnect Client is a library to add sync data capability to your applications. Application code can be ObjectiveC, C++, JavaScript or any other supported language. Using this library you can easily enable synchronized data between your smartphone application and a RhoConnect server.
5
+
6
+ ## Objective-C Client
7
+
8
+ ### Getting started
9
+ * The RhoConnect Client is part of the Rhodes repository. You can get it [on github](https://github.com/rhomobile/rhodes/downloads) (select the latest 'rhoconnect-client' package).
10
+
11
+ * Create new project or open existing one in XCode. Add `<rhoconnect-client>/objectivec/RhoConnectClient.xcodeproj` as dependency to your project, so the RhoConnectClient library will link with your project.
12
+
13
+ * Add a 'Copy bundle resources' build phase to project target, than add `<rhoconnect-client>/shared/db/res/db` folder to it.
14
+
15
+ * Add these libraries to your project: `libstdc++6.dylib, libsqlite3.dylib, libz.dylib, CFNetwork.framework`.
16
+
17
+ ### Object Model
18
+
19
+ #### RhoConnectClient
20
+
21
+ :::cplusplus
22
+ //default is false
23
+ //Set to false to get result of operations as return value.
24
+ //Set to true to get notifications - not supported yet
25
+ @property(setter=setThreadedMode) BOOL threaded_mode;
26
+
27
+ //default is 0. Not supported yet
28
+ @property(setter=setPollInterval) int poll_interval;
29
+
30
+ //set rhoconnect server url, for example: "http://<ip>:<port>/application"
31
+ @property(assign, setter=setSyncServer) NSString* sync_server;
32
+
33
+ //call this method before create and use client
34
+ //it will initialize local database
35
+ + (void) initDatabase;
36
+
37
+ //Add sync models to database, so they will sync
38
+ - (void) addModels:(NSArray*)models;
39
+
40
+ //reset all data for all models in local database, also perform logout
41
+ - (void) database_full_reset_and_logout;
42
+
43
+ //login to rhoconnect server and keep login session in database
44
+ - (RhoConnectNotify*) loginWithUser: (NSString*) user pwd:(NSString*) pwd;
45
+
46
+ //login to rhoconnect server and keep login session in database and call selector when finish
47
+ // target is obejct where to call selector, selector calls in thread which make login call
48
+ - (void) loginWithUser: (NSString*) user pwd:(NSString*) pwd callback:(SEL) callback target:(id)target;
49
+
50
+ //set sync notification callback
51
+ - (void) setNotification: (SEL) callback target:(id)target;
52
+ //clear sync notification callback
53
+ - (void) clearNotification;
54
+
55
+ //check does login session exists in database
56
+ - (BOOL) is_logged_in;
57
+
58
+ // run sync of all models
59
+ - (RhoConnectNotify*) syncAll;
60
+
61
+ //send search request to rhoconnect
62
+ - (RhoConnectNotify*) search: (NSArray*)models from: (NSString*) from params: (NSString*)params sync_changes: (BOOL)
63
+ sync_changes progress_step: (int) progress_step;
64
+
65
+ //set callback method for object notification. callback receive RhoConnectObjectNotify object as a parameter
66
+ - (void) setObjectNotification: (SEL) callback target:(id)target;
67
+ - (void) clearObjectNotification;
68
+ //add object to track changes: create, update, delete
69
+ - (void) addObjectNotify: (int) nSrcID szObject:(NSString*) szObject;
70
+
71
+ #### RhomModel
72
+
73
+ :::cplusplus
74
+ //model name
75
+ @property(assign) NSString* name;
76
+
77
+ //possible values: RST_INCREMENTAL, RST_BULK_ONLY
78
+ @property int sync_type;
79
+
80
+ // model constructor
81
+ - (id) init;
82
+
83
+ //run sync of this model
84
+ - (RhoConnectNotify*) sync;
85
+
86
+ //run sync of this model and call callback with status(in_progress, ok, error, complete)
87
+ - (void) sync: (SEL) callback target:(id)target;
88
+
89
+ //create model object with properties and save to database, object id will be generated automatically if not set
90
+ - (void) create: (NSMutableDictionary *) data;
91
+
92
+ //find object by object id
93
+ - (NSMutableDictionary *) find: (NSString*)object_id;
94
+
95
+ //find first object by set of properties
96
+ - (NSMutableDictionary *) find_first: (NSDictionary *)cond;
97
+
98
+ //find all objects by set of properties
99
+ - (NSMutableArray *) find_all: (NSDictionary *)cond;
100
+
101
+ //save object represents by data to database
102
+ - (void) save: (NSDictionary *)data;
103
+
104
+ //delete object represents by data from database
105
+ - (void) destroy: (NSDictionary *)data;
106
+
107
+ //if you are going to create/update bunch of items - use these methods to optimize database access
108
+ //these are equivalent to start/commit transaction
109
+ - (void) startBulkUpdate;
110
+ - (void) stopBulkUpdate;
111
+
112
+ #### RhoConnectNotify
113
+
114
+ This class provides access to sync notification objects as describe [here](/rhodes/synchronization#notifications):
115
+
116
+ :::cplusplus
117
+ @property int total_count;
118
+ @property int processed_count;
119
+ @property int cumulative_count;
120
+ @property int source_id;
121
+ @property int error_code;
122
+ @property(assign) NSString* source_name;
123
+ @property(assign) NSString* status;
124
+ @property(assign) NSString* sync_type;
125
+ @property(assign) NSString* error_message;
126
+ @property(assign) NSString* callback_params;
127
+
128
+ #### RhoConnectObjectNotify
129
+
130
+ This class provides access to sync object notification as describe [here](/rhodes/synchronization#notifications):
131
+
132
+ :::cplusplus
133
+ @property(readonly) NSMutableArray* deleted_objects;
134
+ @property(readonly) NSMutableArray* updated_objects;
135
+ @property(readonly) NSMutableArray* created_objects;
136
+
137
+ @property(readonly) NSMutableArray* deleted_source_ids;
138
+ @property(readonly) NSMutableArray* updated_source_ids;
139
+ @property(readonly) NSMutableArray* created_source_ids;
140
+
141
+ ### Samples
142
+
143
+ See [rhoconnect-client\Samples\ObjectiveC\store](http://github.com/rhomobile/rhodes/tree/master/rhoconnect-client/Samples/ObjectiveC/store/) as an example.
144
+
145
+ #### Initialization
146
+
147
+ :::cplusplus
148
+ [RhoConnectClient initDatabase];
149
+
150
+ RhomModel* customer = [[RhomModel alloc] init];
151
+ customer.name = @"Customer";
152
+
153
+ RhomModel* product = [[RhomModel alloc] init];
154
+ product.name = @"Product";
155
+
156
+ RhoConnectClient* sclient = [[RhoConnectClient alloc] init];
157
+ NSArray* models = [NSArray arrayWithObjects:customer, product, nil];
158
+
159
+ [sclient addModels:models];
160
+
161
+ sclient.sync_server = @"http://rhodes-store-server.heroku.com/application";
162
+
163
+ #### Login
164
+
165
+ :::cplusplus
166
+ RhoConnectNotify* res = [ [RhoConnectEngine sharedInstance].syncClient loginWithUser:txtUser pwd:txtPwd];
167
+ if ( res.error_code != RHO_ERR_NONE || ![[RhoConnectEngine sharedInstance].syncClient is_logged_in])
168
+ ;//show error page
169
+ else
170
+ ;//show success page
171
+
172
+ #### Sync Data
173
+
174
+ :::cplusplus
175
+ RhoConnectNotify* res = [[RhoConnectEngine sharedInstance].syncClient syncAll];
176
+
177
+ #### Fetch data
178
+
179
+ :::cplusplus
180
+ NSMutableArray* arItems = [[RhoConnectEngine sharedInstance].product find_all:nil];
181
+ NSDictionary* item = [arItems objectAtIndex: 0 ];
182
+ textBrand = [item valueForKey:@"brand"];
183
+
184
+ #### Object Notifications
185
+ :::cplusplus
186
+ - (void)objectNotifyCallback:(RhoConnectObjectNotify*) notify
187
+ {
188
+ }
189
+
190
+ NSMutableDictionary* item = [[NSMutableDictionary alloc] init];
191
+ [item setValue:@"Test" forKey:@"name"];
192
+ [product create:item];
193
+
194
+ [sclient setObjectNotification:@selector(objectNotifyCallback:) target:self];
195
+
196
+ [sclient addObjectNotify: [[item objectForKey:@"source_id"] intValue] szObject:[item valueForKey:@"object"] ];
197
+
198
+ ## Android Java Client
199
+
200
+ ### Getting started
201
+ * The RhoConnect Client is part of the Rhodes repository. You can get it [on github](https://github.com/rhomobile/rhodes/downloads) (select the latest 'rhoconnect-client' package).
202
+
203
+ * The RhoConnect Client for Android contains two files:
204
+
205
+ ** rhoimpl.jar - Java part of RhoConnect Client library
206
+
207
+ ** librhoconnectclient.so - native part of RhoConnect Client library
208
+
209
+ These can be build from <rhodes>/rhoconnect-client directory with next command
210
+
211
+ :::shell
212
+ $>rake android:default
213
+
214
+ * Create new Android project or open existing one in Eclipse. Add rhoimple.jar to your project build path and copy librhoconnectclient.so to <project_root>/libs/armeabi, so both Java and native parts of RhoConnect Client library will link with your project.
215
+
216
+ * Copy all files and subfolders from <rhodes>/rhoconnect-client/Java/RhoConnect/assets to assets folder of your Android project.
217
+
218
+ ### RhoConnectClient initialization
219
+
220
+ * Load native library before any RhoConnect client usage. Example of appropriate place to do so is Android application's onCreate method
221
+
222
+ :::java
223
+
224
+ import android.app.Application;
225
+ public class SampleApplication extends Application
226
+ {
227
+ public void onCreate() {
228
+ System.loadLibrary("rhoconnectclient");
229
+ }
230
+ }
231
+
232
+ * Configure and initialize RhoConnect library. Example of appropriate place to do so is main Activity onCreate method
233
+
234
+ * Login to RhoConnect server
235
+
236
+ :::cplusplus
237
+ public void onCreate(Bundle savedInstanceState) {
238
+ super.onCreate(savedInstanceState);
239
+ setContentView(R.layout.main);
240
+
241
+ ApplicationInfo appInfo = getApplicationInfo();
242
+
243
+ try {
244
+ RhoFileApi.initRootPath(appInfo.dataDir, appInfo.sourceDir);
245
+ RhoFileApi.init(this.getApplicationContext());
246
+
247
+ RhoLogConf.setMinSeverity(0);
248
+ RhoLogConf.setEnabledCategories("*");
249
+
250
+ RhoConnectClient.nativeInit();
251
+ } catch (Exception e) {
252
+ Logger.E(TAG, e.getMessage());
253
+ }
254
+ mSyncClient = new RhoConnectClient();
255
+ mModels = new RhomModel[]{
256
+ new RhomModel("Customer", RhomModel.SYNC_TYPE_INCREMENTAL),
257
+ new RhomModel("Product", RhomModel.SYNC_TYPE_INCREMENTAL)
258
+ };
259
+ mSyncClient.initialize(mModels);
260
+ mSyncClient.setPollInterval(0);
261
+ mSyncClient.setSyncServer("http://rhodes-store-server.heroku.com/application");
262
+ mSyncClient.setBulkSyncState(1);
263
+ mSyncClient.loginWithUserAsync("", "", new RhoConnectNotify.IDelegate() {
264
+ public void call(RhoConnectNotify notify) { onLogin(notify); } });
265
+ }
266
+ public void onLogin(RhoConnectNotify notify) {
267
+ // Handle login event
268
+ }
269
+
270
+ Note: RhoConnect callbacks (like passed to RhoConnectClient.loginWithUserAsync methodin axample above) may and most possibly will be called from another thread. It is up to application developer to care about synchronizing or forwarding call to an appropriate thread like GUI thread or Service thread.
271
+
272
+ ### Object Model
273
+
274
+ #### Intro
275
+
276
+ RhoConnect Client Android Java API resides at com.rhomobile.rhoconnect pakage. It contains two main classes: RhoConnectClient and RhomModel. The package also contains two classes which represent results of call to the API. These are RhoConnectNotify and RhoConnectObjectNotify.
277
+ Also several utility classes from com.rhomobile.rhodes package can be used. These are RhoConf, RhoLogConf, Logger.
278
+
279
+ #### RhoConnectClient
280
+
281
+ :::cplusplus
282
+ package com.rhomobile.rhoconnect;
283
+ public class RhoConnectClient{
284
+ /// Call this method before create and use the client. It sets up directory structure and makes nessesary native library initialization.
285
+ public static native void nativeInit();
286
+ /// Creates instance of RhoConnectClient singlethon (yes, it's only one instance of RhoConnectClient allowed).
287
+ public RhoConnectClient();
288
+ /// Call this method to close network connections and release any resources gracefully
289
+ public synchronized void close();
290
+ /// Makes db models initialization. This call must be made just after RhoConnectClient construction and before any other calls to RhoConnectClient object.
291
+ public native void initialize(RhomModel models[]);
292
+ /// Sets up server URL to sync (RhoConnect server)
293
+ public native void setSyncServer(String url);
294
+ /// Forces synchronous or asynchronous RhoConnectClient mode
295
+ /// true - asynchronous mode (default)
296
+ /// false - synchronous mode
297
+ public native void setThreadedMode(boolean mode);
298
+ /// Sets/gets auto sync interval. 0 - disable auto sync
299
+ public native void setPollInterval(int interval);
300
+ public native int getPollInterval();
301
+ ///
302
+ public native void setBulkSyncState(int state);
303
+ public native int getBulkSyncState();
304
+ /// Set get various configuration parameters.
305
+ public native void setConfigString(String name, String param);
306
+ public native String getConfigString(String name);
307
+ /// Reset all data for all models in local database, also perform logout
308
+ public native void databaseFullResetAndLogout();
309
+ /// Checks does login session exists in the database
310
+ public native boolean isLoggedIn();
311
+ /// Logins to RhoConnect server and keep login session in database
312
+ public native RhoConnectNotify loginWithUserSync(String user, String pass);
313
+ /// Logins to RhoConnect server and keep login session in database.
314
+ /// callback will be called when operation has finished.
315
+ public native void loginWithUserAsync(String user, String pass, RhoConnectNotify.IDelegate callback);
316
+ /// Runs sync of all models
317
+ public native RhoConnectNotify syncAll();
318
+ }
319
+
320
+ #### RhomModel
321
+
322
+ :::cplusplus
323
+ package com.rhomobile.rhoconnect;
324
+ public class RhomModel {
325
+ /// Possible model types
326
+ public final static int MODEL_TYPE_PROPERTY_BAG = 0;
327
+ public final static int MODEL_TYPE_FIXED_SCHEMA = 1;
328
+ /// Possible sync types
329
+ public final static int SYNC_TYPE_NONE = 0;
330
+ public final static int SYNC_TYPE_INCREMENTAL = 1;
331
+ public final static int SYNC_TYPE_BULK_ONLY = 2;
332
+ /// Constructor
333
+ public RhomModel(String name, int syncType);
334
+ /// Returns the model name
335
+ public String getName() { return mName; }
336
+ /// Returns the model type
337
+ public int getModelType() { return mModelType; }
338
+ /// Sets the model type
339
+ public void setModelType(int type) { mModelType = type; }
340
+ // Returns the model sync type
341
+ public int getSyncType() { return mSyncType; }
342
+ /// Sets the model sync type
343
+ public void setSyncType(int type) { mSyncType = type; }
344
+ /// Returns the model sync priority
345
+ public int getSyncPriority() { return mSyncPriority; }
346
+ /// Sets the model sync priority
347
+ public void setSyncPriority(int prio) { mSyncPriority = prio; }
348
+ /// Returns the model partition
349
+ public String getPartition() { return mPartition; }
350
+ /// Sets the model partition
351
+ public void setPartition(String part) { mPartition = part; }
352
+ /// Runs sync of the model
353
+ public RhoConnectNotify sync();
354
+ /// Creates model object with properties and save to database, object id will be generated automatically if not set
355
+ public void create(Map<String, String> props);
356
+ /// Finds object by object id
357
+ public Map<String, String> find(String objectId)
358
+ /// Saves changes to existing object
359
+ public void save(Map<String, String> item);
360
+ /// Destroys existing object
361
+ public void destroy(Map<String, String> item) {
362
+
363
+ // Returns first object which matches the condition
364
+ public Map<String, String> findFirst(Map<String, String> condition);
365
+ // Returns all objects which matched the condition
366
+ public Collection<Map<String, String> > findAll(Map<String, String> condition);
367
+
368
+ public void startBulkUpdate();
369
+ public void stopBulkUpdate();
370
+ }
371
+
372
+ #### RhoConnectNotify
373
+
374
+ :::cplusplus
375
+ package com.rhomobile.rhoconnect;
376
+ public class RhoConnectNotify {
377
+ public int getTotalCount() { return mTotalCount; }
378
+ public int getProcessedCount() { return mProcessedCount; }
379
+ public int getCumulativeCount() { return mCumulativeCount; }
380
+ public int getSourceId() { return mSourceId; }
381
+ public int getErrorCode() { return mErrorCode; }
382
+ public String getSourceName() { return mSourceName; }
383
+ public String getStatus() { return mStatus; }
384
+ public String getSyncType() { return mSyncType; }
385
+ public String getErrorMessage()
386
+ public String getCallbackParams() { return mParams; }
387
+ /// Developer need to implement and pass reference to this interface
388
+ /// in order to get call back when asynchronous operation has completed
389
+ public static interface IDelegate {
390
+ public void call(RhoConnectNotify notify);
391
+ }
392
+ }
393
+
394
+ #### RhoConnectObjectNotyfy
395
+
396
+ :::cplusplus
397
+ package com.rhomobile.rhoconnect;
398
+ public interface RhoConnectObjectNotify {
399
+ public String[] getDeletedObjects();
400
+ public String[] getUpdatedObjects();
401
+ public String[] getCreatedObjects();
402
+
403
+ public int[] getDeletedSourceIds();
404
+ public int[] getUpdatedSourceIds();
405
+ public int[] getCreatedSourceIds();
406
+
407
+ /// Developer need to implement and pass reference to this interface
408
+ /// in order to get call back when objects are created, updated or destroyed at sync server
409
+ public static interface IDelegate {
410
+ public void call(RhoConnectObjectNotify notify);
411
+ }
412
+ }
413
+
414
+ ### Samples
415
+
416
+ * See android_store sample [rhoconnect-client\Samples\Java\android_store](http://github.com/rhomobile/rhodes/tree/master/rhoconnect-client/Samples/Java/android_store/) as an example.
417
+ * See android test Eclipse project [rhoconnect-client\Java\Android\test](http://github.com/rhomobile/rhodes/tree/master/rhoconnect-client/Java/Android/test/) as another example.
418
+
419
+ ## Packaging RhoConnect Client
420
+ To package the RhoConnect Client archive for distribution, go to the top of the rhodes repository and run:
421
+
422
+ :::term
423
+ $ rake build:rhoconnect_client
424
+
425
+ This will produce a zipfile in the folder called `rhoconnect-client-<someversion>.zip` where `<someversion>` is the version of the client.
426
+
427
+ ## Release procedure
428
+ 1. Unzip package to some folder
429
+
430
+ 2. Open project `rhoconnect-client\ObjectiveC\Tests\RhoConnectClientTest` in xcode and run. See log - SUCCESS should be at the end of log
431
+
432
+ 3. Open project `rhoconnect-client\Samples\ObjectiveC\store` in xcode and run. Press Login, you should see several items, click on item, you should see details
@@ -0,0 +1,210 @@
1
+ RhoConnect Generator and Rake Tasks
2
+ ===
3
+
4
+ ## RhoConnect Generator
5
+
6
+ The `rhoconnect` utility is a command line tool for generating RhoConnect applications and sources.
7
+
8
+ ### Generate an Application
9
+
10
+ The app name is passed as a parameter. The `rhoconnect` utility will generate a directory for your application with all the necessary files to get started. We will start with running `rhoconnect app` to see the usage:
11
+
12
+ :::term
13
+ Usage: rhoconnect app [options] [args]
14
+
15
+ Generates a new rhoconnect application.
16
+
17
+ Required:
18
+ name - application name
19
+
20
+
21
+ Options specific for this generator:
22
+
23
+ General options:
24
+ -p, --pretend Run, but do not make any changes.
25
+ -f, --force Overwrite files that already exist.
26
+ -s, --skip Skip files that already exist.
27
+ -d, --delete Delete files that have previously been generated with this generator.
28
+ --no-color Don't colorize the output
29
+ -h, --help Show this message
30
+ --debug Do not catch errors
31
+
32
+ For example:
33
+
34
+ :::term
35
+ $ rhoconnect app storeserver
36
+ Generating with app generator:
37
+ [ADDED] storeserver/config.ru
38
+ [ADDED] storeserver/settings/settings.yml
39
+ [ADDED] storeserver/settings/license.key
40
+ [ADDED] storeserver/application.rb
41
+ [ADDED] storeserver/Rakefile
42
+ [ADDED] storeserver/Gemfile
43
+ [ADDED] storeserver/spec/spec_helper.rb
44
+
45
+ Here's a basic rundown of each of the files that were just generated:
46
+
47
+
48
+ * **config.ru** - This is a rackup file which will load your application. RhoConnect uses the excellent [sinatra](http://www.sinatrarb.com/) web framework to run the application.
49
+ * **settings/settings.yml** - This contains settings such as your redis connection, which source adapters exist and their parameters. You can also put custom settings here.
50
+ * **settings/license.key** - The RhoConnect [license](/rhoconnect/licensing) associated with your application. The default license allows up to 10 devices to synchronize with the application.
51
+ * **application.rb** - The RhoConnect application class where you can implement authentication. You can also add other custom methods here to use in your application. This class is a singleton, so all methods should be added to the `class << self` block.
52
+ * **Rakefile** - This contains tasks that can be run from the terminal.
53
+ * **Gemfile** - This file specifies application's dependencies using [bundler](http://gembundler.com/).
54
+ * **spec/spec_helper.rb** - A helper file which loads the environment for running [specs](/rhoconnect/testing).
55
+
56
+ ### Add a New Source Adapter
57
+
58
+ To generate a source for your RhoConnect application, run the `rhoconnect source` command:
59
+
60
+ :::term
61
+ Usage: rhoconnect source [options] [args]
62
+
63
+ Generates a new source adapter.
64
+
65
+ Required:
66
+ name - source name(i.e. product)
67
+
68
+
69
+ Options specific for this generator:
70
+
71
+ General options:
72
+ -p, --pretend Run, but do not make any changes.
73
+ -f, --force Overwrite files that already exist.
74
+ -s, --skip Skip files that already exist.
75
+ -d, --delete Delete files that have previously been generated with this generator.
76
+ --no-color Don't colorize the output
77
+ -h, --help Show this message
78
+ --debug Do not catch errors
79
+
80
+ For example:
81
+
82
+ :::term
83
+ $ cd storeserver
84
+ $ rhoconnect source product
85
+ Generating with source generator:
86
+ [ADDED] sources/product.rb
87
+ [ADDED] spec/sources/product_spec.rb
88
+
89
+ This generates a source adapter file `product.rb` and corresponding [rspec](http://rspec.info/) file `product_spec.rb`. If you choose, you can use this spec to implement the source adapter.
90
+
91
+ ## Rake Tasks
92
+
93
+ Each RhoConnect application uses [rake](https://github.com/jimweirich/rake) to manage development tasks such as starting/stopping the app, starting resque workers, and running specs.
94
+
95
+ To run a RhoConnect rake task, simply type `rake the-task-to-run` in your RhoConnect application's root directory.
96
+
97
+ ### Installing DTach (Mac OS / Linux only)
98
+
99
+ If you're using MacOS / Linux, install [dtach](http://dtach.sourceforge.net/) on your path before running any of the rake tasks. [DTach](http://dtach.sourceforge.net/) is a simple utility which runs processes in a detached state so you can re-attach your console later.
100
+
101
+ :::term
102
+ $ cd storeserver
103
+ $ rake dtach:install
104
+
105
+ ### Setup Redis
106
+
107
+ Next, you will need to setup and start a [redis](http://redis.io/) server:
108
+
109
+ :::term
110
+ $ rake redis:install
111
+ $ rake redis:start
112
+
113
+ ### Start the Application
114
+
115
+ Now, start the application!
116
+
117
+ :::term
118
+ $ rake rhoconnect:start
119
+
120
+ If everything went well, you should see the following in your console:
121
+
122
+ [05:47:10 PM 2011-04-19] Rhoconnect Server v3.0.0 started...
123
+
124
+ To open the web console, navigate to [http://localhost:9292/](http://localhost:9292) in your browser or run:
125
+
126
+ :::term
127
+ $ rake rhoconnect:web
128
+
129
+ ### Creating executable WAR containers (JRuby environment only)
130
+
131
+ It is possible to create Java WAR containers for your Rhoconnect application that can be deployed into the
132
+ Java App Servers (for example, JBoss). To create the executable WAR container, execute the following command in your app's root directory:
133
+
134
+ :::term
135
+ $ cd storeserver
136
+ $ rake rhoconnect:war
137
+
138
+ This will build the WAR file named <your_app>.war that can be deployed into the Java App Server.
139
+
140
+
141
+ ### Common Tasks
142
+
143
+ RhoConnect applications come with many useful rake tasks for administrative and development workflows. Some common ones are:
144
+
145
+ * `rake dtach:install` - (Mac OS / Linux only) This will install [dtach](http://dtach.sourceforge.net/) to /usr/local/bin.
146
+
147
+ * `rake redis:install` - This will install to the system. On Mac OS / Linux, it will attempt to install in '/usr/local/bin' (on windows, C:\redis-<version>), unless you have specified a REDIS_HOME to use instead.
148
+ If you cannot install redis on Linux due to insufficient user permissions, then follows these [instructions](/rhoconnect/install).
149
+
150
+ * `rake rhoconnect:set_admin_password` - Set the RhoConnect administrator password. The default password is blank ''.
151
+
152
+ * `rake rhoconnect:get_token` - Get a RhoConnect API token to use for calling the RhoConnect REST API.
153
+
154
+ **NOTE: On Mac OS / Linux, you need to install dtach (i.e. by running `rake dtach:install`) to run the following tasks: **
155
+
156
+ * `rake redis:start` - This will launch a redis server in a new console.
157
+
158
+ * `rake redis:stop` - Stop the currently-running redis server.
159
+
160
+ * `rake redis:attach` - (Mac OS / Linux only) Attach to a currently-running redis server.
161
+
162
+ * `rake rhoconnect:start` - Start the RhoConnect application in a new console. This requires a running redis server.
163
+
164
+ * `rake rhoconnect:stop` - Stop the currently-running RhoConnect application.
165
+
166
+ * `rake rhoconnect:attach` - (Mac OS / Linux only) Attach to a currently-running RhoConnect application.
167
+
168
+ * `rake rhoconnect:clean_start` - Useful for development, resets and bootstraps the RhoConnect application with a test user.
169
+
170
+ Some other useful development tasks:
171
+
172
+ * `rake rhoconnect:reset` - Reset the RhoConnect application to the initial state. This WILL DELETE ALL DATA IN REDIS! So be sure you don't run this in production!
173
+
174
+ * `rake rhoconnect:spec` - Run all source adapter specs in spec/sources/.
175
+
176
+ * `rake rhoconnect:web` - Open the RhoConnect web console in a browser.
177
+
178
+ Here is a complete list of the rake tasks available in a RhoConnect application:
179
+
180
+ :::term
181
+ $ cd storeserver
182
+ $ rake -T
183
+ (in ~/storeserver)
184
+ rake dtach:about # About dtach
185
+ rake dtach:install # Install dtach 0.8 from source
186
+ rake redis:about # About redis
187
+ rake redis:attach # Attach to redis dtach socket
188
+ rake redis:download # Download package
189
+ rake redis:install # Install the latest verison of Redis from Github (requires git, duh)
190
+ rake redis:restart # Restart redis
191
+ rake redis:start # Start redis
192
+ rake redis:stop # Stop redis
193
+ rake resque:work # Start a Resque worker
194
+ rake resque:workers # Start multiple Resque workers.
195
+ rake rhoconnect:attach # Attach to rhoconnect console
196
+ rake rhoconnect:clean_start # Clean rhoconnect, get token, and create new user
197
+ rake rhoconnect:create_user # Creates and subscribes user for application in rhoconnect
198
+ rake rhoconnect:delete_device # Deletes a device from rhoconnect
199
+ rake rhoconnect:delete_user # Deletes a user from rhoconnect
200
+ rake rhoconnect:flushdb # Flush data store - WARNING: THIS REMOVES ALL DATA IN RHOCONNECT
201
+ rake rhoconnect:get_token # Fetches current api token from rhoconnect
202
+ rake rhoconnect:reset # Reset the rhoconnect database (you will need to run rhoconnect:get_token afterwards)
203
+ rake rhoconnect:reset_refresh # Reset source refresh time
204
+ rake rhoconnect:restart # Alias for `rake rhoconnect:stop; rake rhoconnect:start`
205
+ rake rhoconnect:set_admin_password # Sets the admin password
206
+ rake rhoconnect:spec # Run source adapter specs
207
+ rake rhoconnect:start # Start rhoconnect server
208
+ rake rhoconnect:stop # Stop rhoconnect server
209
+ rake rhoconnect:war # Build executable WAR file to be used in Java App Servers
210
+ rake rhoconnect:web # Launch the web console in a browser - uses :syncserver: in settings.yml