atome 0.5.4.1.7 → 0.5.5.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (358) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -1
  3. data/Gemfile +3 -1
  4. data/README.md +70 -1
  5. data/Rakefile +246 -75
  6. data/app_builder_helpers/Rakefile +276 -288
  7. data/documentation/basic.md +242 -0
  8. data/documentation/deep learning/architecture.txt +3763 -0
  9. data/documentation/deep learning/atome.png +0 -0
  10. data/documentation/deep learning/basic_infos.txt +227 -0
  11. data/documentation/deep learning/example_of_users_code.rb +1810 -0
  12. data/documentation/deep learning/misc.txt +24 -0
  13. data/documentation/deep learning/ruby_js_example.rb +272 -0
  14. data/documentation/deep learning/wasm_script_help.text +14 -0
  15. data/documentation/framework/enhance_atome.md +1 -1
  16. data/documentation/tutorials/tutorials.md +7 -0
  17. data/exe/atome +308 -208
  18. data/lib/atome/atome.rb +52 -156
  19. data/lib/atome/extensions/atome.rb +129 -47
  20. data/lib/atome/extensions/mathematics.rb +20 -0
  21. data/lib/atome/extensions/ping.rb +2 -3
  22. data/lib/atome/genesis/generators/atome.rb +57 -30
  23. data/lib/atome/genesis/generators/communication.rb +9 -0
  24. data/lib/atome/genesis/generators/effect.rb +0 -1
  25. data/lib/atome/genesis/generators/event.rb +279 -43
  26. data/lib/atome/genesis/generators/geometry.rb +1 -10
  27. data/lib/atome/genesis/generators/hierarchy.rb +103 -0
  28. data/lib/atome/genesis/generators/identity.rb +45 -84
  29. data/lib/atome/genesis/generators/material.rb +31 -34
  30. data/lib/atome/genesis/generators/property.rb +31 -0
  31. data/lib/atome/genesis/generators/security.rb +31 -0
  32. data/lib/atome/genesis/generators/spatial.rb +3 -5
  33. data/lib/atome/genesis/generators/time.rb +0 -1
  34. data/lib/atome/genesis/generators/utility.rb +181 -66
  35. data/lib/atome/genesis/genesis.rb +152 -55
  36. data/lib/atome/genesis/sparkle.rb +59 -75
  37. data/lib/atome/helpers/color_helper/color/rgb/colors.rb +1 -1
  38. data/lib/atome/helpers/color_helper/color/rgb.rb +1 -1
  39. data/lib/atome/helpers/color_helper/color.rb +226 -7
  40. data/lib/atome/helpers/essentials.rb +22 -26
  41. data/lib/atome/helpers/security.rb +71 -0
  42. data/lib/atome/helpers/utilities.rb +191 -178
  43. data/lib/atome/kernel/black_matter.rb +22 -0
  44. data/lib/atome/kernel/universe.rb +123 -24
  45. data/lib/atome/presets/atome.rb +39 -35
  46. data/lib/atome/version.rb +3 -2
  47. data/lib/atome.rb +12 -12
  48. data/lib/atome_relative.rb +36 -0
  49. data/lib/{atome/renderers → platform_specific}/opal/atome_opal_extensions.rb +4 -1
  50. data/lib/{atome/renderers → platform_specific}/opal/extensions/color.rb +12 -5
  51. data/lib/{atome/renderers → platform_specific}/opal/extensions/geolocation.rb +1 -0
  52. data/lib/platform_specific/opal/extensions/js.rb +21 -0
  53. data/lib/platform_specific/opal/extensions/object.rb +6 -0
  54. data/lib/platform_specific/opal/extensions/ping.rb +31 -0
  55. data/lib/{atome/renderers → platform_specific}/opal/extensions/sha.rb +4 -2
  56. data/lib/platform_specific/wasm/atome_wasm_extensions.rb +11 -0
  57. data/lib/renderers/headless/headless.rb +18 -0
  58. data/lib/renderers/headless/index.rb +6 -0
  59. data/lib/renderers/headless/index_relative.rb +6 -0
  60. data/lib/renderers/headless/utility.rb +6 -0
  61. data/{vendor/assets/src/medias/rubies/examples/top.rb → lib/renderers/html/atome.rb} +0 -1
  62. data/lib/renderers/html/atome_html.rb +22 -0
  63. data/lib/renderers/html/effect.rb +26 -0
  64. data/lib/renderers/html/event.rb +43 -0
  65. data/lib/renderers/html/geometry.rb +31 -0
  66. data/lib/renderers/html/hierarchy.rb +233 -0
  67. data/lib/renderers/html/html.rb +1112 -0
  68. data/lib/renderers/html/identity.rb +84 -0
  69. data/lib/renderers/html/index.rb +19 -0
  70. data/lib/renderers/html/index_relative.rb +20 -0
  71. data/lib/renderers/html/material.rb +53 -0
  72. data/lib/renderers/html/property.rb +24 -0
  73. data/lib/renderers/html/spatial.rb +46 -0
  74. data/lib/renderers/html/time.rb +1 -0
  75. data/lib/renderers/html/utility.rb +38 -0
  76. data/lib/renderers/renderer.rb +16 -0
  77. data/lib/renderers/server/index.rb +4 -0
  78. data/lib/renderers/server/index_relative.rb +4 -0
  79. data/lib/renderers/server/utility.rb +4 -0
  80. data/sig/atome.rbs +6 -0
  81. data/sig/object.rbs +4 -0
  82. data/sig/universe.rbs +3 -0
  83. data/vendor/assets/Rakefile +3 -3
  84. data/vendor/assets/application/examples/a_concat.rb +16 -0
  85. data/vendor/assets/application/examples/affect.rb +8 -0
  86. data/vendor/assets/application/examples/animation.rb +96 -0
  87. data/vendor/assets/application/examples/apply.rb +8 -0
  88. data/vendor/assets/application/examples/atome.rb +5 -0
  89. data/vendor/assets/application/examples/attach.rb +34 -0
  90. data/vendor/assets/application/examples/attached.rb +38 -0
  91. data/vendor/assets/application/examples/basic_understanding.rb +52 -0
  92. data/vendor/assets/application/examples/browse.rb +17 -0
  93. data/vendor/assets/application/examples/callback.rb +20 -0
  94. data/vendor/assets/application/examples/category.rb +12 -0
  95. data/vendor/assets/application/examples/clear.rb +96 -0
  96. data/vendor/assets/application/examples/clones.rb +177 -0
  97. data/vendor/assets/application/examples/code.rb +13 -0
  98. data/vendor/assets/application/examples/color.rb +54 -0
  99. data/vendor/assets/application/examples/convert.rb +163 -0
  100. data/vendor/assets/application/examples/copy.rb +25 -0
  101. data/vendor/assets/application/examples/copybck.rb +68 -0
  102. data/vendor/assets/application/examples/debug.rb +78 -0
  103. data/vendor/assets/application/examples/delete.rb +93 -0
  104. data/vendor/assets/application/examples/display.rb +279 -0
  105. data/vendor/assets/application/examples/display_bck.rb +164 -0
  106. data/vendor/assets/application/examples/drag.rb +45 -0
  107. data/vendor/assets/application/examples/drop.rb +35 -0
  108. data/vendor/assets/application/examples/duplicate.rb +64 -0
  109. data/vendor/assets/application/examples/edit.rb +21 -0
  110. data/vendor/assets/application/examples/encode.rb +6 -0
  111. data/vendor/assets/application/examples/file.rb +50 -0
  112. data/vendor/assets/application/examples/find.rb +157 -0
  113. data/vendor/assets/application/examples/generator_and_build.rb +15 -0
  114. data/vendor/assets/application/examples/getter.rb +16 -0
  115. data/vendor/assets/application/examples/grab.rb +14 -0
  116. data/vendor/assets/application/examples/gradient.rb +35 -0
  117. data/vendor/assets/application/examples/group.rb +44 -0
  118. data/vendor/assets/application/examples/hierarchy.rb +21 -0
  119. data/vendor/assets/application/examples/history.rb +31 -0
  120. data/vendor/assets/application/examples/hypertext.rb +113 -0
  121. data/vendor/assets/application/examples/image.rb +5 -0
  122. data/vendor/assets/application/examples/keyboard.rb +59 -0
  123. data/vendor/assets/application/examples/layout.rb +227 -0
  124. data/vendor/assets/application/examples/login.rb +10 -0
  125. data/vendor/assets/application/examples/markup.rb +4 -0
  126. data/vendor/assets/application/examples/match.rb +115 -0
  127. data/vendor/assets/application/examples/messaging.rb +16 -0
  128. data/vendor/assets/application/examples/monitor.rb +14 -0
  129. data/vendor/assets/application/examples/on_resize.rb +7 -0
  130. data/vendor/assets/{src/medias/rubies/examples/get_renderer_list.rb → application/examples/online.rb} +1 -1
  131. data/vendor/assets/application/examples/over.rb +29 -0
  132. data/vendor/assets/application/examples/paint.rb +23 -0
  133. data/vendor/assets/application/examples/particles.rb +4 -0
  134. data/vendor/assets/application/examples/percent_to_px.rb +4 -0
  135. data/vendor/assets/application/examples/play.rb +50 -0
  136. data/vendor/assets/application/examples/presets.rb +33 -0
  137. data/vendor/assets/application/examples/random.rb +42 -0
  138. data/vendor/assets/application/examples/raw_html.rb +48 -0
  139. data/vendor/assets/application/examples/read.rb +11 -0
  140. data/vendor/assets/application/examples/refresh.rb +62 -0
  141. data/vendor/assets/application/examples/remove.rb +47 -0
  142. data/vendor/assets/application/examples/repeat.rb +26 -0
  143. data/vendor/assets/application/examples/resize.rb +17 -0
  144. data/vendor/assets/application/examples/scroll.rb +11 -0
  145. data/vendor/assets/application/examples/security.rb +76 -0
  146. data/vendor/assets/application/examples/selected.rb +30 -0
  147. data/vendor/assets/application/examples/shadow.rb +46 -0
  148. data/vendor/assets/application/examples/shapes.rb +6 -0
  149. data/vendor/assets/{src/medias/rubies → application}/examples/smooth.rb +5 -1
  150. data/vendor/assets/application/examples/style.rb +4 -0
  151. data/vendor/assets/application/examples/sync.rb +39 -0
  152. data/vendor/assets/application/examples/tagged.rb +24 -0
  153. data/vendor/assets/application/examples/terminal.rb +4 -0
  154. data/vendor/assets/application/examples/text.rb +5 -0
  155. data/vendor/assets/application/examples/touch.rb +38 -0
  156. data/vendor/assets/application/examples/type_mutation.rb +18 -0
  157. data/vendor/assets/application/examples/universe.rb +8 -0
  158. data/vendor/assets/application/examples/vector.rb +24 -0
  159. data/vendor/assets/application/examples/video.rb +14 -0
  160. data/vendor/assets/application/examples/wait.rb +6 -0
  161. data/vendor/assets/application/examples/www.rb +10 -0
  162. data/vendor/assets/application/index.rb +1 -1
  163. data/vendor/assets/application/test.rb +29 -0
  164. data/vendor/assets/application/works/photos.rb +672 -0
  165. data/vendor/assets/application/works/photos2.rb +218 -0
  166. data/vendor/assets/application/works/photos3.rb +343 -0
  167. data/vendor/assets/application/works/photos4.rb +34 -0
  168. data/vendor/assets/application/works/photos6.rb +6 -0
  169. data/vendor/assets/application/works/trigga.rb +0 -0
  170. data/vendor/assets/application/works/vie.rb +74 -0
  171. data/vendor/assets/server/atome_server.rb +37 -41
  172. data/vendor/assets/server/atome_server_wasm.rb +112 -0
  173. data/vendor/assets/server/capture.rb +10 -0
  174. data/vendor/assets/server/config.ru +5 -4
  175. data/vendor/assets/src/css/style.css +29 -4
  176. data/vendor/assets/src/index.html +31 -38
  177. data/vendor/assets/src/index_opal.html +42 -0
  178. data/vendor/assets/src/index_server.html +43 -0
  179. data/vendor/assets/src/index_server_wasm.html +46 -0
  180. data/vendor/assets/src/js/atome/atome.js +170 -150
  181. data/vendor/assets/src/js/atome/atome_helpers/add_font.js +46 -0
  182. data/vendor/assets/src/js/atome/atome_helpers/atome_drag.js +3 -1
  183. data/vendor/assets/src/js/atome/atome_helpers/atome_events.js +12 -7
  184. data/vendor/assets/src/js/atome/atome_helpers/communication.js +126 -0
  185. data/vendor/assets/src/js/atome/atome_helpers/{atome_file.js → file.js} +1 -1
  186. data/vendor/assets/src/js/atome/specific/opal.js +3 -0
  187. data/vendor/assets/src/js/atome/specific/wasm.js +12 -0
  188. data/vendor/assets/src/js/third_parties/browser.script.iife.min.js +13 -0
  189. data/vendor/assets/src/js/third_parties/fabric.min.js +1 -1
  190. data/vendor/assets/src/js/third_parties/html-to-image.min.js +2 -0
  191. data/vendor/assets/src/js/third_parties/jsencrypt.min.js +2 -0
  192. data/vendor/assets/src/js/third_parties/papaparse.min.js +7 -0
  193. data/vendor/assets/src/medias/fonts/Roboto/LICENSE.txt +202 -0
  194. data/vendor/assets/src/medias/fonts/Roboto/Roboto-Black.ttf +0 -0
  195. data/vendor/assets/src/medias/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  196. data/vendor/assets/src/medias/fonts/Roboto/Roboto-Bold.ttf +0 -0
  197. data/vendor/assets/src/medias/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  198. data/vendor/assets/src/medias/fonts/Roboto/Roboto-Italic.ttf +0 -0
  199. data/vendor/assets/src/medias/fonts/Roboto/Roboto-Light.ttf +0 -0
  200. data/vendor/assets/src/medias/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  201. data/vendor/assets/src/medias/fonts/Roboto/Roboto-Medium.ttf +0 -0
  202. data/vendor/assets/src/medias/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  203. data/vendor/assets/src/medias/fonts/Roboto/Roboto-Regular.ttf +0 -0
  204. data/vendor/assets/src/medias/fonts/Roboto/Roboto-Thin.ttf +0 -0
  205. data/vendor/assets/src/medias/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  206. data/vendor/assets/src/medias/images/logos/Facebook.svg +1 -1
  207. data/vendor/assets/src/medias/images/logos/LinkedIn-full.svg +109 -0
  208. data/vendor/assets/src/medias/images/logos/LinkedIn.svg +11 -0
  209. data/vendor/assets/src/medias/images/logos/X.svg +5 -0
  210. data/vendor/assets/src-tauri/Cargo.toml +1 -1
  211. data/vendor/assets/src-tauri/src/main.rs +59 -5
  212. data/vendor/assets/src-tauri/tauri.conf.json +1 -1
  213. data/vendor/assets/src-wasm/wasm/wasi-vfs-osx_arm +0 -0
  214. data/vendor/assets/src-wasm/wasm/wasi-vfs-osx_x86 +0 -0
  215. data/vendor/assets/src-wasm/wasm/wasi-vfs-unix +0 -0
  216. data/vendor/assets/src-wasm/wasm/wasi-vfs.exe +0 -0
  217. metadata +188 -180
  218. data/lib/atome/extensions/mathematic.rb +0 -20
  219. data/lib/atome/extensions/matrix.rb +0 -346
  220. data/lib/atome/helpers/callbacks.rb +0 -133
  221. data/lib/atome/kernel/batch.rb +0 -26
  222. data/lib/atome/kernel/essentials.rb +0 -23
  223. data/lib/atome/renderers/browser/atome.rb +0 -158
  224. data/lib/atome/renderers/browser/browser.rb +0 -47
  225. data/lib/atome/renderers/browser/effect.rb +0 -23
  226. data/lib/atome/renderers/browser/event.rb +0 -96
  227. data/lib/atome/renderers/browser/geometry.rb +0 -27
  228. data/lib/atome/renderers/browser/helpers/animation_helper.rb +0 -69
  229. data/lib/atome/renderers/browser/helpers/browser_helper.rb +0 -101
  230. data/lib/atome/renderers/browser/helpers/color_helper.rb +0 -80
  231. data/lib/atome/renderers/browser/helpers/drag_helper.rb +0 -52
  232. data/lib/atome/renderers/browser/helpers/drop_helper.rb +0 -13
  233. data/lib/atome/renderers/browser/helpers/effect_helper.rb +0 -23
  234. data/lib/atome/renderers/browser/helpers/event_helper.rb +0 -76
  235. data/lib/atome/renderers/browser/helpers/image_helper.rb +0 -27
  236. data/lib/atome/renderers/browser/helpers/over_helper.rb +0 -13
  237. data/lib/atome/renderers/browser/helpers/shadow_helper.rb +0 -74
  238. data/lib/atome/renderers/browser/helpers/shape_helper.rb +0 -22
  239. data/lib/atome/renderers/browser/helpers/text_helper.rb +0 -38
  240. data/lib/atome/renderers/browser/helpers/video_helper.rb +0 -50
  241. data/lib/atome/renderers/browser/helpers/web_helper.rb +0 -26
  242. data/lib/atome/renderers/browser/identity.rb +0 -61
  243. data/lib/atome/renderers/browser/material.rb +0 -121
  244. data/lib/atome/renderers/browser/opal_add_on.rb +0 -31
  245. data/lib/atome/renderers/browser/opal_browser.rb +0 -6
  246. data/lib/atome/renderers/browser/spatial.rb +0 -59
  247. data/lib/atome/renderers/browser/time.rb +0 -3
  248. data/lib/atome/renderers/browser/utility.rb +0 -49
  249. data/lib/atome/renderers/headless/headless.rb +0 -10
  250. data/lib/atome/renderers/headless/utility.rb +0 -6
  251. data/lib/atome/renderers/html/atome.rb +0 -49
  252. data/lib/atome/renderers/html/effect.rb +0 -19
  253. data/lib/atome/renderers/html/event.rb +0 -9
  254. data/lib/atome/renderers/html/geometry.rb +0 -11
  255. data/lib/atome/renderers/html/html.rb +0 -42
  256. data/lib/atome/renderers/html/identity.rb +0 -14
  257. data/lib/atome/renderers/html/opal_browser.rb +0 -6
  258. data/lib/atome/renderers/html/spatial.rb +0 -28
  259. data/lib/atome/renderers/html/utility.rb +0 -17
  260. data/lib/atome/renderers/opal/extensions/atome.rb +0 -29
  261. data/lib/atome/renderers/opal/extensions/ping.rb +0 -18
  262. data/lib/atome/renderers/renderer.rb +0 -15
  263. data/lib/atome/renderers/server/server.rb +0 -10
  264. data/lib/atome/renderers/server/utility.rb +0 -6
  265. data/vendor/assets/aui.rb +0 -5
  266. data/vendor/assets/r&d/misc.rb +0 -219
  267. data/vendor/assets/r&d/ping.rb +0 -3
  268. data/vendor/assets/r&d/storage.rb +0 -9
  269. data/vendor/assets/r&d/view_example.rb +0 -21
  270. data/vendor/assets/src/js/atome/atome_helpers/atome_communication.js +0 -40
  271. data/vendor/assets/src/medias/javascripts/test.js +0 -1
  272. data/vendor/assets/src/medias/rubies/demos.rb +0 -63
  273. data/vendor/assets/src/medias/rubies/examples/add.rb +0 -24
  274. data/vendor/assets/src/medias/rubies/examples/animation.rb +0 -81
  275. data/vendor/assets/src/medias/rubies/examples/atome_new.rb +0 -27
  276. data/vendor/assets/src/medias/rubies/examples/attach.rb +0 -15
  277. data/vendor/assets/src/medias/rubies/examples/attached.rb +0 -15
  278. data/vendor/assets/src/medias/rubies/examples/auto_height.rb +0 -5
  279. data/vendor/assets/src/medias/rubies/examples/auto_width.rb +0 -4
  280. data/vendor/assets/src/medias/rubies/examples/batch.rb +0 -17
  281. data/vendor/assets/src/medias/rubies/examples/blur.rb +0 -4
  282. data/vendor/assets/src/medias/rubies/examples/bottom.rb +0 -3
  283. data/vendor/assets/src/medias/rubies/examples/box.rb +0 -20
  284. data/vendor/assets/src/medias/rubies/examples/center.rb +0 -21
  285. data/vendor/assets/src/medias/rubies/examples/circle.rb +0 -3
  286. data/vendor/assets/src/medias/rubies/examples/class.rb +0 -13
  287. data/vendor/assets/src/medias/rubies/examples/clear.rb +0 -10
  288. data/vendor/assets/src/medias/rubies/examples/clone.rb +0 -35
  289. data/vendor/assets/src/medias/rubies/examples/code.rb +0 -11
  290. data/vendor/assets/src/medias/rubies/examples/color.rb +0 -73
  291. data/vendor/assets/src/medias/rubies/examples/create_atome_in_atome.rb +0 -13
  292. data/vendor/assets/src/medias/rubies/examples/cursor.rb +0 -7
  293. data/vendor/assets/src/medias/rubies/examples/delete.rb +0 -42
  294. data/vendor/assets/src/medias/rubies/examples/depth.rb +0 -6
  295. data/vendor/assets/src/medias/rubies/examples/detached.rb +0 -13
  296. data/vendor/assets/src/medias/rubies/examples/drag.rb +0 -98
  297. data/vendor/assets/src/medias/rubies/examples/drop.rb +0 -26
  298. data/vendor/assets/src/medias/rubies/examples/edit.rb +0 -12
  299. data/vendor/assets/src/medias/rubies/examples/element.rb +0 -6
  300. data/vendor/assets/src/medias/rubies/examples/empty_atome.rb +0 -12
  301. data/vendor/assets/src/medias/rubies/examples/fullscreen.rb +0 -15
  302. data/vendor/assets/src/medias/rubies/examples/grab.rb +0 -5
  303. data/vendor/assets/src/medias/rubies/examples/height.rb +0 -7
  304. data/vendor/assets/src/medias/rubies/examples/hide.rb +0 -7
  305. data/vendor/assets/src/medias/rubies/examples/id.rb +0 -14
  306. data/vendor/assets/src/medias/rubies/examples/image.rb +0 -8
  307. data/vendor/assets/src/medias/rubies/examples/left.rb +0 -7
  308. data/vendor/assets/src/medias/rubies/examples/link.rb +0 -22
  309. data/vendor/assets/src/medias/rubies/examples/markers.rb +0 -48
  310. data/vendor/assets/src/medias/rubies/examples/materials.rb +0 -15
  311. data/vendor/assets/src/medias/rubies/examples/matrix.rb +0 -102
  312. data/vendor/assets/src/medias/rubies/examples/matrix_changes.rb +0 -483
  313. data/vendor/assets/src/medias/rubies/examples/matrix_simple.rb +0 -32
  314. data/vendor/assets/src/medias/rubies/examples/monitoring.rb +0 -70
  315. data/vendor/assets/src/medias/rubies/examples/mute.rb +0 -22
  316. data/vendor/assets/src/medias/rubies/examples/on.rb +0 -26
  317. data/vendor/assets/src/medias/rubies/examples/opacity.rb +0 -5
  318. data/vendor/assets/src/medias/rubies/examples/over.rb +0 -21
  319. data/vendor/assets/src/medias/rubies/examples/pause.rb +0 -15
  320. data/vendor/assets/src/medias/rubies/examples/physical.rb +0 -19
  321. data/vendor/assets/src/medias/rubies/examples/play.rb +0 -15
  322. data/vendor/assets/src/medias/rubies/examples/read.rb +0 -11
  323. data/vendor/assets/src/medias/rubies/examples/refresh.rb +0 -8
  324. data/vendor/assets/src/medias/rubies/examples/remove.rb +0 -16
  325. data/vendor/assets/src/medias/rubies/examples/repeat.rb +0 -6
  326. data/vendor/assets/src/medias/rubies/examples/right.rb +0 -3
  327. data/vendor/assets/src/medias/rubies/examples/rotate.rb +0 -4
  328. data/vendor/assets/src/medias/rubies/examples/schedule.rb +0 -13
  329. data/vendor/assets/src/medias/rubies/examples/shadow.rb +0 -84
  330. data/vendor/assets/src/medias/rubies/examples/size.rb +0 -8
  331. data/vendor/assets/src/medias/rubies/examples/sort.rb +0 -18
  332. data/vendor/assets/src/medias/rubies/examples/style.rb +0 -4
  333. data/vendor/assets/src/medias/rubies/examples/tags.rb +0 -10
  334. data/vendor/assets/src/medias/rubies/examples/text.rb +0 -39
  335. data/vendor/assets/src/medias/rubies/examples/time.rb +0 -18
  336. data/vendor/assets/src/medias/rubies/examples/to_px.rb +0 -10
  337. data/vendor/assets/src/medias/rubies/examples/touch.rb +0 -56
  338. data/vendor/assets/src/medias/rubies/examples/vector.rb +0 -39
  339. data/vendor/assets/src/medias/rubies/examples/video.rb +0 -65
  340. data/vendor/assets/src/medias/rubies/examples/wait.rb +0 -8
  341. data/vendor/assets/src/medias/rubies/examples/web.rb +0 -13
  342. data/vendor/assets/src/medias/rubies/examples/width.rb +0 -6
  343. data/vendor/assets/src/medias/rubies/test.rb +0 -1
  344. data/vendor/assets/src/medias/rubies/text_read.rb +0 -1
  345. data/vendor/assets/src/medias/rubies/unstable/!run.rb +0 -16
  346. data/vendor/assets/src/medias/rubies/unstable/_2_solve.rb +0 -72
  347. data/vendor/assets/src/medias/rubies/unstable/_attach.rb +0 -12
  348. data/vendor/assets/src/medias/rubies/unstable/_audio.rb +0 -231
  349. data/vendor/assets/src/medias/rubies/unstable/_dataset.rb +0 -257
  350. data/vendor/assets/src/medias/rubies/unstable/_matrix.rb +0 -58
  351. data/vendor/assets/src/medias/rubies/unstable/_os.rb +0 -29
  352. data/vendor/assets/src/medias/rubies/unstable/_table2.rb +0 -108
  353. data/vendor/assets/src/medias/rubies/unstable/_vie.rb +0 -211
  354. data/vendor/assets/src/medias/rubies/users/code.rb +0 -6
  355. /data/lib/{atome/renderers → platform_specific}/opal/opal.rb +0 -0
  356. /data/lib/{atome/renderers → platform_specific}/opal/opal_parser.rb +0 -0
  357. /data/{vendor/assets/src/utilities/mode.rb → lib/renderers/html/communication.rb} +0 -0
  358. /data/{vendor/assets/src/medias/rubies/unstable/_test.rb → lib/renderers/html/security.rb} +0 -0
data/exe/atome CHANGED
@@ -4,206 +4,339 @@
4
4
  require 'fileutils'
5
5
  require 'securerandom'
6
6
  require 'digest/sha2'
7
- # below are the methods needed for atome creation and run
8
- def test_path(project_name, arg_name, path)
9
- if project_name != 'run' && project_name != 'guard' && !project_name.nil? &&
10
- project_name != 'port:' && project_name != 'server' && project_name != 'build'
11
- # the line below remove the optional parameters from the project name
12
- project_name = project_name.sub(ARGV[ARGV.find_index(arg_name) + 1], '')
13
- "#{path}/#{project_name}"
14
- end
15
- path
16
- end
7
+ require 'pathname'
8
+ require 'opal'
9
+ require 'parser'
10
+ require 'uglifier'
11
+
12
+ # utils
13
+
14
+ def modify_and_copy_file(source_path, destination_path, destination_dir)
15
+
16
+ file_content = File.read(source_path)
17
+ cleaned_content = file_content.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
18
+ modified_code = cleaned_content.gsub(/require\s+(['"])(.*?)\1/) do |match|
19
+ quote = $1
20
+ relative_path = $2
21
+ if relative_path.start_with?('./')
22
+ relative_path_copy = "#{relative_path}"
23
+ relative_path_copy.slice!(0, 2)
24
+ destination_dir_copy = "#{destination_dir}"
25
+ destination_dir_copy.slice!(0, 2)
26
+ "require #{quote}#{relative_path_copy}#{quote}"
27
+ else
28
+ match
29
+ end
17
30
 
18
- def found_path(arg_name)
19
- project_name = ARGV[ARGV.find_index(arg_name) + 1]
20
- path = `pwd`.chomp
21
- if ARGV[ARGV.find_index(arg_name) + 1] == 'production'
22
- app_builder_helpers = File.join(File.dirname(__FILE__), '../app_builder_helpers')
23
- `cd #{app_builder_helpers};rake minimizer[#{path}]`
24
31
  end
25
- path = `pwd`.chomp
26
- test_path(project_name, arg_name, path)
32
+ File.write(destination_path, modified_code)
27
33
  end
28
34
 
29
- def delete_all(dir, user_application = nil)
30
- Dir.foreach(dir) do |e|
31
- next if %w[. ..].include? e
35
+ def process_directories(source_dir, destination_dir)
32
36
 
33
- full_name = dir + File::Separator + e
34
- if FileTest.directory?(full_name)
35
- delete_all(full_name, user_application) if user_application && dir != 'application'
36
- else
37
- File.delete(full_name)
37
+ Dir.entries(source_dir).each do |entry|
38
+ next if entry == '.' || entry == '..'
39
+
40
+ source_path = File.join(source_dir, entry)
41
+ destination_path = File.join(destination_dir, entry)
42
+
43
+ if File.directory?(source_path)
44
+ Dir.mkdir(destination_path) unless Dir.exist?(destination_path)
45
+ process_directories(source_path, destination_path)
46
+ elsif File.file?(source_path)
47
+ modify_and_copy_file(source_path, destination_path, destination_dir)
38
48
  end
39
49
  end
40
- Dir.delete(dir) if user_application && dir != 'application'
41
50
  end
42
51
 
43
- def build_app(path, production)
44
- # now run the rake task to build the needed libraries (atome, renderers, etc...)
45
- app_builder_helpers = File.join(File.dirname(__FILE__), '../app_builder_helpers')
46
- # now run the rake task to compile user code to javascript
47
- `cd #{app_builder_helpers};rake build_user_code[#{path},#{production}]`
48
- end
49
-
50
- def content_to_add(coded_id)
51
- <<~STR
52
+ # builders
53
+ def build_aui(destination, project_name)
54
+ path = "#{destination}/#{project_name}/src/utilities/"
55
+ FileUtils.mkdir_p(path) unless Dir.exist?(path)
56
+ uuid = SecureRandom.uuid
57
+ sha = Digest::SHA256.hexdigest(uuid)
58
+ coded_id = sha.gsub('-', '_')
59
+ aui_file = <<~STR
52
60
  class Atome
53
61
  def self.aui
54
62
  "#{coded_id}"
55
63
  end
56
64
  end
57
65
  STR
58
- end
59
-
60
- def app_creation(content_to_add, current_path, project_name)
61
- added_content = content_to_add
62
- file_location = "#{current_path}/#{project_name}/aui.rb"
63
- File.new file_location, 'w'
64
- File.open(file_location, 'w') do |f|
65
- f.puts added_content
66
+ File.new("#{path}aui.rb", 'w')
67
+ File.open("#{path}aui.rb", 'w') do |f|
68
+ f.puts aui_file
69
+ end
70
+ # now building opal version
71
+ js_directory = "#{destination}/#{project_name}/src/js"
72
+ opal_js = "#{js_directory}/aui.js"
73
+ File.new opal_js, 'w'
74
+ # we add platform_specific script to the Opal framework
75
+ opal_content = Opal::Builder.build("#{path}aui.rb").to_s
76
+ File.open(opal_js, 'w') do |f|
77
+ f.puts opal_content
66
78
  end
79
+
67
80
  end
68
81
 
69
- def test_app_creation(project_name, current_path, force)
70
- new_app_creation = false
71
- unless force && File.directory?(project_name)
72
- new_app_creation = true
73
- Dir.mkdir project_name
74
- # now lets create the application identity
75
- uuid = SecureRandom.uuid
76
- sha = Digest::SHA256.hexdigest(uuid)
77
- coded_id = sha.gsub('-', '_')
78
- app_creation(content_to_add(coded_id), current_path, project_name)
82
+ def build_host_mode(destination, project_name, mode)
83
+ path = "#{destination}/#{project_name}/src/utilities/"
84
+ FileUtils.mkdir_p(path) unless Dir.exist?(path)
85
+ host_type = <<~STR
86
+ class Atome
87
+ def self.host
88
+ "#{mode}"
89
+ end
90
+ end
91
+ STR
92
+ File.new("#{path}host_mode.rb", 'w')
93
+ File.open("#{path}host_mode.rb", 'w') do |f|
94
+ f.puts host_type
95
+ end
96
+ # now building opal version
97
+ js_directory = "#{destination}/#{project_name}/src/js"
98
+ opal_js = "#{js_directory}/host_mode.js"
99
+ File.new opal_js, 'w'
100
+ # we add platform_specific script to the Opal framework
101
+ opal_content = Opal::Builder.build("#{path}host_mode.rb").to_s
102
+ File.open(opal_js, 'w') do |f|
103
+ f.puts opal_content
79
104
  end
80
- new_app_creation
81
105
  end
82
106
 
83
- def build_atome_resources(current_path, project_name, production)
84
- gem_assets_location = File.join(File.dirname(__FILE__), '../vendor/assets/')
85
- app_builder_helpers = File.join(File.dirname(__FILE__), '../app_builder_helpers')
86
- target_template_location = "#{current_path}/#{project_name}"
87
- Dir.entries(gem_assets_location).select do |entry|
88
- if File.join(entry) && !%w[. ..].include?(entry)
89
- entry = "#{File.dirname(__FILE__)}/../vendor/assets/#{entry}"
90
- FileUtils.cp_r entry, target_template_location
91
- end
107
+ # opal compilation
108
+ def build_opal_application(_source, destination, project_name)
109
+ # first we need to remplace all './require ' with require so opal can parse the path
110
+ Dir.mkdir("#{destination}/#{project_name}/tmp") unless Dir.exist?("#{destination}/#{project_name}/tmp")
111
+ unless Dir.exist?("#{destination}/#{project_name}/tmp/application")
112
+ Dir.mkdir("#{destination}/#{project_name}/tmp/application")
92
113
  end
93
- # now run the rake task to build the needed libraries (atome, renderers, etc...)
94
- `cd #{app_builder_helpers};rake system_builder[#{current_path}/#{project_name},#{production}]`
114
+ process_directories("#{destination}/#{project_name}/application", "#{destination}/#{project_name}/tmp/application")
115
+
116
+ opal_compiler_content = <<STR
117
+ # frozen_string_literal: true
118
+
119
+ require 'opal'
120
+ application_js = "../../src/js/application.js"
121
+ builder = Opal::Builder.new
122
+ builder.append_paths("./")
123
+ application_content = builder.build("./index.rb").to_s
124
+ File.open(application_js, 'w') do |f|
125
+ f.puts application_content
95
126
  end
127
+ STR
96
128
 
97
- def create_application(project_name, force, production)
98
- # print "directory already exist, use force to overwrite"
99
- current_path = `pwd`.chomp
100
- new_app_creation = test_app_creation(project_name, current_path, force)
101
- build_atome_resources(current_path, project_name, production)
102
- return unless new_app_creation
103
-
104
- # now adding name to the app
105
- index_html = "#{current_path}/#{project_name}/src/index.html"
106
- index_html_content = File.open(index_html).read
107
- index_html_content = index_html_content.gsub('<title>atome</title>', "<title>#{project_name}</title>")
108
- File.open(index_html, 'w') do |f|
109
- f.puts index_html_content
129
+ # we create an hidden file
130
+ opal_compiler = "#{destination}/#{project_name}/tmp/application/.opal_compiler.rb"
131
+ File.open(opal_compiler, 'w') do |f|
132
+ f.puts opal_compiler_content
110
133
  end
134
+ `cd #{destination}/#{project_name}/tmp/application/;pwd;ruby .opal_compiler.rb`
111
135
  end
112
136
 
113
- def update_application(project_name, production)
114
- app_builder_helpers = File.join(File.dirname(__FILE__), '../app_builder_helpers')
115
- `cd #{app_builder_helpers};rake system_updater[#{project_name},#{production}]`
137
+ def add_to_application_folder(script_source, destination, project_name)
138
+ # this method is to add addition script to the application folder (useful for test per example)
139
+ destination_dir = "#{destination}/#{project_name}/application"
140
+ FileUtils.cp_r(Dir["#{script_source}/*"], destination_dir)
116
141
  end
117
142
 
118
- def guard_check
119
- loop do
120
- sleep 1
143
+ def build_opal_library(atome_source, destination, project_name, production = nil)
144
+ user_project_path = "#{destination}/#{project_name}"
145
+ opal_directory = "#{user_project_path}/src/js/opal"
146
+ opal_js = "#{opal_directory}/opal.js"
147
+ Dir.mkdir(opal_directory) unless File.directory?(opal_directory)
148
+ File.new opal_js, 'w'
149
+ # we add platform_specific script to the Opal framework
150
+ opal_content = Opal::Builder.build("#{atome_source}/lib/platform_specific/opal/opal.rb").to_s
151
+ File.open(opal_js, 'w') do |f|
152
+ f.puts opal_content
121
153
  end
122
- nil unless ARGV.include?('guard')
123
154
  end
124
155
 
125
- def browser_case(location)
126
- `cd #{location}/src;open index.html`
127
- # `echo jello`
128
- # guard_check
156
+ def create_application(source, destination, project_name)
157
+ project_path = "#{destination}/#{project_name}"
158
+ FileUtils.mkdir_p(destination) unless Dir.exist?(destination)
159
+ FileUtils.mkdir_p(project_path) unless Dir.exist?(project_path)
160
+ files_list = ['application', 'server', 'src', 'src-tauri', 'src-wasm', 'Guardfile', 'Rakefile']
161
+ file_to_refresh = ['application', 'server', 'src', 'src-tauri', 'Rakefile']
162
+ # we delete many folder to ensure they'll refreshed
163
+ file_to_refresh.each do |file|
164
+ FileUtils.rm_rf("#{destination}/#{project_name}/#{file}")
165
+ end
166
+ # we copy all folder to be refreshed
167
+ files_list.each do |file|
168
+ FileUtils.cp_r("#{source}/vendor/assets/#{file}", "#{destination}/#{project_name}/#{file}") unless Dir.exist?(file)
169
+ end
170
+ build_aui(destination, project_name)
129
171
  end
130
172
 
131
- def osx_case(location)
132
- `cd #{location};cargo tauri dev`
173
+ def update_application(source, destination, project_name)
174
+ project_path = "#{destination}/#{project_name}"
175
+ FileUtils.mkdir_p(destination) unless Dir.exist?(destination)
176
+ FileUtils.mkdir_p(project_path) unless Dir.exist?(project_path)
177
+ files_list = ['application', 'server', 'src', 'src-tauri', 'src-wasm', 'Guardfile', 'Rakefile']
178
+ file_to_refresh = ['application', 'server', 'src',]
179
+ # we delete many folder to ensure they'll refreshed
180
+ file_to_refresh.each do |file|
181
+ FileUtils.rm_rf("#{destination}/#{project_name}/#{file}")
182
+ end
183
+ # we copy all folder to be refreshed
184
+ files_list.each do |file|
185
+ FileUtils.cp_r("#{source}/vendor/assets/#{file}", "#{destination}/#{project_name}/#{file}") unless Dir.exist?(file)
186
+ end
187
+ build_aui(destination, project_name)
133
188
  end
134
189
 
135
- def compile_case(location)
136
- `cd #{location}/src`
137
- guard_check
138
- end
190
+ def build_opal_parser(source, destination, project_name)
139
191
 
140
- def server_case(port, location)
141
- threads = []
142
- threads << Thread.new do
143
- sleep 1.5
144
- `open http://localhost:9292/index`
192
+ parser_js = "#{destination}/#{project_name}/src/js/opal/opal_parser.js"
193
+ File.new parser_js, 'w'
194
+ parser_content = Opal::Builder.build("#{source}/lib/platform_specific/opal/opal_parser.rb").to_s
195
+ File.open(parser_js, 'w') do |f|
196
+ f.puts parser_content
145
197
  end
146
- `cd #{location}/server;rackup --server puma --port #{port} --env production`
147
198
  end
148
199
 
149
- def run_case(build_target, location, port)
150
- case build_target
151
- when :server
152
- server_case(port, location)
153
- when :browser
154
- browser_case(location)
155
- when :osx
156
- osx_case(location)
157
- when :compile
158
- compile_case(location)
159
- when :native
160
- # freebsd
161
- else
162
- guard_check
200
+ def build_atome_kernel_for_opal(source, destination, project_name)
201
+ # now lets build the atome kernel
202
+ atome_directory = "#{destination}/#{project_name}/src/js/atome"
203
+ kernel_js = "#{atome_directory}/kernel.js"
204
+ File.new kernel_js, 'w'
205
+ builder = Opal::Builder.new
206
+ builder.append_paths("#{source}/lib/")
207
+ kernel_content = builder.build("#{source}/lib/atome.rb").to_s
208
+ File.open(kernel_js, 'w') do |f|
209
+ f.puts kernel_content
163
210
  end
164
211
  end
165
212
 
166
- def run_application(build_target, location, port = 9292)
167
- build_app(location, nil)
168
- run_case(build_target, location, port)
213
+ def build_opal_extensions(source, destination, project_name)
214
+ opal_directory = "#{destination}/#{project_name}/src/js/opal"
215
+ extensions_js = "#{opal_directory}/atome_opal_extensions.js"
216
+ File.new extensions_js, 'w'
217
+ builder = Opal::Builder.new
218
+ builder.append_paths("#{source}/lib/platform_specific/opal/")
219
+ extensions_content = builder.build("#{source}/lib/platform_specific/opal/atome_opal_extensions.rb").to_s
220
+ File.open(extensions_js, 'w') do |f|
221
+ f.puts extensions_content
222
+ end
169
223
  end
170
224
 
171
- # below we analyse the ARGV
172
- location = '/'
173
- force = nil
174
- production = nil
175
- port = 9292
225
+ # wasm compilation
226
+ def wasm_common(source, destination, project_name, wasi_file, host_mode, script_source = nil)
227
+ # create_application(source, destination, project_name)
228
+ # the line below is to add addition script to the application folder (useful for test per example)
229
+ add_to_application_folder(script_source, destination, project_name) if script_source
230
+ # build host_mode
231
+ build_host_mode(destination, project_name, host_mode)
232
+ # build wasm
233
+ build_for_wasm(source, destination, project_name, wasi_file)
234
+ end
176
235
 
177
- production = 'production' if ARGV.include?('production')
236
+ def wasm_initialize (source, destination, project_name, wasi_source)
237
+ application_location = "#{destination}/#{project_name}"
238
+ wasm_location = "#{application_location}/src/wasm/"
239
+ Dir.mkdir(wasm_location) unless Dir.exist?(wasm_location)
240
+
241
+ wasm_temp_folder = "#{application_location}/tmp"
242
+ Dir.mkdir(wasm_temp_folder) unless Dir.exist?(wasm_temp_folder)
243
+ #### IMPORTANT TO REFRESH RUBY WASM TO THE LATEST VERSION, (when ruby_browser get far too large)
244
+ # and UNCOMMENT the line below : ('curl -LO ....')
245
+ unless File.exist?("#{wasm_temp_folder}/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz")
246
+ # `cd #{wasm_temp_folder};curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
247
+ `cd #{wasm_temp_folder};curl -LO https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
248
+ # debug : https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-minimal-js-debug.tar.gz
249
+ # standard : `cd #{wasm_temp_folder};curl -LO https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
250
+ end
251
+ `cd #{wasm_temp_folder}; tar xfz ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
252
+ `mv #{wasm_temp_folder}/3_2-wasm32-unknown-wasi-full-js/usr/local/bin/ruby #{wasm_temp_folder}/system_ruby_browser.wasm`
253
+ `rm -f #{application_location}/src/wasm/ruby_browser.wasm`
254
+ cmd = <<~STRDELIM
255
+ #{application_location}/src-wasm/wasm/#{wasi_source} pack #{wasm_temp_folder}/system_ruby_browser.wasm
256
+ --mapdir usr::#{wasm_temp_folder}/3_2-wasm32-unknown-wasi-full-js/usr
257
+ --mapdir lib::#{source}/lib/
258
+ --mapdir /::#{application_location}/application/
259
+ --mapdir utilities::#{application_location}/src/utilities/
260
+ -o #{application_location}/src/wasm/ruby_browser.wasm
261
+ STRDELIM
262
+ cleaned_cmd = cmd.lines.reject { |line| line.start_with?('#') }.join
263
+ command = cleaned_cmd.chomp.gsub("\n", ' ')
264
+ system(command)
265
+ end
178
266
 
179
- force = 'force' if ARGV.include?('force')
267
+ def guard_check
268
+ loop do
269
+ sleep 1
270
+ end
271
+ nil unless ARGV.include?('guard')
272
+ end
180
273
 
181
- port = ARGV[ARGV.find_index('port:') + 1] if ARGV.include?('port:')
274
+ def build_for_wasm(source, destination, project_name, wasi_file)
275
+ wasm_initialize(source, destination, project_name, wasi_file)
276
+ end
182
277
 
183
- platforms = %w[android browser server osx freebsd ios linux osx windows]
184
- # now setting build_target
278
+ def build_for_osx(destination, mode = :dev)
279
+ # dev or build
185
280
 
186
- build_target = 'browser'
281
+ `cd #{destination};cargo tauri #{mode}`
187
282
 
188
- platforms.each do |platform|
189
- build_target = platform if ARGV.include?(platform)
190
283
  end
191
284
 
192
- if ARGV.include?('create')
193
- project_name = ARGV[1]
194
- location = "/#{project_name}"
195
- create_application(project_name, force, production)
285
+ def build_for_server(destination, project_name, port, production)
286
+ prod = '--env production' if production
287
+ `cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
196
288
  end
197
289
 
198
- if ARGV.include?('build')
199
- path = found_path('build')
200
- build_app(path, production)
290
+ # def run_application(build_target, location, port = 9292, production = false)
291
+ # build_app(location, nil)
292
+ # run_case(build_target, location, port, production)
293
+ # end
294
+
295
+ # below we analyse the ARGV
296
+ location = '/'
297
+ project_name = ARGV[1]
298
+ destination = `pwd`.chomp
299
+ source = Pathname(__FILE__).parent.parent.to_s
300
+
301
+ wasi_file = 'wasi-vfs-osx_arm' # default to osx arm
302
+ # TODO : get wasi params from ARG to allow compile on windows / Unix
303
+ if ARGV.include?('create')
304
+ create_application(source, destination, project_name)
305
+ # create_application(source, destination, project_name, production)
306
+ wasm_common(source, destination, project_name, wasi_file, :universal)
307
+ # build opal
308
+ build_opal_library(source, destination, project_name)
309
+ # build parser
310
+ build_opal_parser(source, destination, project_name)
311
+ # build atome kernel
312
+ build_atome_kernel_for_opal(source, destination, project_name)
313
+ # build Opal extensions
314
+ build_opal_extensions(source, destination, project_name)
315
+ # build application
316
+ build_opal_application(source, destination, project_name)
201
317
  end
202
318
 
203
319
  if ARGV.include?('update')
204
320
  # TODO: also update index.html and all other files except the application folder
205
- path = found_path('update')
206
- update_application(path, production)
321
+ # first we delete everything but application
322
+ folders_to_keep = ['application']
323
+ Dir.foreach(destination) do |item|
324
+ item_path = File.join(destination, item)
325
+ if File.directory?(item_path) && !folders_to_keep.include?(item)
326
+ FileUtils.rm_rf(item_path) unless item == '.' || item == '..'
327
+ elsif File.file?(item_path)
328
+ File.delete(item_path)
329
+ end
330
+ end
331
+ # now we update
332
+ puts "#{source}/vendor/assets"
333
+
334
+ update_source = "#{source}/vendor/assets"
335
+
336
+ Dir.glob("#{update_source}/*").each do |item|
337
+ target = File.join(destination, File.basename(item))
338
+ FileUtils.cp_r(item, target) unless File.exist?(target)
339
+ end
207
340
  end
208
341
 
209
342
  if ARGV.include?('guard')
@@ -215,78 +348,45 @@ if ARGV.include?('guard')
215
348
  end
216
349
  end
217
350
 
218
- def set_atome_mode(location, mode)
219
- mode_file = "#{location}/src/utilities/mode.rb"
220
- file_found = File.open(mode_file)
221
- atome_mode=<<~STR
222
- $host = :#{mode}
223
- STR
224
- File.open(file_found, 'w') do |f|
225
- f.puts atome_mode
226
- end
227
- end
228
-
229
351
  if ARGV.include?('run')
230
- path = if location != '/'
231
- "#{`pwd`.chomp}/#{location}"
232
- else
233
- found_path('run')
234
- end
235
- demo_location = "#{path}/src/medias/rubies"
236
-
237
- filenames = Dir.glob(demo_location+'/examples/*.rb')
238
- demos_list_content=[]
239
- filenames.each do |path|
240
- filename= File.basename(path)
241
- demos_list_content << filename
242
- end
243
- demos_list_file = "#{demo_location}/demos_list.rb"
244
- File.open(demos_list_file, 'w') do |f|
245
- # f.puts "class Atome_demo\n def demos_list\n #{demos_list_content}\n end\nend"
246
- f.puts "def demos_list\n #{demos_list_content}\nend"
247
- end
248
-
249
-
250
-
251
- case build_target
252
- when 'android'
253
- set_atome_mode(path,'tauri')
254
- # TODO: write code here
255
- when 'browser'
256
- set_atome_mode(path,'browser')
257
- run_application(:browser, path)
258
- when 'freebsd'
259
- set_atome_mode(path,'native')
260
- # TODO: write code here
261
- when 'ios'
262
- set_atome_mode(path,'tauri')
263
- # TODO: write code here
264
- when 'linux'
265
- # TODO: write code here
266
- when 'osx'
267
- set_atome_mode(path,'tauri')
268
- run_application(:osx, path)
352
+ current_path = `pwd`.chomp
353
+ segments = current_path.split("/")
354
+ project_name = segments.last
355
+ destination = segments[0...-1].join("/")
356
+ case ARGV[1]
357
+ when 'opal'
358
+ build_opal_application(nil, destination, project_name)
359
+ `open #{destination}/#{project_name}/src/index_opal.html`
360
+ when 'wasm' # osx wasi
361
+ wasi_file = 'wasi-vfs-osx_arm'
362
+ wasm_common(source, destination, project_name, wasi_file, :pure_wasi)
363
+ `open #{current_path}/src/index.html`
269
364
  when 'server'
270
- set_atome_mode(path,'server')
271
- config_location = "#{path}/server/config.ru"
272
- file = File.open(config_location)
273
- text = file.read
274
- text = text.gsub('run Unreloader', '')
275
- text = text.gsub('run App.freeze.app', '')
276
- text = text.gsub(/^$\n/, '')
277
- text = if production == 'production'
278
- "#{text}run App.freeze.app"
279
- else
280
- "#{text}run Unreloader"
281
- end
282
- File.open(config_location, 'w') do |f|
283
- f.puts text
365
+ build_opal_application(nil, destination, project_name)
366
+ threads = []
367
+ threads << Thread.new do
368
+ sleep 1
369
+ `open http://localhost:9292`
284
370
  end
285
- run_application(:server, path, port)
371
+ build_for_server(destination, project_name, 9292, :production)
372
+ when 'osx'
373
+ wasi_file = 'wasi-vfs-osx_arm'
374
+ wasm_common(source, destination, project_name, wasi_file, :tauri)
375
+ build_for_osx(destination)
376
+ when 'android'
377
+ # to be filled
378
+ when 'ios'
379
+ # to be filled
286
380
  when 'windows'
287
- # TODO: write code here
381
+ # to be filled
382
+ when 'linux'
383
+ # to be filled
384
+ when 'freebsd'
385
+ # to be filled
288
386
  else
289
- run_application(:browser, path)
387
+ wasi_file = 'wasi-vfs-osx_arm'
388
+ wasm_common(source, destination, project_name, wasi_file, 'pure_wasm')
389
+ `open #{current_path}/src/index.html`
290
390
  end
291
391
 
292
392
  end