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
@@ -0,0 +1,60 @@
1
+ Contributing to RhoConnect
2
+ ===
3
+ Want to add features to RhoConnect? Found a bug that you want report or fix? Please follow the steps below to help with the RhoConnect project. Thanks to developers like you, RhoConnect continues to be the best and fastest open-source mobile sync server!
4
+
5
+ ## Report RhoConnect Issues
6
+ Please first report bugs/features/enhancements to the [google group](http://groups.google.com/group/rhomobile). Someone may already be working on the issue!
7
+
8
+ ## Run RhoConnect Specs
9
+ First run the rhoconnect specs to make sure your environment is up-to-date for development:
10
+
11
+ 1. [Fork](http://help.github.com/forking/) the [RhoConnect repository](http://github.com/rhomobile/rhoconnect).
12
+
13
+ 2. Clone your new repo:
14
+
15
+ $ git clone git://github.com/<yourhandle>/rhoconnect.git
16
+ $ cd rhoconnect
17
+
18
+ 3. Install [Bundler](http://gembundler.com/):
19
+
20
+ $ [sudo] gem install bundler
21
+
22
+ 4. Install all of the required gems. If any of the needed gems are already installed, Bundler will use them:
23
+
24
+ $ [sudo] bundle install
25
+
26
+ 5. Install [hsqldata](http://github.com/rhomobile/hsqldata):
27
+
28
+ $ git clone git://github.com/rhomobile/hsqldata.git
29
+ $ cd hsqldata
30
+ $ ant
31
+ $ mkdir -p <path-to-rhoconnect>/vendor/
32
+ $ cp bin/hsqldata.jar <path-to-rhoconnect>/vendor/
33
+
34
+ 6. Run the RhoConnect specs:
35
+
36
+ $ rake #=> runs all rhoconnect specs by default
37
+
38
+
39
+ If everything passes (pending specs are OK), then your environment is ready for development. If you have trouble installing a particular gem or the specs just won't run properly, please feel free to ping the [rhomobile google group](mailto:rhomobile@googlegroups.com) or [hop on IRC](http://webchat.freenode.net/?channels=rhomobile) to chat with other RhoConnect developers.
40
+
41
+ ## Contributing your Patch
42
+ Now that you're environment is ready, make your changes!
43
+
44
+ 1. Create a topic branch:
45
+
46
+ $ git checkout -b cool_new_feature
47
+
48
+ 2. Write tests ([example](http://github.com/rhomobile/rhoconnect/commit/f95cfdbf3f53d64c3957499906c77d7127b7c3db#diff-2))
49
+
50
+ 3. Make changes...
51
+
52
+ 4. Add relevant documentation(RDoc, update the README if relevant)
53
+
54
+ 5. Push to your branch:
55
+
56
+ $ git push origin cool_new_feature
57
+
58
+ 6. Send a note to the [google group](http://groups.google.com/group/rhomobile)
59
+
60
+ That's it! Please follow [these ruby style guidelines](http://github.com/chneukirchen/styleguide/blob/master/RUBY-STYLE) when coding.
data/doc/deploying.txt ADDED
@@ -0,0 +1,82 @@
1
+ Deploying a RhoConnect Application
2
+ ===
3
+
4
+ Since RhoConnect applications are standard ruby [sinatra](http://www.sinatrarb.com/) applications, you have many hosting options. This section will cover two ways to deploy a RhoConnect application: use the RhoHub service, deploy to an on-premise server.
5
+
6
+ ## Preparing App for Production
7
+ By default your RhoConnect application generates a few files that you should be familiar with and understand the settings.
8
+
9
+ ### `config.ru`
10
+ This rackup file contains runtime configuration for the RhoConnect sinatra application:
11
+
12
+ :::ruby
13
+ Rhoconnect::Server.disable :run
14
+ Rhoconnect::Server.disable :clean_trace
15
+ Rhoconnect::Server.enable :raise_errors
16
+ Rhoconnect::Server.set :secret, '<changeme>'
17
+ Rhoconnect::Server.set :root, ROOT_PATH
18
+ Rhoconnect::Server.use Rack::Static, :urls => ["/data"], :root => Rhoconnect::Server.root
19
+
20
+ The important setting here `:secret` you will want to change. `:secret` should be set to a long random string, it ___should not___ be set to a dictionary word or short string (30 characters or more is sufficient). This is used for the session storage using a digest algorithm as described [here](http://guides.rubyonrails.org/security.html#session-storage).
21
+
22
+ If you don't change the `:secret` setting, RhoConnect automatically warns you each time the application starts:
23
+
24
+ [11:34:56 AM 2011-01-12] ************************************************************
25
+
26
+ [11:34:56 AM 2011-01-12] WARNING: Change the session secret in config.ru from <changeme> to something secure.
27
+ [11:34:56 AM 2011-01-12] i.e. running `rake rhoconnect:secret` in your app will generate a secret you could use.
28
+
29
+ [11:34:56 AM 2011-01-12] ************************************************************
30
+
31
+
32
+ As this warning states, a good way to generate a cryptographically secure secret is by running `rake rhoconnect:secret` in your RhoConnect application.
33
+
34
+ :::term
35
+ $ cd storemanager-server
36
+ $ rake rhoconnect:secret
37
+ 040a2355475e9d0fb591ef78d5b9ca61a34cbcfd3f11942b18bc1d91f1ca66c27b2e0386333843a7efa29f40fff03624cd908d0883364ffbfa3208ab23fa2664
38
+
39
+ Then plug this secret into your `config.ru`:
40
+
41
+ :::ruby
42
+ Rhoconnect::Server.set :secret, '040a2355475e9d0fb591ef78d5b9ca61a34cbcfd3f11942b18bc1d91f1ca66c27b2e0386333843a7efa29f40fff03624cd908d0883364ffbfa3208ab23fa2664'
43
+
44
+ To run RhoConnect in production mode, use `RACK_ENV` environment variable set to "production". This ensures RhoConnect will use the `:production` section of the settings. For example:
45
+
46
+ :::term
47
+ $ thin start -e production -p 9292
48
+
49
+ Will start thin in with `RACK_ENV` set to "production".
50
+
51
+ NOTE: If you deploy using passenger or on RhoHub, this variable is automatically set to production.
52
+
53
+ ### `settings/settings.yml`
54
+ This file contains all source adapter options and settings like the redis server connection. Before deploying to production, make sure you have the appropriate production settings:
55
+
56
+ :::yaml
57
+ :sources:
58
+ Product:
59
+ :poll_interval: 300
60
+
61
+ :production:
62
+ :redis: myredishost:6379
63
+ :licensefile: settings/license.key
64
+ :syncserver: http://localhost:9292/application/
65
+
66
+ ### `settings/license.key`
67
+ This contains your RhoConnect license key text. By default, a RhoConnect application comes with a 10 device license. Please see the [licensing page](/rhoconnect/licensing) for more details.
68
+
69
+ ## Hosting on RhoHub
70
+ The [RhoHub](/rhohub/introduction) service offers several [production RhoConnect application hosting levels](http://rhohub.com/pricing). Simply sign up on [rhohub.com](http://rhohub.com/) and go through the [tutorial](/rhohub/tutorial) on deploying your first RhoConnect application with RhoHub.
71
+
72
+ ## Deploying On-Premise
73
+ The [sinatra book](http://sinatra-book.gittr.com/) has some great [deployment documentation](http://sinatra-book.gittr.com/#deployment) that you should review before running your RhoConnect application in production.
74
+
75
+ ## Deploying into J2EE environment
76
+ In JRuby environment, there is an option to create the WAR container for the Rhoconnect app
77
+ and deploy it into the J2EE App Server.
78
+ (see the corresponding 'rake' task for creating the WAR containers).
79
+ Deploying the WAR container varies per J2EE App Server, for JBoss it is necessary
80
+ to place the WAR file into the server's deploy directory.
81
+
82
+ We recommend using the [phusion passenger](http://modrails.com/index.html) stack for deploying an on-premise RhoConnect application. Please refer to the [section on rack applications](http://modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_rack_based_ruby_application) for information on deploying a RhoConnect sinatra application.
data/doc/install.txt ADDED
@@ -0,0 +1,28 @@
1
+ Installing RhoConnect
2
+ ===
3
+
4
+ ## Windows
5
+
6
+ If you're running Windows, download the latest [RhoConnect windows installer](http://github.com/rhomobile/rhoconnect/downloads). This installs the [Ruby stack](http://www.ruby-lang.org/en/), [Redis](http://redis.io/), [Apache](http://httpd.apache.org/), and a default RhoConnect application so you don't need to generate one by hand.
7
+
8
+ Your RhoConnect application folder will be located in C:\RhoConnect\rhoconnect by default so you can skip to the [generating a source instructions](/rhoconnect/command-line#rhoconnect-generator) in the next section.
9
+
10
+ ## Mac OS / Linux
11
+
12
+ ### Prerequisites
13
+
14
+ 1. [Ruby v1.8.7+](http://www.ruby-lang.org/en/downloads/)
15
+
16
+ 2. [RubyGems v1.3.7+](http://rubygems.org/pages/download)
17
+
18
+ 3. Ruby Web Server - We test with [thin](http://code.macournoyer.com/thin/), and [passenger](http://www.modrails.com/). WEBrick, the web server that ships with ruby, is known to cause issues with HTTP headers/cookies and is ***not*** recommended.
19
+
20
+ 4. [Redis 2.2.x](http://redis.io/) - RhoConnect includes a simple [rake task](/rhoconnect/command-line#rake-tasks) `redis:install` to install redis, covered in the next section. Alternatively, you can [install redis directly](http://redis.io/download).
21
+
22
+ ### Installing RhoConnect Gem
23
+
24
+ To install the RhoConnect gem, run:
25
+
26
+ :::term
27
+ $ [sudo] gem install rhoconnect --pre
28
+
@@ -0,0 +1,20 @@
1
+ RhoConnect Introduction
2
+ ===
3
+
4
+ RhoConnect is the first of a new category of “mobile app integration” servers. Using RhoConnect drastically simplifies the development of connectivity to an enterprise backend app. The RhoConnect server and built-in RhoConnect client in the smartphone app perform all the work to get data down to the device. This eliminates 50 to 80 percent of the development effort in enterprise smartphone apps: performing the backend application integration.
5
+
6
+ RhoConnect also does the ongoing synchronization work: keeping all of the data from backend applications current on the local device. As information is changed in backend applications it is immediately synchronized down to all devices, and available on devices even when they are offline. Data changed on the devices is also synchronized by RhoConnect to the backend system.
7
+
8
+ RhoConnect does not require use of Rhodes for the client app. It can also be used from apps written in Objective C or even from other frameworks using JavaScript.
9
+
10
+ RhoConnect consists of the following components:
11
+
12
+ * Synchronization Framework - The core of RhoConnect, this facilitates data synchronization between the Rhodes / RhoConnect-Client and a 3rd party source (SOAP, REST, etc...). Each source is synchronized by implementing a simple "source adapter" class. The client connects with the embedded [sinatra](http://www.sinatrarb.com/) server to interact with the collection of source adapters. RhoConnect uses [redis](http://redis.io/) to efficiently cache data to be synchronized.
13
+
14
+ * REST API - RhoConnect exposes a simple REST API for interacting with an application. See the [REST API docs](/rhoconnect/rest-api) for more information.
15
+
16
+ * Administration Web Console - The RhoConnect [web console](/rhoconnect/web-console) is sinatra server used for manipulating and peeking into a running RhoConnect app. The console uses the [RhoConnect REST API](/rhoconnect/rest-api) for everything it does.
17
+
18
+ * Asynchronous Job System - RhoConnect uses the [resque](https://github.com/defunkt/resque) library to provide asynchronous execution of various tasks it needs to perform. These tasks include source adapter execution, sending push messages, preparing bulk data, etc... Resque is dead-simple to use and highly extensible, so it can easily be used for other functionality not described here.
19
+
20
+ The bulk of the work involved in making RhoConnect work with your smartphone application is writing source adapters. This process is described in the [source adapter section](/rhoconnect/source-adapters). A longer [tutorial](/rhoconnect/tutorial) is also available.
data/doc/licensing.txt ADDED
@@ -0,0 +1,18 @@
1
+ Licensing Your RhoConnect Application
2
+ ===
3
+
4
+ ## RhoHub License
5
+ If you plan to deploy your RhoConnect application on RhoHub under a premium or enterprise plan, just click on the **"Production app?"** button to enable your paid-level license.
6
+
7
+ **NOTE: Toggling this button will re-deploy your RhoConnect application to a new redis database. Make sure you __backup all critical data__ before doing this!**
8
+
9
+ ## On-Premise License
10
+ Your RhoConnect application was generated with a default license which supports up to 10 devices. After [purchasing](http://rhomobile.com/products/rhoconnect/) a license, you can save the new license text in settings/license.key. Just restart the application and it will pick up the new license automatically.
11
+
12
+ If you want to load the license file in a different location, you can edit `:licensefile:` in settings/settings.yml:
13
+
14
+ :::yaml
15
+ :development:
16
+ :licensefile: settings/license.key
17
+ :redis: localhost:6379
18
+ :syncserver: http://localhost:9292/application/
data/doc/metadata.txt ADDED
@@ -0,0 +1,458 @@
1
+ Building Dynamic Views with Metadata
2
+ ===
3
+
4
+ The metadata framework is a RhoConnect & Rhodes tool which provides synchronized application layouts. For example, if your application had an "account" model with the fields "name" and "address", metadata would allow you to add an additional field "phone" in the source adapter and this new field would automatically display in the Rhodes application.
5
+
6
+ In addition to adding/removing/updating fields, metadata also provides powerful features like handling field validations, data-binding, collections, repeatable elements, and much more.
7
+
8
+ ## How Metadata Works
9
+ * Metadata is first defined in a [source adapter](/rhoconnect/source-adapters) by implementing an adapter method `metadata` that returns a JSON structure. The JSON structure may contain a hash of hashes, as well as having child elements defined as arrays of hashes. The keys in each object can be any string, however there are some reserved labels and labels used by certain elements.
10
+
11
+ * The metadata for an adapter is synchronized to Rhodes along with the rest of the adapter dataset. Metadata is called before the query method in the [`SyncEngine` workflow](/rhodes/synchronization#syncengine-workflow), so you can tailor your query method based on metadata.
12
+
13
+ * Rhodes uses the synchronized [metadata definition](#metadata-definition) to render views at runtime. These views are driven by the metadata definition, so when a new definition is synchronized, the views will automatically reflect the changes.
14
+
15
+ ## Getting Started with Metadata
16
+ The first step is to install the rhodes-translator gem:
17
+
18
+ :::term
19
+ $ gem install rhodes-translator
20
+
21
+ Then add `rhodes_translator` to your extensions in your Rhodes application's `build.yml`:
22
+
23
+ :::yaml
24
+ extensions: ["rhodes_translator"]
25
+
26
+ Now define some metadata and add this to a `metadata` method your [source adapter](/rhoconnect/source-adapters). For example:
27
+
28
+ :::ruby
29
+ def metadata
30
+ # define the metadata
31
+ row1 = {
32
+ :label => 'Address 1',
33
+ :value => '123 fake street',
34
+ :name => 'address1',
35
+ :type => 'labeledrow'
36
+ }
37
+ table = {
38
+ :label => 'Table',
39
+ :type => 'table',
40
+ :children => [ row1, row1, row1 ]
41
+ }
42
+ view = {
43
+ :title => 'UI meta panel',
44
+ :type => 'iuipanel',
45
+ :children => [table]
46
+ }
47
+
48
+ # return the definition as JSON
49
+ {'index' => view}.to_json
50
+ end
51
+
52
+
53
+ ## Metadata Definition
54
+ The following elements are available for building metadata definitions.
55
+
56
+ ### Reserved Labels
57
+
58
+ The following labels are reserved, used by the metadata framework.
59
+
60
+ * `:type`
61
+ * `:children`
62
+ * `:repeatable`
63
+ * `:validation`
64
+
65
+ ### Children
66
+
67
+ Children of an element are defined by an array of hashes. To specify the children of an element you add the ":children" key and specify the children of that element.
68
+
69
+ The following example shows a table element that has three `row1` elements as `:children`:
70
+
71
+ :::ruby
72
+ row1 = {
73
+ :label => 'Address 1',
74
+ :value => '123 fake street',
75
+ :name => 'address1',
76
+ :type => 'labeledrow'
77
+ }
78
+
79
+ table = {
80
+ :label => 'Table',
81
+ :type => 'table',
82
+ :children => [ row1, row1, row1 ]
83
+ }
84
+
85
+ ### Repeatable
86
+
87
+ Repeatable elements use [data binding](#data-binding) to specify an array of objects to iterate over. The children of the repeatable element are duplicated for each element in the object referred to by the repeatable hash key. For more information on data-binding see the data binding section on this page.
88
+
89
+ The following example will result in a table with 2 child rows, one row with the value set to '123 fake street' and the second row value set to '321 fake street'
90
+
91
+ :::ruby
92
+ @addresses = [
93
+ { :name => "123 fake street" },
94
+ { :name => "321 fake street" }
95
+ ]
96
+
97
+ row1 = {
98
+ :label => 'Address 1',
99
+ :value => '{{name}}',
100
+ :name => 'address1',
101
+ :type => 'labeledrow'
102
+ }
103
+
104
+ table = {
105
+ :label => 'Table',
106
+ :type => 'table',
107
+ :children => [ row1 ],
108
+ :repeatable => '{{@addresses}}'
109
+ }
110
+
111
+
112
+ ## Controlling How Metadata is Rendered
113
+
114
+ By default, any controller actions that have metadata for a given model with the key corresponding to the action will be rendered with metadata instead of the view.
115
+
116
+ However, you can render arbitrary metadata in the view with the `render_metadata` method. You must specify the action to the metadata. By default, the metadata provided is pulled from the model, however this can be overridden as well.
117
+
118
+ Example:
119
+
120
+ :::ruby
121
+ <%= render_metadata('indexdata') %>
122
+
123
+
124
+ Or, using explicit metadata resource:
125
+
126
+ :::ruby
127
+ <%= render_metadata('index', Account.metadata) %>
128
+
129
+ ## Data Binding
130
+
131
+ Data binding happens before the elements get translated to html. All of the instance variables in your method are able to be referenced by the data binding keys.
132
+
133
+ A data binding key is always contained within a string. It is indicated by using double bracket enclosure: `{{databinding path here}}`
134
+
135
+ To reference hash keys, or index arrays, the `/` operator is used. You must specify the whole path to the object, the only exception being within [repeatable](#metadata-definition) elements.
136
+
137
+ We will use the following dataset for example:
138
+
139
+ :::ruby
140
+ @data = {
141
+ :key1 => [ 'array', 'with', 'elements'],
142
+ :key2 => { :this => "is", :a => "hash" }
143
+ }
144
+
145
+
146
+ Example data binding keys using this data:
147
+
148
+ `{{@data/key1/0}}` will be replaced with 'array'
149
+
150
+ `{{@data/key1/2}}` will be replaced with 'elements'
151
+
152
+ `{{@data/key1/5}}` will be replaced with an error message
153
+
154
+ `{{@data/key2/this}}` will be replaced with 'is'
155
+
156
+ `{{@data/key2/this}}` will be replaced with 'hash'
157
+
158
+
159
+ Within a repeatable element, the root node is replaced with the element that is being repeated. See the example in the repeatable section above. To reference the root element while inside a repeatable a `/` should be prepended to your data binding expression: `{{/@data/key1/0}}`
160
+
161
+ ## Validation
162
+
163
+ Validation is expressed as a key added to an existing metadata definition. Below is a sample showing all of the validations that can be used.
164
+
165
+ :::ruby
166
+ :validation => {
167
+ :regexp = "^.+$",
168
+ :validators = [:required, :number, :currency, :email, :phone],
169
+ :min_len = 0,
170
+ :max_len = 100,
171
+ :min_value = 10,
172
+ :max_value = 1000
173
+ }
174
+
175
+ ## Templates
176
+ ### Form
177
+ An HTML form that is used for submitting data:
178
+
179
+ :::html
180
+ <form></form>
181
+
182
+
183
+ * **Type**
184
+ * `form`
185
+ * **Keys**
186
+ * `name` - used as name attribute in &lt;form&gt; tag
187
+ * `action` - used as action attribute in &lt;form&gt; tag
188
+ * `method` - used as method attribute in &lt;form&gt; tag
189
+ * **Children**
190
+ * Children are rendered between the &lt;form&gt; and &lt;/form&gt; tags
191
+
192
+ ### Panel
193
+ Contains children with a &lt;div&gt; tag with the div class set to 'panel':
194
+
195
+ :::html
196
+ <div class="panel"></div>
197
+
198
+ * **Type**
199
+ * `panel`
200
+ * **Keys**
201
+ * `unused`
202
+ * **Children**
203
+ * Children are rendered between the &lt;div&gt; and &lt;/div&gt; tags
204
+
205
+ ### View
206
+ Contains children with no extra html.
207
+
208
+ * **Type**
209
+ * `view`
210
+ * **Keys**
211
+ * `unused`
212
+ * **Children**
213
+ * Children rendered directly
214
+
215
+ ### Table
216
+ HTML Table.
217
+
218
+ :::html
219
+ <table></table>
220
+
221
+ * **Type**
222
+ * `table`
223
+ * **Keys**
224
+ * `class` - class attribute on &lt;table&gt; element
225
+ * **Children**
226
+ * Children are rendered between the &lt;table&gt; and &lt;/table&gt; tags
227
+
228
+ ### Text
229
+ A labeled text display.
230
+
231
+ :::html
232
+ <div>
233
+ <label></label>
234
+ <span></span>
235
+ </div>
236
+
237
+ * **Type**
238
+ * `text`
239
+ * **Keys**
240
+ * `div_class` - class attribute for div
241
+ * `label_class` - class attribute for label
242
+ * `value_class` - class attribute for span
243
+ * `label` - value for label element
244
+ * `value` - value for inner div element
245
+ * **Children**
246
+ * Does not render children
247
+
248
+ ### Text Input, Password
249
+ A labeled text input.
250
+
251
+ :::html
252
+ <div>
253
+ <label></label>
254
+ <input type="text|password"></input>
255
+ </div>
256
+
257
+ * **Type**
258
+ * `textinput|password`
259
+ * **Keys**
260
+ * `div_class` - class attribute for outer div
261
+ * `label_class` - class attribute for label
262
+ * `value_class` - class attribute for input
263
+ * `label` - value for label element
264
+ * `value` - value attribute for input
265
+ * `name` - name attribute for input
266
+ * `editable` - boolean value, enable/disable changing of selection. Default `true`.
267
+ * **Children**
268
+ * Does not render children.
269
+
270
+ ### Text Area
271
+ Text area input field.
272
+
273
+ :::html
274
+ <textarea>
275
+ </textarea>
276
+
277
+ * **Type**
278
+ * `textarea`
279
+ * **Keys**
280
+ * `class` - class attribute for textarea
281
+ * `value` - value attribute for textarea
282
+ * `name` - name attribute for textarea
283
+ * `rows` - rows attribute for textarea
284
+ * `cols` - cols attribute for textarea
285
+ * `editable` - boolean value, enable/disable changing of selection. Default `true`.
286
+ * **Children**
287
+ * Does not render children.
288
+
289
+ ### Select
290
+ HTML Select.
291
+
292
+ :::html
293
+ <div>
294
+ <label></label>
295
+ <select>
296
+ <option></option>
297
+ </select>
298
+ </div>
299
+
300
+ * **Type**
301
+ * `select`
302
+ * **Keys**
303
+ * `size` - size attribute for select
304
+ * `class` - class attribute for select
305
+ * `allow_multi` - boolean value, allow multiple selection on dropdown. Default `false`.
306
+ * `editable` - boolean value, enable/disable changing of selection. Default `true`.
307
+ * `div_class` - class attribute for outer div
308
+ * `label_class` - class attribute for label
309
+ * `label` - value for label element
310
+ * `value` - default value displayed
311
+ * `values` - array of strings to provide as options
312
+ * **Children**
313
+ * Does not render children.
314
+
315
+ ### Checkbox
316
+ A checkbox field
317
+
318
+ :::html
319
+ <div>
320
+ <label></label>
321
+ <input type="checkbox"></input>
322
+ </div>
323
+
324
+ * **Type**
325
+ * `checkbox`
326
+ * **Keys**
327
+ * `div_class` - class attribute for outer div
328
+ * `label_class` - class attribute for label
329
+ * `label` - value for label element
330
+ * `name` - name attribute for input
331
+ * `default_value` - boolean value, true = checked, false = unchecked. Default `false`.
332
+ * `value` - string value, 'true' = checked, anything else = unchecked
333
+ * **Children**
334
+ Does not render children.
335
+
336
+ ### link
337
+ An anchor tag.
338
+
339
+ :::html
340
+ <a href=""></a>
341
+
342
+ * **Type**
343
+ * `link`
344
+ * **Keys**
345
+ * `url` - the url inside the href attribute
346
+ * `text` - the text that the link displays
347
+ * **Children**
348
+ * Does not render children.
349
+
350
+ ### telephone
351
+ Anchor tag, with click to call information.
352
+
353
+ :::html
354
+ <a href=""></a>
355
+
356
+ * **Type**
357
+ * `telephone`
358
+ * **Keys**
359
+ * `number` - the phone number to call
360
+ * `text` - The text that the link displays
361
+ * **Children**
362
+ * Does not render children.
363
+
364
+ ## Advanced Adapter Example
365
+ Here is a more advanced source adapter `metadata` example which demonstrates the concepts we described here:
366
+
367
+ :::ruby
368
+ def metadata
369
+ @contact = {
370
+ :label => '{{name}}',
371
+ :name => 'contact',
372
+ :type => 'labeledrow', # a row which links to another
373
+ # object in a different model
374
+ :value => '{{age}}, {{year}}'
375
+ } # name and phone of the contact object not the account!
376
+
377
+ @rows = {
378
+ :type => 'view',
379
+ :children => [@contact],
380
+ :repeatable => '{{@forms}}'
381
+ }
382
+
383
+ @link = {
384
+ :label => 'New',
385
+ :value => '{{@link1}}',
386
+ :type => 'labeledrow'
387
+ }
388
+
389
+ @table = {
390
+ :label => 'table',
391
+ :name => 'table',
392
+ :type => 'table',
393
+ :class => 'grid',
394
+ :children => [@link, @rows]
395
+ }
396
+
397
+ @index = {
398
+ :title => 'PEOPLE',
399
+ :type => 'iuipanel',
400
+ :children => [@table]
401
+ }
402
+
403
+ @error = {
404
+ :label => '{{@errorlabel}}',
405
+ :type => 'text',
406
+ :name => 'name',
407
+ :value => '{{@errors}}'
408
+ }
409
+
410
+ @name = {
411
+ :label => 'name',
412
+ :type => 'textinput',
413
+ :name => 'name',
414
+ :value => '{{@form/name}}',
415
+ :validation => { :validators => [:required] }
416
+ }
417
+
418
+ @age = {
419
+ :label => 'age',
420
+ :type => 'textinput',
421
+ :name => 'age',
422
+ :value => '{{@form/age}}',
423
+ :validation => {
424
+ :validators => [:required],
425
+ :min_value => 13
426
+ }
427
+ }
428
+
429
+ @year = {
430
+ :label => 'year',
431
+ :type => 'textinput',
432
+ :name => 'year',
433
+ :value => '{{@form/year}}',
434
+ :validation => {
435
+ :validators => [:required],
436
+ :max_value => 2010
437
+ }
438
+ }
439
+
440
+ @submit = {
441
+ :name => 'submit',
442
+ :value => 'submit',
443
+ :type => 'submit'
444
+ }
445
+
446
+ @form = {
447
+ :name => 'inputform',
448
+ :action => '{{@submiturl}}',
449
+ :type => 'form',
450
+ :children => [@error, @name, @age, @year, @submit]
451
+ }
452
+
453
+ { 'indexdata' => @index, 'new' => @form }.to_json
454
+ end
455
+
456
+ ## Custom Templates
457
+
458
+ Templates can be overridden by placing the ERB files in the `app/templates` folder in your Rhodes application. They will be used before using any of the built-in templates.