rhodes 2.2.6 → 2.3.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (486) hide show
  1. data/CHANGELOG +20 -0
  2. data/README.md +46 -0
  3. data/Rakefile +85 -80
  4. data/bin/rhodes +2 -2
  5. data/bin/rhogen +1 -1
  6. data/doc/application.txt +277 -0
  7. data/doc/bb-css.txt +209 -0
  8. data/doc/build.txt +785 -0
  9. data/doc/configuration.txt +236 -0
  10. data/doc/connect-to-web-services.txt +282 -0
  11. data/doc/contributing.txt +64 -0
  12. data/doc/css-framework.txt +144 -0
  13. data/doc/device-caps.txt +1152 -0
  14. data/doc/extensions.txt +528 -0
  15. data/doc/files.txt +4 -0
  16. data/doc/generator.txt +141 -0
  17. data/doc/install.txt +35 -0
  18. data/doc/introduction.txt +88 -0
  19. data/doc/rhom.txt +826 -0
  20. data/doc/standard-css.txt +392 -0
  21. data/doc/synchronization.txt +542 -0
  22. data/doc/test-log-debug.txt +148 -0
  23. data/doc/tutorial.txt +136 -0
  24. data/doc/ui.txt +766 -0
  25. data/installer/EnvVarUpdate.nsh +328 -0
  26. data/installer/README.html +81 -0
  27. data/installer/RHOSYNC-LICENSE.txt +675 -0
  28. data/installer/icon.ico +0 -0
  29. data/installer/instant-rhodes.nsi +427 -0
  30. data/lib/build/jake.rb +15 -1
  31. data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/imageprovider.cpp +1 -1
  32. data/lib/extensions/barcode/ext/barcode/platform/bb/Barcode6.files +45 -0
  33. data/lib/extensions/barcode/ext/barcode/platform/bb/Rakefile +6 -0
  34. data/lib/extensions/barcode/ext/barcode/platform/bb/barcode6.jdp +92 -0
  35. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +7 -4
  36. data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +2 -1
  37. data/lib/extensions/barcode/ext/barcode/platform/wm/src/wm_imageprovider.cpp +1 -1
  38. data/lib/extensions/digest-sha1/ext/build.bat +1 -0
  39. data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +335 -0
  40. data/lib/extensions/esri/ext/build +17 -0
  41. data/lib/extensions/esri/ext/build.bat +29 -0
  42. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.h +7 -0
  43. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.mm +58 -0
  44. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactoryRegister.mm +22 -0
  45. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.h +21 -0
  46. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.mm +32 -0
  47. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/InitESRI.c +5 -0
  48. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.h +143 -0
  49. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.m +919 -0
  50. data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +320 -0
  51. data/lib/extensions/esri/ext/esri/platform/iphone/ESRI_Prefix.pch +7 -0
  52. data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +76 -0
  53. data/lib/extensions/esri/ext.yml +3 -0
  54. data/lib/extensions/net-http/monitor.rb +265 -0
  55. data/lib/extensions/net-http/net/ftp.rb +981 -0
  56. data/lib/extensions/net-http/thread.rb +367 -0
  57. data/lib/extensions/rhocgi/cgi.rb +16 -0
  58. data/lib/extensions/rhospec/rhospec.rb +118 -0
  59. data/lib/framework/base64.rb +91 -0
  60. data/lib/framework/builtinME.rb +13 -10
  61. data/lib/framework/ostruct.rb +145 -0
  62. data/lib/framework/res/back_btn.wm.png +0 -0
  63. data/lib/framework/res/blue_pushpin.wm.png +0 -0
  64. data/lib/framework/res/blue_pushpin_small.wm.png +0 -0
  65. data/lib/framework/res/callout.wm.png +0 -0
  66. data/lib/framework/res/callout_link.wm.png +0 -0
  67. data/lib/framework/res/forward_btn.wm.png +0 -0
  68. data/lib/framework/res/home_btn.wm.png +0 -0
  69. data/lib/framework/res/options_btn.wm.png +0 -0
  70. data/lib/framework/res/refresh_btn.wm.png +0 -0
  71. data/lib/framework/rho/render.rb +5 -2
  72. data/lib/framework/rho/rho.rb +320 -50
  73. data/lib/framework/rho/rhoapplication.rb +48 -10
  74. data/lib/framework/rho/rhonativeviewmanager.rb +73 -0
  75. data/lib/framework/rho/rhosupport.rb +15 -1
  76. data/lib/framework/rho/rhotabbar.rb +29 -0
  77. data/lib/framework/rho/rhotoolbar.rb +17 -0
  78. data/lib/framework/rho/rhoutils.rb +22 -6
  79. data/lib/framework/rhodes.rb +1 -1
  80. data/lib/framework/rholang/rhomsg_de.rb +4 -3
  81. data/lib/framework/rholang/rhomsg_en.rb +1 -0
  82. data/lib/framework/rholang/rhomsg_es.rb +1 -0
  83. data/lib/framework/rholang/rhomsg_it.rb +1 -0
  84. data/lib/framework/rhom/rhom.rb +31 -10
  85. data/lib/framework/rhom/rhom_db_adapter.rb +33 -23
  86. data/lib/framework/rhom/rhom_object_factory.rb +465 -249
  87. data/lib/framework/rhom/rhom_source.rb +22 -7
  88. data/lib/framework/version.rb +1 -1
  89. data/lib/rhodes.rb +1 -1
  90. data/platform/android/Rhodes/AndroidManifest.xml +83 -20
  91. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +5 -0
  92. data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +2 -0
  93. data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +9 -5
  94. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesAppOptions.h +53 -0
  95. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +46 -56
  96. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_SplashScreen.h +10 -0
  97. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_mapview_MapView.h +93 -0
  98. data/platform/android/Rhodes/jni/include/rhodes/rhocryptimpl.h +38 -0
  99. data/platform/android/Rhodes/jni/include/rhodes.h +64 -8
  100. data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +6 -0
  101. data/platform/android/Rhodes/jni/src/alert.cpp +5 -11
  102. data/platform/android/Rhodes/jni/src/bluetooth.cpp +66 -29
  103. data/platform/android/Rhodes/jni/src/callbacks.cpp +24 -21
  104. data/platform/android/Rhodes/jni/src/camera.cpp +2 -6
  105. data/platform/android/Rhodes/jni/src/datetimepicker.cpp +13 -11
  106. data/platform/android/Rhodes/jni/src/event.cpp +9 -15
  107. data/platform/android/Rhodes/jni/src/fileapi.cpp +13 -27
  108. data/platform/android/Rhodes/jni/src/logconf.cpp +3 -3
  109. data/platform/android/Rhodes/jni/src/mapview.cpp +696 -16
  110. data/platform/android/Rhodes/jni/src/menu.cpp +3 -3
  111. data/platform/android/Rhodes/jni/src/nativebar.cpp +55 -4
  112. data/platform/android/Rhodes/jni/src/nativeview.cpp +33 -0
  113. data/platform/android/Rhodes/jni/src/phonebook.cpp +6 -11
  114. data/platform/android/Rhodes/jni/src/rhoconf.cpp +4 -4
  115. data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +87 -0
  116. data/platform/android/Rhodes/jni/src/rhodes.cpp +55 -34
  117. data/platform/android/Rhodes/jni/src/ringtones.cpp +2 -3
  118. data/platform/android/Rhodes/jni/src/signature.cpp +3 -5
  119. data/platform/android/Rhodes/jni/src/splashscreen.cpp +7 -0
  120. data/platform/android/Rhodes/jni/src/sslimpl.cpp +17 -20
  121. data/platform/android/Rhodes/jni/src/webview.cpp +13 -12
  122. data/platform/android/Rhodes/res/drawable/callout.png +0 -0
  123. data/platform/android/Rhodes/res/drawable/callout_link.png +0 -0
  124. data/platform/android/Rhodes/res/drawable/signature_cancel.png +0 -0
  125. data/platform/android/Rhodes/res/drawable/signature_clear.png +0 -0
  126. data/platform/android/Rhodes/res/drawable/signature_ok.png +0 -0
  127. data/platform/android/Rhodes/res/layout/datetime.xml +4 -0
  128. data/platform/android/Rhodes/res/layout/signature.xml +24 -17
  129. data/platform/android/Rhodes/res/layout/status_bar_ongoing_event_progress_bar.xml +102 -0
  130. data/platform/android/Rhodes/res/values/strings.xml +1 -1
  131. data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +6 -0
  132. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Base64.java +575 -0
  133. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +83 -0
  134. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +21 -3
  135. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +23 -15
  136. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +2 -2
  137. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +151 -0
  138. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +2 -2
  139. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +372 -0
  140. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesAppOptions.java +11 -0
  141. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +58 -0
  142. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +705 -523
  143. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RingtoneManager.java +1 -1
  144. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +167 -85
  145. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +36 -1
  146. data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +4 -2
  147. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +33 -20
  148. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +2 -6
  149. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +2 -24
  150. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +106 -36
  151. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +15 -58
  152. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +0 -7
  153. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +6 -4
  154. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/FileList.java +4 -3
  155. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +91 -27
  156. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePicker.java +6 -3
  157. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +275 -42
  158. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -1
  159. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +1 -3
  160. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
  161. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +1 -0
  162. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +120 -43
  163. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +518 -28
  164. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java +2 -2
  165. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +434 -0
  166. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapTouch.java +20 -0
  167. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +296 -336
  168. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MultiTouchHandler.java +111 -0
  169. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/OneTouchHandler.java +77 -0
  170. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/TouchHandler.java +10 -0
  171. data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +0 -1
  172. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +5 -1
  173. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +1 -1
  174. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +1 -1
  175. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +6 -11
  176. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +6 -4
  177. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +0 -7
  178. data/platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogViewDialog.java +9 -4
  179. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +8 -8
  180. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +5 -1
  181. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +11 -7
  182. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +3 -5
  183. data/platform/android/build/RhodesSRC_build.files +32 -23
  184. data/platform/android/build/android.rake +28 -11
  185. data/platform/android/build/androidcommon.rb +2 -0
  186. data/platform/android/build/librhocommon_build.files +9 -5
  187. data/platform/android/build/librhodes_build.files +1 -0
  188. data/platform/android/build/libruby_build.files +1 -0
  189. data/platform/bb/Hsqldb/Hsqldb.jdp +0 -2
  190. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +10 -2
  191. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +37 -5
  192. data/platform/bb/Hsqldb/src/org/hsqldb/Column.java +5 -5
  193. data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -1
  194. data/platform/bb/Hsqldb/src/org/hsqldb/Function.java +73 -78
  195. data/platform/bb/Hsqldb/src/org/hsqldb/Library.java +288 -8
  196. data/platform/bb/RubyVM/RubyVM.jdp +3 -0
  197. data/platform/bb/RubyVM/src/com/rho/FilePath.java +13 -1
  198. data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -2
  199. data/platform/bb/RubyVM/src/com/rho/RhoAppAdapter.java +12 -0
  200. data/platform/bb/RubyVM/src/com/rho/RhoClassFactory.java +18 -1
  201. data/platform/bb/RubyVM/src/com/rho/RhoConf.java +128 -108
  202. data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +9 -10
  203. data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +16 -1
  204. data/platform/bb/RubyVM/src/com/rho/RhoProfiler.java +1 -1
  205. data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +20 -0
  206. data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -2
  207. data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +65 -46
  208. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +192 -50
  209. data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +8 -114
  210. data/platform/bb/RubyVM/src/com/rho/db/DBException.java +1 -1
  211. data/platform/bb/RubyVM/src/com/rho/db/IDBCallback.java +1 -1
  212. data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +5 -3
  213. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +5 -1
  214. data/platform/bb/RubyVM/src/com/rho/file/FileAccessBB.java +109 -0
  215. data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +85 -0
  216. data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +12 -4
  217. data/platform/bb/RubyVM/src/com/rho/net/NetResponse.java +5 -0
  218. data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +37 -23
  219. data/platform/bb/RubyVM/src/com/rho/net/URI.java +84 -0
  220. data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
  221. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +119 -61
  222. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +61 -24
  223. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +108 -54
  224. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +121 -163
  225. data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +23 -0
  226. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyMutex.java +1 -1
  227. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRange.java +3 -1
  228. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRegexp.java +3 -1
  229. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +208 -25
  230. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +3 -1
  231. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +5 -1
  232. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +12 -5
  233. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyID.java +1 -0
  234. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +16 -0
  235. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule_Methods.java +5 -0
  236. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyValue.java +1 -1
  237. data/platform/bb/RubyVM/src/com/xruby/runtime/stdlib/RubyStringIO.java +4 -1
  238. data/platform/bb/{Hsqldb → RubyVM}/src/j2me/math/Number.java +33 -0
  239. data/platform/bb/build/RubyVM_build.files +3 -0
  240. data/platform/bb/build/bb.rake +140 -62
  241. data/platform/bb/build/hsqldb_build.files +0 -2
  242. data/platform/bb/build/rhodes_build.files +5 -0
  243. data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +43 -7
  244. data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +23 -2
  245. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +5 -0
  246. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +143 -0
  247. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +269 -0
  248. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +446 -0
  249. data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +3 -0
  250. data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +12 -2
  251. data/platform/bb/rhodes/platform/common/com/rho/db/SqliteCopyResult.java +2 -0
  252. data/platform/bb/rhodes/platform/common/com/rho/db/SqliteResult.java +2 -0
  253. data/platform/bb/rhodes/platform/common/com/rho/db/SqliteStorage.java +2 -0
  254. data/platform/bb/rhodes/resources/mappin.png +0 -0
  255. data/platform/bb/rhodes/rhodes.jdp +3 -0
  256. data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +21 -18
  257. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +150 -0
  258. data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +1 -0
  259. data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +63 -4
  260. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +6 -5
  261. data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +242 -2
  262. data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +143 -0
  263. data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +269 -0
  264. data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +446 -0
  265. data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +1 -1
  266. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +71 -14
  267. data/platform/bb/rhodes/src/com/rho/net/bb/BBHttpConnection.java +4 -2
  268. data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +28 -12
  269. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +100 -4
  270. data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +3 -2
  271. data/platform/bb/rhodes/src/com/rho/rubyext/XMLParser.java +1 -1
  272. data/platform/bb/rhodes/src/rhomobile/NativeBar.java +32 -0
  273. data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +9 -2
  274. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +174 -41
  275. data/platform/bb/rhodes/src/rhomobile/datetime/DateTimePicker.java +52 -3
  276. data/platform/bb/rhodes/src/rhomobile/datetime/DateTimeScreen.java +33 -1
  277. data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +2 -14
  278. data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +686 -0
  279. data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapProvider.java +14 -0
  280. data/platform/bb/rhodes/src/rhomobile/mapview/GeoCoding.java +13 -0
  281. data/platform/bb/rhodes/src/rhomobile/mapview/GoogleGeoCoding.java +174 -0
  282. data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +104 -330
  283. data/platform/bb/rhodes/src/rhomobile/mapview/MapTools.java +79 -0
  284. data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +35 -12
  285. data/platform/bb/rhodes/src/rhomobile/mapview/MapViewParent.java +2 -1
  286. data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +336 -44
  287. data/platform/bb/rhodes/src/rhomobile/mapview/RhoMapField.java +3 -6
  288. data/platform/iphone/Classes/AppManager/AppManager.m +19 -4
  289. data/platform/iphone/Classes/DateTime.h +4 -0
  290. data/platform/iphone/Classes/DateTime.m +1 -1
  291. data/platform/iphone/Classes/DateTimePicker.m +8 -1
  292. data/platform/iphone/Classes/DateTimePickerDelegate.m +7 -1
  293. data/platform/iphone/Classes/Event/Event.m +2 -2
  294. data/platform/iphone/Classes/MapView/MapViewController.h +4 -1
  295. data/platform/iphone/Classes/MapView/MapViewController.m +6 -46
  296. data/platform/iphone/Classes/MapView/MapViewManager.h +26 -0
  297. data/platform/iphone/Classes/MapView/MapViewManager.m +172 -0
  298. data/platform/iphone/Classes/NativeBar.h +34 -0
  299. data/platform/iphone/Classes/NativeBar.m +131 -26
  300. data/platform/iphone/Classes/NativeView/NVDelegate.h +26 -0
  301. data/platform/iphone/Classes/NativeView/NVDelegate.m +40 -0
  302. data/platform/iphone/Classes/NativeView/NVViewController.h +24 -0
  303. data/platform/iphone/Classes/NativeView/NVViewController.m +90 -0
  304. data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +449 -0
  305. data/platform/iphone/Classes/{RhoNativeViewManagerOC.h → NativeView/RhoNativeViewManagerOC.h} +15 -0
  306. data/platform/iphone/Classes/RhoAlert.m +3 -3
  307. data/platform/iphone/Classes/RhoMainView.h +3 -0
  308. data/platform/iphone/Classes/Rhodes.h +6 -2
  309. data/platform/iphone/Classes/Rhodes.m +47 -79
  310. data/platform/iphone/Classes/Signature/SignatureViewController.m +1 -0
  311. data/platform/iphone/Classes/SimpleMainView.h +18 -1
  312. data/platform/iphone/Classes/SimpleMainView.m +180 -35
  313. data/platform/iphone/Classes/SplitView/LeftViewController.h +1 -1
  314. data/platform/iphone/Classes/SplitView/LeftViewController.m +13 -7
  315. data/platform/iphone/Classes/SplitView/RightViewController.h +1 -1
  316. data/platform/iphone/Classes/SplitView/RightViewController.m +26 -11
  317. data/platform/iphone/Classes/SplitView/SplittedMainView.h +1 -6
  318. data/platform/iphone/Classes/SplitView/SplittedMainView.m +14 -52
  319. data/platform/iphone/Classes/TabbedMainView.h +25 -3
  320. data/platform/iphone/Classes/TabbedMainView.m +340 -14
  321. data/platform/iphone/ESRI/BluePushpin.png +0 -0
  322. data/platform/iphone/ESRI/BluePushpin@2x.png +0 -0
  323. data/platform/iphone/ESRI/esri.png +0 -0
  324. data/platform/iphone/ESRI/esri@2x.png +0 -0
  325. data/platform/iphone/Info.plist +1 -1
  326. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +26 -3
  327. data/platform/iphone/rbuild/iphone.rake +100 -4
  328. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
  329. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +116 -12
  330. data/platform/shared/SyncClient/SyncClient.cpp +29 -3
  331. data/platform/shared/SyncClient/SyncClient.h +2 -1
  332. data/platform/shared/common/IRhoClassFactory.h +3 -0
  333. data/platform/shared/common/IRhoCrypt.h +16 -0
  334. data/platform/shared/common/IRhoThreadImpl.h +1 -0
  335. data/platform/shared/common/RhoAppAdapter.h +2 -0
  336. data/platform/shared/common/RhoConf.cpp +97 -46
  337. data/platform/shared/common/RhoConf.h +14 -13
  338. data/platform/shared/common/RhoFile.cpp +10 -0
  339. data/platform/shared/common/RhoFile.h +1 -0
  340. data/platform/shared/common/RhoMath.cpp +43 -0
  341. data/platform/shared/common/RhoMath.h +27 -0
  342. data/platform/shared/common/RhoNativeViewManager.h +27 -1
  343. data/platform/shared/common/RhoPort.h +11 -0
  344. data/platform/shared/common/RhoStd.h +5 -0
  345. data/platform/shared/common/RhoThread.cpp +1 -1
  346. data/platform/shared/common/RhoThread.h +1 -1
  347. data/platform/shared/common/RhodesApp.cpp +381 -139
  348. data/platform/shared/common/RhodesApp.h +24 -10
  349. data/platform/shared/common/RhodesAppBase.cpp +72 -1
  350. data/platform/shared/common/RhodesAppBase.h +5 -1
  351. data/platform/shared/common/SplashScreen.h +4 -4
  352. data/platform/shared/common/ThreadQueue.cpp +44 -17
  353. data/platform/shared/common/ThreadQueue.h +4 -0
  354. data/platform/shared/common/app_build_configs.c +0 -1
  355. data/platform/shared/common/iphone/RhoClassfactory.h +6 -0
  356. data/platform/shared/common/iphone/RhoCryptImpl.h +47 -0
  357. data/platform/shared/common/iphone/RhoCryptImpl.mm +286 -0
  358. data/platform/shared/common/map/ESRIMapEngine.cpp +921 -0
  359. data/platform/shared/common/map/ESRIMapEngine.h +255 -0
  360. data/platform/shared/common/map/GoogleMapEngine.cpp +160 -0
  361. data/platform/shared/common/map/GoogleMapEngine.h +52 -0
  362. data/platform/shared/common/map/MapEngine.cpp +304 -0
  363. data/platform/shared/common/map/MapEngine.h +214 -0
  364. data/platform/shared/db/DBAdapter.cpp +147 -18
  365. data/platform/shared/db/DBAdapter.h +38 -12
  366. data/platform/shared/db/DBAttrManager.cpp +4 -3
  367. data/platform/shared/db/DBAttrManager.h +7 -7
  368. data/platform/shared/db/res/db/syncdb.triggers +0 -5
  369. data/platform/shared/db/res/db/syncdb_java.triggers +21 -0
  370. data/platform/shared/json/JSONIterator.cpp +11 -1
  371. data/platform/shared/json/JSONIterator.h +1 -0
  372. data/platform/shared/logging/RhoLogConf.cpp +29 -12
  373. data/platform/shared/net/CURLNetRequest.cpp +80 -25
  374. data/platform/shared/net/CURLNetRequest.h +6 -2
  375. data/platform/shared/net/HttpServer.cpp +12 -6
  376. data/platform/shared/net/HttpServer.h +2 -1
  377. data/platform/shared/net/INetRequest.h +1 -0
  378. data/platform/shared/ruby/ext/alert/alert.i +5 -0
  379. data/platform/shared/ruby/ext/alert/alert_wrap.c +439 -108
  380. data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +42 -0
  381. data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +521 -120
  382. data/platform/shared/ruby/ext/nativebar/nativebar.i +16 -0
  383. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +623 -128
  384. data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager.i +18 -0
  385. data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +2321 -0
  386. data/platform/shared/ruby/ext/rho/extensions.c +0 -1
  387. data/platform/shared/ruby/ext/rho/rhoruby.c +53 -0
  388. data/platform/shared/ruby/ext/rho/rhoruby.h +6 -0
  389. data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +6 -3
  390. data/platform/shared/ruby/ext/syncengine/syncengine.i +9 -1
  391. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +61 -0
  392. data/platform/shared/ruby/ext/system/system.i +4 -0
  393. data/platform/shared/ruby/ext/system/system_wrap.c +33 -5
  394. data/platform/shared/rubyext/RhoAppAdapter.cpp +11 -1
  395. data/platform/shared/rubyext/System.cpp +9 -0
  396. data/platform/shared/rubyext/WebView.h +1 -0
  397. data/platform/shared/sqlite/crypto.c +907 -0
  398. data/platform/shared/sqlite/sqlite3.c +6 -0
  399. data/platform/shared/sync/SyncEngine.cpp +49 -19
  400. data/platform/shared/sync/SyncEngine.h +0 -1
  401. data/platform/shared/sync/SyncNotify.cpp +14 -5
  402. data/platform/shared/sync/SyncNotify.h +2 -2
  403. data/platform/shared/sync/SyncSource.cpp +79 -33
  404. data/platform/shared/sync/SyncSource.h +1 -0
  405. data/platform/shared/sync/SyncThread.cpp +26 -11
  406. data/platform/shared/xruby/src/com/xruby/compiler/codedom/StringExpression.java +4 -2
  407. data/platform/wm/RhoLib/RhoLib.vcproj +108 -72
  408. data/platform/wm/build/wm.rake +6 -0
  409. data/platform/wm/rhodes/Alert.cpp +4 -3
  410. data/platform/wm/rhodes/Alert.h +1 -1
  411. data/platform/wm/rhodes/DateTimePicker.cpp +30 -3
  412. data/platform/wm/rhodes/DateTimePicker.h +9 -1
  413. data/platform/wm/rhodes/MainWindow.cpp +121 -61
  414. data/platform/wm/rhodes/MainWindow.h +29 -4
  415. data/platform/wm/rhodes/MapView/Graphics.cpp +547 -0
  416. data/platform/wm/rhodes/MapView/Graphics.h +136 -0
  417. data/platform/wm/rhodes/MapView/MapViewManager.cpp +391 -0
  418. data/platform/wm/rhodes/MapView/MapViewManager.h +158 -0
  419. data/platform/wm/rhodes/RhoCryptImpl.cpp +248 -0
  420. data/platform/wm/rhodes/RhoCryptImpl.h +51 -0
  421. data/platform/wm/rhodes/RhoNativeViewManager.cpp +208 -0
  422. data/platform/wm/rhodes/Rhodes.cpp +94 -102
  423. data/platform/wm/rhodes/Rhodes.rc +27 -0
  424. data/platform/wm/rhodes/SyncStatusDlg.cpp +1 -0
  425. data/platform/wm/rhodes/SyncStatusDlg.h +2 -1
  426. data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +7 -4
  427. data/platform/wm/rhodes/camera/Camera.cpp +36 -15
  428. data/platform/wm/rhodes/camera/Camera.h +0 -4
  429. data/platform/wm/rhodes/resource.h +10 -2
  430. data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -0
  431. data/platform/wm/rhodes/rho/common/RhoClassFactory.h +1 -0
  432. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +10 -2
  433. data/platform/wm/rhodes/rho/net/NetRequestImpl.h +10 -0
  434. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +513 -0
  435. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.h +74 -0
  436. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +22 -10
  437. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +5 -0
  438. data/platform/wm/rhodes/rhodes.vcproj +38 -2
  439. data/platform/wm/rhodes/stdafx.h +2 -1
  440. data/platform/wm/rubylib/rubylib.vcproj +12 -0
  441. data/rakefile.rb +85 -80
  442. data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +14 -3
  443. data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
  444. data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +2 -0
  445. data/res/build-tools/xruby-0.3.3.jar +0 -0
  446. data/res/generators/templates/application/app/application.rb +2 -2
  447. data/res/generators/templates/application/app/helpers/application_helper.rb +1 -1
  448. data/res/generators/templates/application/public/css/android.css +1 -0
  449. data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
  450. data/res/generators/templates/application/rhoconfig.txt +66 -14
  451. data/rhodes.gemspec +3 -3
  452. data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +7 -3
  453. data/spec/framework_spec/build.yml +1 -1
  454. data/spec/phone_spec/Rakefile +1 -0
  455. data/spec/phone_spec/app/Account/account.rb +2 -0
  456. data/spec/phone_spec/app/Account_s/account_s.rb +7 -0
  457. data/spec/phone_spec/app/spec/{fixtures → array/fixtures}/classes.rb +0 -0
  458. data/spec/phone_spec/app/spec/{array_pack_spec.rb → array/pack_spec.rb} +2 -1
  459. data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
  460. data/spec/phone_spec/app/spec/contacts_spec.rb +2 -0
  461. data/spec/phone_spec/app/spec/rho_spec.rb +34 -233
  462. data/spec/phone_spec/app/spec/rhom_object_spec.rb +396 -87
  463. data/spec/phone_spec/app/spec/string/element_set_spec.rb +251 -0
  464. data/spec/phone_spec/app/spec/string/end_with_spec.rb +49 -0
  465. data/spec/phone_spec/app/spec/string/fixtures/classes.rb +27 -0
  466. data/spec/phone_spec/app/spec/{lstrip_spec.rb → string/lstrip_spec.rb} +0 -0
  467. data/spec/phone_spec/app/spec/string/replace_spec.rb +52 -0
  468. data/spec/phone_spec/app/spec/{rstrip_spec.rb → string/rstrip_spec.rb} +0 -0
  469. data/spec/phone_spec/app/spec/string/slice_spec.rb +473 -0
  470. data/spec/phone_spec/app/spec/string/split_spec.rb +302 -0
  471. data/spec/phone_spec/app/spec/string/start_with_spec.rb +48 -0
  472. data/spec/phone_spec/app/spec/{strip_spec.rb → string/strip_spec.rb} +0 -0
  473. data/spec/phone_spec/app/spec/syncengine_spec.rb +30 -1
  474. data/spec/phone_spec/app/spec_runner.rb +15 -7
  475. data/spec/phone_spec/build.yml +2 -2
  476. metadata +154 -25
  477. data/README.textile +0 -45
  478. data/platform/android/Rhodes/AndroidManifest.full.xml +0 -62
  479. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/Manifest.java +0 -14
  480. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +0 -20
  481. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +0 -193
  482. data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -25
  483. data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +0 -22
  484. data/platform/bb/RubyVM/src/com/rho/Capabilities.java +0 -6
  485. data/platform/bb/RubyVM/src/com/rho/Extensions.java +0 -11
  486. data/platform/iphone/Classes/RhoNativeViewManager.mm +0 -226
@@ -0,0 +1,528 @@
1
+ # Extending the Rhodes Framework
2
+
3
+ ## Introduction
4
+
5
+ There are three ways to extend Rhodes. You can add to the Ruby gems supported by Rhodes ("Rhodes extensions"). You can create new "native extensions" in the underlying SDK for a given smartphone operating system. You can extend the types of views available in Rhodes ("native extensions").
6
+
7
+ ## Rhodes Extensions
8
+
9
+ ### Supported extensions and libraries
10
+ To keep rhodes lightweight we didn't provide extensions and libraries beyond core Ruby functionality. Examples of the features that either aren't necessary in Rhodes or we haven't provided for space reasons are: web services, XML, pluralization, YAML, etc.
11
+
12
+ Our C/C++ implementation is based on original Ruby C code, 1.9 release.
13
+
14
+ Our Java implementation is based on [XRuby](http://xruby.com), which supports Ruby 1.8 (We didn't use JRuby because it is substantially bigger and required version of java which is not available on most of the target mobile platforms).
15
+
16
+ Both implementations support such core classes and module as:
17
+
18
+ <i>
19
+ BasicObject, Object, Module, Class, Integer, Float, Numeric, Bignum, Rational, Complex, Math, String, StringScanner, StringIO,
20
+ Array, Hash, Struct, Regexp, RegexpError, MatchData, Data, NilClass, TrueClass, FalseClass, Comparable, Enumerable, Enumerator,
21
+ Converter, Marshal, IO, Dir, Time, Date, Signal, Mutex, Thread, ThreadGroup, Process, Fiber, FiberError, Method, UnboundMethod,
22
+ Binding, RubyVM, GC, Exception, SystemExit, fatal, SignalException, Interrupt, StandardError, TypeError, ArgumentError, IndexError,
23
+ KeyError, RangeError, ScriptError, SyntaxError, LoadError, NotImplementedError, NameError, NoMethodError, RuntimeError,
24
+ SecurityError, NoMemoryError, EncodingError, CompatibilityError, SystemCallError, Errno, ZeroDivisionError, FloatDomainError,
25
+ IOError, EOFError, ThreadError
26
+ </i>
27
+
28
+ We are using Rubinius specs to test Ruby compatibility across different platforms.
29
+
30
+ ### Localization
31
+
32
+ See [Rhodes System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/Localization/index.erb) as an example.
33
+
34
+ Rhodes use localization_simplified library to support non-English languages.
35
+
36
+ Add to build.yml:
37
+
38
+ extensions: ["rholang"]
39
+
40
+ In case of several extensions, insert space after extension name and comma:
41
+
42
+ extensions: ["rholang", "net-http"]
43
+
44
+ Create utf-8 encoded file in app `<app_folder>/app/lang/lang_<lang_id>.rb`. This file will be automatically loaded by rhodes based on current locale.
45
+
46
+ For Example create lang_en.eb:
47
+ :::ruby
48
+ module Localization
49
+ Views = {
50
+ :greeting => "This is test"
51
+ }
52
+ end
53
+
54
+ And use this string in the view:
55
+ :::html
56
+ <ul id="home">
57
+ <li><%= Localization::Views[:greeting] %></li>
58
+ </ul>
59
+
60
+ #### Details:
61
+
62
+ All non-ascii symbols should be utf-8 encoded
63
+
64
+ To get current locale on the phone use System.get_locale method. It returns 'en', 'de' etc locale id's
65
+
66
+ To show localized Date and Time:
67
+ :::ruby
68
+ Time.now.to_formatted_s(:long)
69
+ Time.now.strftime("%B %d, %Y %H:%M") # all names will be localized
70
+ Date.today.to_formatted_s(:long)
71
+ Date.today.strftime("%B %e, %Y") # all names will be localized
72
+
73
+ To show currency (see rails analog for details):
74
+ :::ruby
75
+ Rho::NumberHelper.number_to_currency
76
+
77
+
78
+ ### JSON library support
79
+
80
+ For parsing use Rho::JSON.parse, no extension required.
81
+
82
+ Ruby code example:
83
+ :::ruby
84
+ parsed = Rho::JSON.parse("[{\"count\":10}]")
85
+
86
+ For generate use JSON extension.
87
+
88
+ Add to build.yml:
89
+
90
+ extensions: ["json"]
91
+
92
+ In case of several extensions, insert space after extension name and comma:
93
+
94
+ extensions: ["json", "net-http"]
95
+
96
+ Ruby code example:
97
+ :::ruby
98
+ require 'json'
99
+ json_data = ::JSON.generate(some_object)
100
+
101
+ See JSON tests in [Rhodes System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/JsonTest/controller.rb) as an example.
102
+
103
+ ### XML handling
104
+ There are two ways of handling XML directly in Rhodes. The Rexml library and the much faster RhoXML library.
105
+
106
+ #### Rexml
107
+
108
+ Add to build.yml:
109
+
110
+ extensions: ["rexml", "set"]
111
+
112
+ Ruby code example:
113
+ :::ruby
114
+ require 'rexml/document'
115
+ file = File.new("bibliography.xml")
116
+ doc = REXML::Document.new(file)
117
+ puts doc
118
+
119
+ #### RhoXML
120
+ This is a reduced version of rexml. Rhoxml has the same syntax as rexml, but smaller in size and faster. For Blackberry this is the only choice, because rexml is too slow.
121
+
122
+ Change rexml to rhoxml in build.yml:
123
+
124
+ extensions: ["rhoxml"]
125
+
126
+ No more changes required.
127
+
128
+ Rhoxml limitations:
129
+
130
+ 1. Decoding xml text is not fully implemented. See document.rb line 503 (Text::unnormalize). Need to implement non regular expression decoding.
131
+ 2. No DTD, validation and formatters support
132
+ 3. Support only elements and attributes. No cdata, comments, etc.
133
+
134
+ #### XML Stream parser
135
+
136
+ To process xml faster (without building DOM xml tree in memory) you can use StreamParser:
137
+ :::ruby
138
+ class MyStreamListener
139
+
140
+ def initialize(events)
141
+ @events = events
142
+ end
143
+
144
+ def tag_start name, attrs
145
+ #puts "tag_start: #{name}; #{attrs}"
146
+ @events << attrs if name == 'event'
147
+ end
148
+ def tag_end name
149
+ #puts "tag_end: #{name}"
150
+ end
151
+ def text text
152
+ #puts "text: #{text}"
153
+ end
154
+ def instruction name, instruction
155
+ end
156
+ def comment comment
157
+ end
158
+ def doctype name, pub_sys, long_name, uri
159
+ end
160
+ def doctype_end
161
+ end
162
+ def attlistdecl element_name, attributes, raw_content
163
+ end
164
+ def elementdecl content
165
+ end
166
+ def entitydecl content
167
+ end
168
+ def notationdecl content
169
+ end
170
+ def entity content
171
+ end
172
+ def cdata content
173
+ #puts "cdata: #{content}"
174
+ end
175
+ def xmldecl version, encoding, standalone
176
+ end
177
+ end
178
+
179
+ def parse_xml(str_xml)
180
+ @events = []
181
+ list = MyStreamListener.new(@events)
182
+ REXML::Document.parse_stream(str_xml, list)
183
+ ...
184
+
185
+ It supported in RhoXml and Rexml extensions. For example see : [`<rhodes>\spec\phone_spec\app\spec\xml_spec.rb`](https://github.com/rhomobile/rhodes/blob/master/spec/phone_spec/app/spec/xml_spec.rb) ("should stream parse" spec) and rexml stream parser documentation
186
+
187
+ ### Barcode
188
+ Add to build.yml:
189
+
190
+ extensions: ["Barcode"]
191
+
192
+ See details [here](device-caps#barcode).
193
+
194
+ ### FileUtils
195
+
196
+ Add to build.yml:
197
+
198
+ extensions: ["fileutils"]
199
+
200
+ DryRun, NoWrite and Verbose are commented out modules since they using `eval` function.
201
+
202
+ Blackberry is not supported.<br/>
203
+
204
+ Use Ruby class `Dir` whenever possible.
205
+
206
+ ### Notes on Ruby standard library support
207
+
208
+ For iPhone the Date class is supported
209
+ :::ruby
210
+ require 'date'
211
+ puts Date.today.to_s
212
+
213
+ For Blackberry Date is still not supported. Use this instead:
214
+ :::ruby
215
+ require 'time'
216
+ Time.now.strftime('%Y-%m-%d')
217
+
218
+ ### Adding Ruby Extension Libraries to Your Rhodes Application
219
+
220
+ Create folder 'extensions' under application root.
221
+
222
+ Copy folder with Ruby library to 'extensions' folder. (This will work for "pure ruby" extensions. Extensions which implemented in c/c++ or such you will have to compile for the target platform and link with Rhodes.)
223
+
224
+ Add extension with folder library name to build.yml:
225
+
226
+ extensions: ["myext"]
227
+
228
+ This library will be available for require:
229
+ :::ruby
230
+ require 'myext'
231
+
232
+ Using this technique you can easily remove extension from application or include some extension for particular platform:
233
+
234
+ iphone:
235
+ extensions: ["mspec", "fileutils"]
236
+
237
+ wm:
238
+ extensions: ["json"]
239
+
240
+ ### Adding Libraries to Your Rhodes Application
241
+
242
+ During the course of your app development you might need to add an external ruby library with extra features that the rhodes framework doesn't provide. While we don't guarantee that all ruby libraries will work on the mobile device, you can follow the steps below to add and test libraries as needed.
243
+
244
+ In Rhodes, the require path is relative to the "app" subdirectory, since this is what gets bundled with the rhodes client.
245
+
246
+ Assuming your application is called "mynewapp", create a directory under app called lib (or whatever you wish to call it):
247
+ :::term
248
+ $ cd mynewapp
249
+ $ mkdir app/lib
250
+
251
+ Add your ruby files to this directory:
252
+ :::ruby
253
+ $ cp /path/to/my_lib.rb app/lib/my_lib.rb
254
+
255
+ Now, in your application (controller.rb for example), you can load this library like the following:
256
+ :::ruby
257
+ require 'rho/rhocontroller'
258
+ require 'lib/my_lib'
259
+
260
+ class TicketController < Rho::RhoController
261
+ def use_lib
262
+ @a = MyLib.new
263
+ ...
264
+ end
265
+ end
266
+
267
+ Please note that "rubygems" are not loaded on the device Ruby VM because of size constraints, therefore all third-party ruby library source files must be put into the lib directory as described above.
268
+
269
+ ### Adding Libraries to Rhodes Framework
270
+ There are two ways to add Ruby libraries to the Rhodes framework, essentially dependent upon how you choose to build your Rhodes application.
271
+
272
+ If you are using Rhodes via the RubyGems installation, you must add external Ruby libraries to your RubyGems installation directory for the 'rhodes-framework' gem. Your RubyGems installation directory can be found with `gem env` in a terminal.
273
+
274
+ For example, a user on Linux might place additional libraries in the following directory:
275
+
276
+ /usr/local/lib/ruby/gems/1.8/gems/rhodes-x.x.x/lib/framework
277
+
278
+ Similarly, a user on Mac OSX 10.5 might place them here:
279
+
280
+ /Library/Ruby/Gems/1.8/gems/rhodes-x.x.x/lib/framework
281
+
282
+ For Windows, this location might be:
283
+
284
+ C:/ruby/lib/ruby/gems/1.8/gems/rhodes-x.x.x/lib/framework
285
+
286
+
287
+ If you are using a clone of the Rhodes Git repository, you can put additional libraries in the following directory (preferably on your own github fork):
288
+
289
+ <rhodes-clone>/lib/framework
290
+
291
+ Including the library into your application is simple once the library is in the proper directory.
292
+
293
+ Assuming the library has been added to the correct location, require the library from a controller in your Rhodes application:
294
+ :::ruby
295
+ require 'libname'
296
+
297
+ You can now use the added library to access additional functionality not provided by the Rhodes framework.
298
+
299
+ NOTE: Once again, it should be mentioned that not all libraries are guaranteed to work with Rhodes.
300
+
301
+ ## Native Extensions
302
+
303
+ Starting from 2.0, Rhodes support native extensions for Android, iPhone, WM and BB platforms. Native extensions are extensions written on native language (C/C++/ObjC for iPhone, C/C++/Java for Android, C/C++ for WM, Java for BB). They can provide Ruby interface or don't provide it - its up to authors of these extensions. Below is list of steps need to be done to create native extension for Rhodes (here assumed extension name is 'ext-name')
304
+
305
+ Create folder ext-name in your application extensions folder (app-name/extensions/ext-name) and go there.
306
+
307
+ Create file ext.yml with content:
308
+
309
+ entry: Init_ext_name
310
+ libraries: ["ext-name"]
311
+
312
+ Here Init_ext_name is function provided by native extension. It will be called on rhodes application start - put here all initialization stuff. "ext-name" - is the name of library extension will be compiled in. There could be more than one libraries, in this case just specify them separated by comma. When rhodes creates final binary, it will search library with name 'libext-name.a' for iPhone and Android or 'ext-name.lib' for Windows and link with it.
313
+
314
+ Create folder 'ext' and put 'build' script there (build.bat on Windows). Be sure this script has execute bit set in file permissions if running on Linux/Mac OS X.
315
+
316
+ Edit build script as you want - it will be called on application build and must produce library libext-name.a (iPhone/Android) or ext-name.lib (Windows) in the folder pointed by environment variable TARGET_TEMP_DIR. You are free to implement it as you want - the only requirement is when the script finished, library libext-name.a/ext-name.lib must exist in TARGET_TEMP_DIR directory. Other useful environment variables passed to the build script:
317
+
318
+ Common variables :
319
+
320
+ * TARGET_TEMP_DIR - Location to put your compiled library
321
+ * RHO_PLATFORM - mobile platform current build for. Possible values are 'iphone', 'android' and 'wm'
322
+ * RHO_ROOT - point to the rhodes installation root folder (directory where rhobuild.yml located)
323
+ * TEMP_FILES_DIR - you can use it for temporary files
324
+
325
+ Special for Android build :
326
+
327
+ * ANDROID_NDK - path to Android NDK used by rhodes (Android build)
328
+ * ANDROID_API_LEVEL - Android API level used by rhodes (Android build)
329
+
330
+ Special for WM build :
331
+
332
+ * VCBUILD - path to the vcbuild application usable to build MS VS projects/solutions (WM build)
333
+
334
+ Special for iPhone build :
335
+
336
+ * PLATFORM_DEVELOPER_BIN_DIR - path to the platform developer bin directory (iPhone build)
337
+ * SDKROOT - path to the root of the used SDK - 3.0, 3.1 etc (iPhone build)
338
+ * ARCHS - cpu architecture used to build extension - i386, armv6 etc (iPhone build)
339
+ * XCODEBUILD - contain fullname of xcodebuild (iPhone build)
340
+ * CONFIGURATION - "Debug"/"Release" (iPhone build)
341
+ * SDK_NAME - name of SDK - need for build of xcodeproject (iPhone build)
342
+
343
+ Special for BB build :
344
+
345
+ * JAVA_EXE - java.exe full path (BB build)
346
+ * JAVAC_EXE - javac.exe full path (BB build)
347
+ * JDE_HOME - JDE home full path (BB build)
348
+ * JAR_EXE - jar.exe full path (BB build)
349
+ * RUBYVM_JAR - full name of RubyVM.jar file (need for compilation) (BB build)
350
+ * BB_SDK_VERSION - version of BB SDK
351
+
352
+ Android notes:
353
+
354
+ * If you need to call JNI functions from native code, `JNIEnv *env` variable need to be retrieved. To get it, include file `RHO_ROOT/platform/android/Rhodes/jni/include/rhodes.h` somewhere to the C/C++ files. Global function `JNIEnv *jnienv()` defined there so use it anywhere when `JNIEnv *` needed.
355
+
356
+ * If native extension use Java code, build script should create file ext_build.files in the TARGET_TEMP_DIR. This file should contain java source file names (full names, with path) - one by line. Rhodes will include all of them to the final build.
357
+
358
+ * If native extension use prebuilt libraries (jars), build script should copy all such jars to the TARGET_TEMP_DIR. They must have extension '.jar'. Rhodes will include these files to the final build.
359
+
360
+ * If native extension create native thread (using pthread_create, for example), this thread should be attached to the JVM to be able call Java methods from its context. This should be done using rho_nativethread_start/rho_nativethread_end functions called at start/end of thread routine.
361
+
362
+ Example:
363
+ :::cpp
364
+ void *thread_routine(void *arg)
365
+ {
366
+ void *q = rho_nativethread_start();
367
+ .....
368
+ rho_nativethread_end(q);
369
+ return NULL;
370
+ }
371
+
372
+ Otherwise, if thread was not attached to the JVM, no JNI calls should be performed in its context (it will cause crash).
373
+
374
+ WM note:
375
+
376
+ * If application need to provide additional DLLs, just put them to the TARGET_TEMP_DIR. Rhodes build scripts will detect them and include to the final binary automatically.
377
+
378
+ Now edit application's build.yml and add 'ext-name' to the list of extensions:
379
+
380
+ extensions: ["ext-name"]
381
+
382
+ That's all. Now build your application as usual - it will automatically call build script of your extension and (if this script finished successfully, producing needed libraries into TARGET_TEMP_DIR) link extension libraries into the final binary.
383
+
384
+ BlackBerry Notes:
385
+
386
+ Similar to other platfrom you should prepare build.bat where you should prepare <your Extension name>.jar file and place it to TARGET_TEMP_DIR
387
+ In your "ext.yml" file add new parameter with full name of you class supported Runnable interface, see example:
388
+
389
+ entry: Init_Barcode
390
+ javaentry: com.rho.rubyext.BarcodeRecognizer
391
+ libraries: ["Barcode"]
392
+
393
+ In run() method of this class you should register in RubyVM your classes and methods.
394
+ Example of registration:
395
+ :::java
396
+ package com.rho.rubyext;
397
+
398
+ import com.xruby.runtime.builtin.ObjectFactory;
399
+ import com.xruby.runtime.builtin.RubyString;
400
+ import com.xruby.runtime.lang.*;
401
+
402
+ public class BarcodeRecognizer implements Runnable {
403
+
404
+ public static RubyClass BarcodeClass;
405
+
406
+ public void run() {
407
+ // register Ruby class
408
+ BarcodeClass =
409
+ RubyAPI.defineClass("Barcode", RubyRuntime.ObjectClass);
410
+ // register Ruby method
411
+ BarcodeClass.getSingletonClass().
412
+ defineMethod("barcode_recognize", this);
413
+
414
+ }
415
+
416
+ protected RubyValue run(
417
+ RubyValue receiver, RubyValue arg0, RubyBlock block) {
418
+ //some code for Barcode.barcode_recognize() ruby method
419
+ }
420
+
421
+ }
422
+
423
+ Examples:
424
+
425
+ You can use Barcode extension as an example of native extension for all supported platforms. Please see code of Barcode native extension [here](https://github.com/rhomobile/rhodes/tree/master/lib/extensions/barcode/).
426
+
427
+ Also you can see another example of native extension - Rainbow native extension from Rhodes System Api Samples. Please see code of Rainbow native extension [here](https://github.com/rhomobile/rhodes-system-api-samples/tree/master/extensions/rainbow/).
428
+
429
+ ## Native View Extensions
430
+
431
+ The Native View interface allow developers implement a custom native view and seamlessly integrate it into Rhodes framework (currently only on iPhone supported, Android, WM and Blackberry is soon).
432
+
433
+ To access implemented view navigate to a url where url schema is the register type name of your view:
434
+
435
+ view_type_name:path?query_string#anchor
436
+
437
+ Example:
438
+
439
+ :::ruby
440
+ WebView.navigate("my_video_view:/app/files/barak_obama_0123.mpg")
441
+
442
+
443
+ When Rhodes application navigates to a native view it will replace current view (WebView in most cases) with requested native view and pass path?query_string#anchor to created native view. If application navigate to that view again new instance of the view will not be created but the rest of url will be passed to the view.
444
+
445
+ To provide custom native view native extension should implement NativeViewFactory interface and register it with Rhodes framework using `RhoNativeViewManager::registerViewType(const char* viewType, NativeViewFactory* factory)` call (or similar call on BB, see definition below). Rhodes framework will use registered factory to create and display view of given type.
446
+
447
+ ### Native view manager, factory, and view interface definitions on iPhone, Android, Windows Mobile
448
+
449
+ :::cpp
450
+ class NativeView {
451
+ public:
452
+ // that function must return native object provided view functionality :
453
+ // UIView* for iPhone
454
+ // jobject for Android - jobect must be android.view.View class type
455
+ // HWND for Windows Mobile
456
+ virtual void* getView() = 0;
457
+ // Used by Rhodes to pass path?query_string#anchor to the view
458
+ virtual void navigate(const char* url) = 0;
459
+ };
460
+
461
+ class NativeViewFactory {
462
+ public:
463
+ virtual NativeView* getNativeView(const char* viewType) = 0;
464
+ virtual void destroyNativeView(NativeView* nativeView) = 0;
465
+ };
466
+
467
+ class RhoNativeViewManager {
468
+ public:
469
+ static void registerViewType(const char* viewType, NativeViewFactory* factory);
470
+ static void unregisterViewType(const char* viewType);
471
+ };
472
+
473
+ ### Native view manager, factory, and view interface definitions on Blackberry
474
+
475
+ :::java
476
+ interface NativeView {
477
+ net.rim.device.api.ui.Field getView();
478
+ void navigate(String url);
479
+ }
480
+
481
+ interface NativeViewFactory {
482
+ NativeView getNativeView(String viewType);
483
+ };
484
+
485
+ class RhoNativeViewManager extends Object{
486
+ public:
487
+ static void registerViewType(String viewType, NativeViewFactory factory);
488
+ static void unregisterViewType(String viewType);
489
+ };
490
+
491
+ ### Sample
492
+ See [Rhodes-System-Api-Samples](http://github.com/rhomobile/rhodes-system-api-samples) for details of how to implement and use native view interface. This sample implements a "rainbow_view" native view; you should add rainbow to the list of extensions to include it to the application.
493
+
494
+ See [/app/NativeView/controller.rb](http://github.com/rhomobile/rhodes-system-api-samples/blob/master/app/NativeView/controller.rb) and [/app/NativeView/index.erb](http://github.com/rhomobile/rhodes-system-api-samples/blob/master/app/NativeView/index.erb) for details how to call native view from your controller.
495
+
496
+ * To navigate to rainbow view in your controller you should call `WebView.navigate('rainbow_view:red')`. In your url schema indicates view type you want to open and rest of the url (red) passed to the after it was created.
497
+
498
+ * To pass parameters to created view you may call WebView.navigate again: `WebView.navigate('rainbow_view:green')`. In your native code you may pass parameters to the native view by calling `pNativeView->navigate(url)` where pNativeView is an instance of native view created by the `RhoNativeViewManager` using registered factory.
499
+
500
+ * To close view you created just navigate to any other url.
501
+
502
+ See [/extensions/rainbow](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/extensions/rainbow/) for implementation of the "rainbow" native view.
503
+
504
+ * See how to register your view type with Rhodes here: [RainbowViewFactoryRegister.cpp](http://github.com/rhomobile/rhodes-system-api-samples/blob/master/extensions/rainbow/ext/rainbow/platform/iphone/Classes/RainbowViewFactoryRegister.cpp)
505
+
506
+ * See implementation of native view factory here: [RainbowViewFactory.mm](http://github.com/rhomobile/rhodes-system-api-samples/blob/master/extensions/rainbow/ext/rainbow/platform/iphone/Classes/RainbowViewFactory.mm)
507
+
508
+ * See sample implementation of native view object here: [RainbowView.h](http://github.com/rhomobile/rhodes-system-api-samples/blob/master/extensions/rainbow/ext/rainbow/platform/iphone/Classes/RainbowView.h) and [RainbowView.m](http://github.com/rhomobile/rhodes-system-api-samples/blob/master/extensions/rainbow/ext/rainbow/platform/iphone/Classes/RainbowView.m).
509
+
510
+ * In the "rainbow" view you can see several buttons:
511
+ * [Red], [Green], [Blue] buttons change color by calling controller action using rho_net_request(url). Controller in turn execute WebView.navigate("rainbow_view:color") on the same view to change color.
512
+ * [Stop] and [Play] buttons execute native code inside native view object.
513
+ * [Close Native View] button return you to the web view by executing rho_webview_navigate(url, tab_index).
514
+
515
+ This sample extension uses functionality provided by Rhodes framework and therefore include few framework header files:
516
+
517
+ * [$(RHO_ROOT)/platform/shared/common/RhoNativeViewManager.h](http://github.com/rhomobile/rhodes/blob/master/platform/shared/common/RhoNativeViewManager.h)
518
+ * [$(RHO_ROOT)/platform/shared/common/RhodesApp.h](http://github.com/rhomobile/rhodes/blob/master/platform/shared/common/RhodesApp.h)
519
+ * [$(RHO_ROOT)/platform/shared/rubyext/WebView.h](http://github.com/rhomobile/rhodes/blob/master/platform/shared/rubyext/WebView.h)
520
+
521
+ Make sure following folder added to your compiler include path:
522
+
523
+ * [$(RHO_ROOT)/platform/shared/rubyext](http://github.com/rhomobile/rhodes/tree/master/platform/shared/rubyext/)
524
+ * [$(RHO_ROOT)/platform/shared/ruby/include](http://github.com/rhomobile/rhodes/tree/master/platform/shared/ruby/include/)
525
+ * [$(RHO_ROOT)/platform/shared](http://github.com/rhomobile/rhodes/tree/master/platform/shared/)
526
+ * [$(RHO_ROOT)/platform/shared/ruby/iphone](http://github.com/rhomobile/rhodes/tree/master/platform/shared/ruby/iphone/)
527
+ * [$(RHO_ROOT)/platform/shared/common](http://github.com/rhomobile/rhodes/tree/master/platform/shared/common/)
528
+
data/doc/files.txt ADDED
@@ -0,0 +1,4 @@
1
+ # Optional Files
2
+
3
+
4
+
data/doc/generator.txt ADDED
@@ -0,0 +1,141 @@
1
+ #Rhodes Application Generator
2
+
3
+ Rhodes utility is a generator which the user uses to create Rhodes applications, models, and tests (specs).
4
+
5
+ ## Generate application
6
+
7
+ App name is passed in as a parameter. Utility will generate default directory structure for your application, with reasonable defaults.
8
+
9
+ Usage: rhodes app [options] [args]
10
+
11
+ Generate a new rhodes application.
12
+
13
+ Required:
14
+ name - application name
15
+
16
+ Optional:
17
+ syncserver - url to the source adapter (i.e. "" or "http://myacct.rhohub.com/apps/myapp/sources/")
18
+ zip_url - optional url to zipfile download of bundle (this can be your RhoHub Bundle URL)
19
+
20
+ General options:
21
+ -p, --pretend Run, but do not make any changes.
22
+ -f, --force Overwrite files that already exist.
23
+ -s, --skip Skip files that already exist.
24
+ -d, --delete Delete files that have previously been generated with this generator.
25
+ --no-color Don't colorize the output
26
+ -h, --help Show this message
27
+ --debug Do not catch errors
28
+
29
+ For example:
30
+
31
+ :::term
32
+ $ rhodes app myspace
33
+
34
+ generates:
35
+
36
+ myspace/
37
+ Rakefile
38
+ build.yml
39
+ rhoconfig.txt
40
+ ./app:
41
+ application.rb
42
+ index.bb.erb
43
+ index.erb
44
+ layout.erb
45
+ loading.html
46
+ loading.png
47
+ ./app/Settings:
48
+ controller.rb
49
+ home.bb.erb
50
+ home.erb
51
+ index.bb.erb
52
+ index.erb
53
+ login.bb.erb
54
+ login.erb
55
+ reset.bb.erb
56
+ reset.erb
57
+ wait.bb.erb wait.erb
58
+ ./app/helpers:
59
+ application_helper.rb
60
+ browser_helper.rb
61
+ ./icon:
62
+ <default application icons; modify these to have your own app icon>
63
+ ./public:
64
+ ./public/css:
65
+ <default set of css for different platforms>
66
+ ./public/images:
67
+ <default images used by js libraries>
68
+ ./public/jqtouch:
69
+ <jqtouch js script with some rhomobile fixes>
70
+ ./public/js:
71
+ <default js libraries>
72
+
73
+ ## Add new model
74
+
75
+ Generate a new model:
76
+
77
+ Usage: rhodes model [options] [args]
78
+
79
+ Generate a new model for a rhodes application.
80
+
81
+ Required:
82
+ name - model name
83
+ attributes - list of one or more string attributes (i.e. name,industry,progress), NO spaces between attributes
84
+
85
+ General options:
86
+ -p, --pretend Run, but do not make any changes.
87
+ -f, --force Overwrite files that already exist.
88
+ -s, --skip Skip files that already exist.
89
+ -d, --delete Delete files that have previously been generated with this generator.
90
+ --no-color Don't colorize the output
91
+ -h, --help Show this message
92
+ --debug Do not catch errors
93
+
94
+ For example:
95
+
96
+ :::term
97
+ $ cd myspace
98
+ $ rhodes model account name,industry
99
+
100
+ This will generate the following files in the folder app/Account:
101
+
102
+ * app/Account/index.erb - the template to display the list of objects
103
+ * app/Account/edit.erb - the template to edit an object
104
+ * app/Account/new.erb - the template to supply values to create a new object
105
+ * app/Account/show.erb - the template to displays the selected object
106
+ * app/Account/index.bb.erb - the template to display the list of objects on Blackberry
107
+ * app/Account/edit.bb.erb - the template to edit an object on Blackberry
108
+ * app/Account/new.bb.erb - the template to supply values to create a new object on Blackberry
109
+ * app/Account/show.bb.erb - the template to displays the selected object on Blackberry
110
+ * app/Account/account_controller.rb - contains the basic CRUD actions: index, new, create, edit, update and delete.
111
+ * app/Account/account.rb - contains Account model definition
112
+
113
+ Placeholder for Account test specs will be generated in the app/test folder:
114
+
115
+ * app/test/account_spec.rb - placeholder for Account test specs
116
+
117
+ ## Add test framework
118
+
119
+ Add test framework to the app:
120
+
121
+ Usage: rhodes spec
122
+
123
+ Add test framework to a rhodes application.
124
+
125
+
126
+ For example:
127
+
128
+ :::term
129
+ $ cd myspace
130
+ $ rhodes spec
131
+
132
+ This will generate the following files in the app folder:
133
+
134
+ * SpecRunner/controller.rb - contains index action, which start all tests
135
+ * SpecRunner/index.erb - the template to display tests results
136
+ * mspec.rb - contain all mspec required files
137
+ * spec_runner.rb - contain spec framework initialization and generate list of spec files
138
+
139
+ If you are going to use mspec then add mspec and fileutils extensions to build.yml:
140
+
141
+ extensions: ["mspec", "fileutils"]