scarpe 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.yardopts +12 -0
  4. data/CHANGELOG.md +16 -2
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +116 -0
  7. data/README.md +53 -30
  8. data/Rakefile +13 -1
  9. data/docs/yard/catscradle.md +44 -0
  10. data/docs/yard/template/default/fulldoc/html/setup.rb +13 -0
  11. data/docs/yard/template/default/layout/html/setup.rb +9 -0
  12. data/examples/animate.rb +20 -0
  13. data/examples/arrow.rb +10 -0
  14. data/examples/background_with_image.rb +16 -0
  15. data/examples/bloopsaphone/working/bronx_army_knife.rb +66 -0
  16. data/examples/bloopsaphone/working/morning_serenity.rb +21 -0
  17. data/examples/bloopsaphone/working/simpsons_theme_song_by_why.rb +6 -4
  18. data/examples/btn_tooltip.rb +7 -0
  19. data/examples/button_go_away.rb +1 -1
  20. data/examples/button_style_changed.rb +7 -0
  21. data/examples/button_styles_default.rb +6 -0
  22. data/examples/check.rb +18 -0
  23. data/examples/clear_and_append.rb +24 -0
  24. data/examples/download_and_show_image.rb +28 -0
  25. data/examples/edit_box.rb +3 -5
  26. data/examples/fonts.rb +2 -2
  27. data/examples/gen.rb +8 -8
  28. data/examples/get_headers.rb +10 -0
  29. data/examples/highlander.rb +4 -2
  30. data/examples/legacy/README.md +6 -0
  31. data/examples/legacy/not_checked/shoes-contrib/basic/shoes-notes.rb +1 -1
  32. data/examples/legacy/not_checked/simple/anim-shapes.rb +1 -1
  33. data/examples/legacy/not_checked/speedometer_app.rb +55 -0
  34. data/examples/legacy/working/simple/image-icon.rb +3 -0
  35. data/examples/legacy/{not_checked → working}/simple/image.rb +1 -1
  36. data/examples/link.rb +2 -2
  37. data/examples/list_box_choose.rb +17 -0
  38. data/examples/local_assets/local_file_server.rb +82 -0
  39. data/examples/local_assets/sample.gif +0 -0
  40. data/examples/local_assets/sample.mp4 +0 -0
  41. data/examples/local_fonts.rb +4 -0
  42. data/examples/local_images.rb +3 -0
  43. data/examples/motion_events.rb +20 -0
  44. data/examples/para/para_text.rb +14 -0
  45. data/examples/parse_xl_funnies.rb +58 -0
  46. data/examples/progress.rb +31 -0
  47. data/examples/radio/radio.rb +16 -0
  48. data/examples/radio/radio_groups.rb +18 -0
  49. data/examples/radio/radio_same_slot.rb +6 -0
  50. data/examples/rect.rb +4 -0
  51. data/examples/rotate_shapes.rb +17 -0
  52. data/examples/ruby_racer.rb +13 -15
  53. data/examples/selfitude.rb +18 -0
  54. data/examples/shapes/shapes_fill.rb +4 -3
  55. data/examples/shoes_school.rb +2 -4
  56. data/examples/show_hide.rb +6 -0
  57. data/examples/simpler-menu.rb +21 -0
  58. data/examples/skip_ci/change_my_audio_source.rb +21 -0
  59. data/examples/skip_ci/guitar_fretboard.rb +137 -0
  60. data/examples/video.rb +10 -0
  61. data/exe/scarpe +43 -66
  62. data/fonts/Pacifico.ttf +0 -0
  63. data/lacci/Gemfile +24 -0
  64. data/lacci/Gemfile.lock +79 -0
  65. data/lacci/Rakefile +12 -0
  66. data/lacci/lacci.gemspec +37 -0
  67. data/lacci/lib/lacci/scarpe_cli.rb +71 -0
  68. data/lacci/lib/lacci/scarpe_core.rb +22 -0
  69. data/lacci/lib/lacci/version.rb +13 -0
  70. data/lacci/lib/scarpe/niente/app.rb +23 -0
  71. data/lacci/lib/scarpe/niente/display_service.rb +62 -0
  72. data/lacci/lib/scarpe/niente/drawable.rb +57 -0
  73. data/lacci/lib/scarpe/niente/logger.rb +29 -0
  74. data/lacci/lib/scarpe/niente/shoes_spec.rb +87 -0
  75. data/lacci/lib/scarpe/niente.rb +20 -0
  76. data/lacci/lib/shoes/app.rb +309 -0
  77. data/{lib/scarpe → lacci/lib/shoes}/background.rb +2 -2
  78. data/{lib/scarpe → lacci/lib/shoes}/border.rb +2 -2
  79. data/lacci/lib/shoes/builtins.rb +63 -0
  80. data/lacci/lib/shoes/changelog.rb +52 -0
  81. data/{lib/scarpe → lacci/lib/shoes}/colors.rb +3 -1
  82. data/lacci/lib/shoes/constants.rb +47 -0
  83. data/{lib/scarpe → lacci/lib/shoes}/display_service.rb +71 -53
  84. data/lacci/lib/shoes/download.rb +123 -0
  85. data/lacci/lib/shoes/drawable.rb +380 -0
  86. data/lacci/lib/shoes/drawables/arc.rb +49 -0
  87. data/lacci/lib/shoes/drawables/arrow.rb +41 -0
  88. data/lacci/lib/shoes/drawables/button.rb +73 -0
  89. data/lacci/lib/shoes/drawables/check.rb +29 -0
  90. data/lacci/lib/shoes/drawables/document_root.rb +20 -0
  91. data/lacci/lib/shoes/drawables/edit_box.rb +29 -0
  92. data/{lib/scarpe → lacci/lib/shoes/drawables}/edit_line.rb +6 -6
  93. data/lacci/lib/shoes/drawables/flow.rb +22 -0
  94. data/{lib/scarpe → lacci/lib/shoes/drawables}/image.rb +7 -11
  95. data/lacci/lib/shoes/drawables/line.rb +20 -0
  96. data/lacci/lib/shoes/drawables/link.rb +34 -0
  97. data/lacci/lib/shoes/drawables/list_box.rb +56 -0
  98. data/lacci/lib/shoes/drawables/para.rb +118 -0
  99. data/lacci/lib/shoes/drawables/progress.rb +14 -0
  100. data/lacci/lib/shoes/drawables/radio.rb +33 -0
  101. data/lacci/lib/shoes/drawables/rect.rb +17 -0
  102. data/lacci/lib/shoes/drawables/shape.rb +36 -0
  103. data/lacci/lib/shoes/drawables/slot.rb +87 -0
  104. data/{lib/scarpe → lacci/lib/shoes/drawables}/span.rb +8 -7
  105. data/lacci/lib/shoes/drawables/stack.rb +26 -0
  106. data/lacci/lib/shoes/drawables/star.rb +50 -0
  107. data/lacci/lib/shoes/drawables/subscription_item.rb +93 -0
  108. data/lacci/lib/shoes/drawables/text_drawable.rb +63 -0
  109. data/lacci/lib/shoes/drawables/video.rb +16 -0
  110. data/lacci/lib/shoes/drawables/widget.rb +69 -0
  111. data/lacci/lib/shoes/drawables.rb +31 -0
  112. data/lacci/lib/shoes/errors.rb +28 -0
  113. data/lacci/lib/shoes/log.rb +71 -0
  114. data/lacci/lib/shoes/ruby_extensions.rb +15 -0
  115. data/lacci/lib/shoes/spacing.rb +9 -0
  116. data/lacci/lib/shoes-spec.rb +93 -0
  117. data/lacci/lib/shoes.rb +147 -0
  118. data/lacci/test/test_colors.rb +39 -0
  119. data/lacci/test/test_helper.rb +63 -0
  120. data/lacci/test/test_lacci.rb +18 -0
  121. data/lacci/test/test_shoes_errors.rb +49 -0
  122. data/lib/scarpe/cats_cradle.rb +271 -0
  123. data/lib/scarpe/errors.rb +77 -0
  124. data/lib/scarpe/evented_assertions.rb +121 -0
  125. data/lib/scarpe/shoes_spec.rb +181 -0
  126. data/lib/scarpe/version.rb +2 -2
  127. data/lib/scarpe/wv/app.rb +45 -23
  128. data/lib/scarpe/wv/arc.rb +4 -48
  129. data/lib/scarpe/wv/arrow.rb +9 -0
  130. data/lib/scarpe/wv/button.rb +7 -33
  131. data/lib/scarpe/wv/check.rb +27 -0
  132. data/lib/scarpe/wv/control_interface.rb +32 -40
  133. data/lib/scarpe/wv/document_root.rb +66 -31
  134. data/lib/scarpe/wv/drawable.rb +273 -0
  135. data/lib/scarpe/wv/edit_box.rb +4 -19
  136. data/lib/scarpe/wv/edit_line.rb +4 -18
  137. data/lib/scarpe/wv/flow.rb +2 -28
  138. data/lib/scarpe/wv/image.rb +10 -25
  139. data/lib/scarpe/wv/line.rb +3 -28
  140. data/lib/scarpe/wv/link.rb +3 -15
  141. data/lib/scarpe/wv/list_box.rb +6 -29
  142. data/lib/scarpe/wv/para.rb +11 -28
  143. data/lib/scarpe/wv/progress.rb +19 -0
  144. data/lib/scarpe/wv/radio.rb +33 -0
  145. data/lib/scarpe/wv/rect.rb +13 -0
  146. data/lib/scarpe/wv/shape.rb +41 -10
  147. data/lib/scarpe/wv/slot.rb +64 -0
  148. data/lib/scarpe/wv/span.rb +3 -25
  149. data/lib/scarpe/wv/stack.rb +2 -38
  150. data/lib/scarpe/wv/star.rb +3 -54
  151. data/lib/scarpe/wv/subscription_item.rb +84 -0
  152. data/lib/scarpe/wv/text_drawable.rb +32 -0
  153. data/lib/scarpe/wv/video.rb +34 -0
  154. data/lib/scarpe/wv/web_wrangler.rb +449 -299
  155. data/lib/scarpe/wv/webview_local_display.rb +63 -26
  156. data/lib/scarpe/wv/webview_relay_display.rb +24 -125
  157. data/lib/scarpe/wv/webview_relay_util.rb +140 -0
  158. data/lib/scarpe/wv/wv_display_worker.rb +19 -6
  159. data/lib/scarpe/wv.rb +76 -14
  160. data/lib/scarpe/wv_local.rb +1 -1
  161. data/lib/scarpe/wv_relay.rb +1 -1
  162. data/lib/scarpe.rb +4 -32
  163. data/logger/debug_web_wrangler.json +1 -1
  164. data/logger/scarpe_wv_test.json +1 -1
  165. data/scarpe-components/.gitignore +1 -0
  166. data/scarpe-components/Gemfile +22 -0
  167. data/scarpe-components/Gemfile.lock +86 -0
  168. data/scarpe-components/README.md +35 -0
  169. data/scarpe-components/Rakefile +12 -0
  170. data/scarpe-components/lib/scarpe/components/base64.rb +25 -0
  171. data/scarpe-components/lib/scarpe/components/calzini/alert.rb +49 -0
  172. data/scarpe-components/lib/scarpe/components/calzini/art_widgets.rb +203 -0
  173. data/scarpe-components/lib/scarpe/components/calzini/button.rb +39 -0
  174. data/scarpe-components/lib/scarpe/components/calzini/misc.rb +146 -0
  175. data/scarpe-components/lib/scarpe/components/calzini/para.rb +35 -0
  176. data/scarpe-components/lib/scarpe/components/calzini/slots.rb +155 -0
  177. data/scarpe-components/lib/scarpe/components/calzini/text_widgets.rb +65 -0
  178. data/scarpe-components/lib/scarpe/components/calzini.rb +149 -0
  179. data/scarpe-components/lib/scarpe/components/errors.rb +20 -0
  180. data/scarpe-components/lib/scarpe/components/file_helpers.rb +66 -0
  181. data/scarpe-components/lib/scarpe/components/html.rb +131 -0
  182. data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +75 -0
  183. data/scarpe-components/lib/scarpe/components/minitest_import_runnable.rb +98 -0
  184. data/scarpe-components/lib/scarpe/components/minitest_result.rb +86 -0
  185. data/scarpe-components/lib/scarpe/components/modular_logger.rb +113 -0
  186. data/scarpe-components/lib/scarpe/components/print_logger.rb +47 -0
  187. data/{lib/scarpe → scarpe-components/lib/scarpe/components}/promises.rb +115 -48
  188. data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +189 -0
  189. data/scarpe-components/lib/scarpe/components/string_helpers.rb +10 -0
  190. data/scarpe-components/lib/scarpe/components/tiranti.rb +225 -0
  191. data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +257 -0
  192. data/scarpe-components/lib/scarpe/components/version.rb +7 -0
  193. data/scarpe-components/scarpe-components.gemspec +38 -0
  194. data/scarpe-components/test/calzini/test_calzini_alert.rb +30 -0
  195. data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +105 -0
  196. data/scarpe-components/test/calzini/test_calzini_button.rb +52 -0
  197. data/scarpe-components/test/calzini/test_calzini_misc.rb +115 -0
  198. data/scarpe-components/test/calzini/test_calzini_para.rb +37 -0
  199. data/scarpe-components/test/calzini/test_calzini_slots.rb +130 -0
  200. data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +41 -0
  201. data/scarpe-components/test/mtr_data/exception.json +1 -0
  202. data/scarpe-components/test/mtr_data/fail_with_message.json +1 -0
  203. data/scarpe-components/test/mtr_data/skipped_no_message.json +1 -0
  204. data/scarpe-components/test/mtr_data/skipped_w_msg.json +1 -0
  205. data/scarpe-components/test/mtr_data/succeed_2_asserts.json +1 -0
  206. data/scarpe-components/test/test_components.rb +9 -0
  207. data/scarpe-components/test/test_dimensions.rb +26 -0
  208. data/scarpe-components/test/test_helper.rb +43 -0
  209. data/scarpe-components/test/test_html.rb +65 -0
  210. data/scarpe-components/test/test_minitest_result.rb +61 -0
  211. data/scarpe-components/test/test_promises.rb +261 -0
  212. data/scarpe-components/test/test_segmented_app_files.rb +184 -0
  213. data/scarpegen.rb +14 -14
  214. data/sig/scarpe.rbs +1 -1
  215. data/{lib/scarpe → spikes}/glibui/widget.rb +2 -2
  216. data/{lib/scarpe → spikes}/glibui.rb +1 -1
  217. data/templates/basic_class_template.erb +13 -14
  218. data/templates/class_template_with_event_bind.erb +4 -4
  219. data/templates/class_template_with_shapes.erb +8 -17
  220. data/templates/example_template.erb +1 -1
  221. data/templates/module_template.erb +4 -4
  222. data/templates/webview_template.erb +3 -5
  223. metadata +236 -145
  224. data/examples/fill.rb +0 -25
  225. data/examples/legacy/not_checked/shoes-contrib/basic/class-book.yaml +0 -387
  226. data/examples/legacy/not_checked/shoes-contrib/elements/image-icon.rb +0 -3
  227. data/examples/legacy/not_checked/shoes-contrib/good/good-clock.rb +0 -51
  228. data/examples/legacy/not_checked/shoes-contrib/good/good-follow.rb +0 -26
  229. data/examples/legacy/not_checked/shoes-contrib/good/good-reminder.rb +0 -174
  230. data/examples/legacy/not_checked/shoes-contrib/good/good-vjot.rb +0 -56
  231. data/examples/legacy/not_checked/shoes-contrib/simple/simple-timer.rb +0 -13
  232. data/examples/legacy/not_checked/shoes-dep-samples/good-clock.rb +0 -51
  233. data/examples/legacy/not_checked/shoes-dep-samples/good-follow.rb +0 -26
  234. data/examples/legacy/not_checked/shoes-dep-samples/good-reminder.rb +0 -174
  235. data/examples/legacy/not_checked/shoes-dep-samples/good-vjot.rb +0 -56
  236. data/examples/legacy/not_checked/shoes-dep-samples/simple-accordion.rb +0 -75
  237. data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-shapes.rb +0 -17
  238. data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-text.rb +0 -13
  239. data/examples/legacy/not_checked/shoes-dep-samples/simple-arc.rb +0 -23
  240. data/examples/legacy/not_checked/shoes-dep-samples/simple-bounce.rb +0 -24
  241. data/examples/legacy/not_checked/shoes-dep-samples/simple-calc.rb +0 -70
  242. data/examples/legacy/not_checked/shoes-dep-samples/simple-chipmunk.rb +0 -26
  243. data/examples/legacy/not_checked/shoes-dep-samples/simple-control-sizes.rb +0 -24
  244. data/examples/legacy/not_checked/shoes-dep-samples/simple-curve.rb +0 -26
  245. data/examples/legacy/not_checked/shoes-dep-samples/simple-dialogs.rb +0 -29
  246. data/examples/legacy/not_checked/shoes-dep-samples/simple-draw.rb +0 -13
  247. data/examples/legacy/not_checked/shoes-dep-samples/simple-editor.rb +0 -28
  248. data/examples/legacy/not_checked/shoes-dep-samples/simple-form.rb +0 -28
  249. data/examples/legacy/not_checked/shoes-dep-samples/simple-form.shy +0 -0
  250. data/examples/legacy/not_checked/shoes-dep-samples/simple-mask.rb +0 -21
  251. data/examples/legacy/not_checked/shoes-dep-samples/simple-menu.rb +0 -31
  252. data/examples/legacy/not_checked/shoes-dep-samples/simple-menu1.rb +0 -35
  253. data/examples/legacy/not_checked/shoes-dep-samples/simple-rubygems.rb +0 -29
  254. data/examples/legacy/not_checked/shoes-dep-samples/simple-slide.rb +0 -45
  255. data/examples/legacy/not_checked/shoes-dep-samples/simple-sphere.rb +0 -28
  256. data/examples/legacy/not_checked/shoes-dep-samples/simple-sqlite3.rb +0 -13
  257. data/examples/legacy/not_checked/shoes-dep-samples/simple-timer.rb +0 -13
  258. data/examples/legacy/not_checked/shoes-dep-samples/simple-video.rb +0 -13
  259. data/examples/legacy/not_checked/simple/anim-text.rb +0 -13
  260. data/examples/legacy/not_checked/simple/arc.rb +0 -23
  261. data/examples/legacy/not_checked/simple/bounce.rb +0 -24
  262. data/examples/legacy/not_checked/simple/chipmunk.rb +0 -26
  263. data/examples/legacy/not_checked/simple/curve.rb +0 -26
  264. data/examples/legacy/not_checked/simple/dialogs.rb +0 -29
  265. data/examples/legacy/not_checked/simple/downloader.rb +0 -40
  266. data/examples/legacy/not_checked/simple/draw.rb +0 -13
  267. data/examples/legacy/not_checked/simple/mask.rb +0 -21
  268. data/examples/legacy/not_checked/simple/slide.rb +0 -45
  269. data/examples/legacy/not_checked/simple/sphere.rb +0 -28
  270. data/lib/constants.rb +0 -5
  271. data/lib/scarpe/alert.rb +0 -19
  272. data/lib/scarpe/app.rb +0 -78
  273. data/lib/scarpe/arc.rb +0 -49
  274. data/lib/scarpe/button.rb +0 -35
  275. data/lib/scarpe/document_root.rb +0 -20
  276. data/lib/scarpe/edit_box.rb +0 -24
  277. data/lib/scarpe/fill.rb +0 -23
  278. data/lib/scarpe/flow.rb +0 -19
  279. data/lib/scarpe/line.rb +0 -25
  280. data/lib/scarpe/link.rb +0 -25
  281. data/lib/scarpe/list_box.rb +0 -25
  282. data/lib/scarpe/logger.rb +0 -155
  283. data/lib/scarpe/para.rb +0 -90
  284. data/lib/scarpe/shape.rb +0 -19
  285. data/lib/scarpe/spacing.rb +0 -9
  286. data/lib/scarpe/stack.rb +0 -70
  287. data/lib/scarpe/star.rb +0 -47
  288. data/lib/scarpe/text_widget.rb +0 -42
  289. data/lib/scarpe/unit_test_helpers.rb +0 -163
  290. data/lib/scarpe/widget.rb +0 -198
  291. data/lib/scarpe/widgets.rb +0 -30
  292. data/lib/scarpe/wv/alert.rb +0 -65
  293. data/lib/scarpe/wv/background.rb +0 -18
  294. data/lib/scarpe/wv/border.rb +0 -22
  295. data/lib/scarpe/wv/control_interface_test.rb +0 -253
  296. data/lib/scarpe/wv/dimensions.rb +0 -22
  297. data/lib/scarpe/wv/fill.rb +0 -30
  298. data/lib/scarpe/wv/html.rb +0 -107
  299. data/lib/scarpe/wv/shape_helper.rb +0 -44
  300. data/lib/scarpe/wv/spacing.rb +0 -41
  301. data/lib/scarpe/wv/text_widget.rb +0 -30
  302. data/lib/scarpe/wv/widget.rb +0 -181
  303. data/scarpe-0.2.0.gem +0 -0
  304. /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/definr.rb +0 -0
  305. /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/funnies.rb +0 -0
  306. /data/examples/legacy/not_checked/shoes-contrib/{elements → basic}/list_box-select-class.rb +0 -0
  307. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/basic-edit-box.rb +0 -0
  308. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/basic-fps.rb +0 -0
  309. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/border-cat.rb +0 -0
  310. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/check-mate.rb +0 -0
  311. /data/examples/legacy/{not_checked/shoes-contrib/manipulation → working/simple}/clear-slot.rb +0 -0
  312. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/clock.rb +0 -0
  313. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/gradient-shoes.rb +0 -0
  314. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/list_box-shape-report.rb +0 -0
  315. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/list_box.rb +0 -0
  316. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/phat-button.rb +0 -0
  317. /data/examples/legacy/{not_checked/shoes-contrib → working}/simple/simple-calc.rb +0 -0
  318. /data/examples/legacy/{not_checked/shoes-contrib/position → working/simple}/stack-width.rb +0 -0
  319. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/width-introspec.rb +0 -0
  320. /data/{lib/scarpe → spikes}/glibui/README.md +0 -0
  321. /data/{lib/scarpe → spikes}/glibui/alert.rb +0 -0
  322. /data/{lib/scarpe → spikes}/glibui/app.rb +0 -0
  323. /data/{lib/scarpe → spikes}/glibui/background.rb +0 -0
  324. /data/{lib/scarpe → spikes}/glibui/border.rb +0 -0
  325. /data/{lib/scarpe → spikes}/glibui/button.rb +0 -0
  326. /data/{lib/scarpe → spikes}/glibui/dimensions.rb +0 -0
  327. /data/{lib/scarpe → spikes}/glibui/document_root.rb +0 -0
  328. /data/{lib/scarpe → spikes}/glibui/edit_box.rb +0 -0
  329. /data/{lib/scarpe → spikes}/glibui/edit_line.rb +0 -0
  330. /data/{lib/scarpe → spikes}/glibui/flow.rb +0 -0
  331. /data/{lib/scarpe → spikes}/glibui/html.rb +0 -0
  332. /data/{lib/scarpe → spikes}/glibui/image.rb +0 -0
  333. /data/{lib/scarpe → spikes}/glibui/link.rb +0 -0
  334. /data/{lib/scarpe → spikes}/glibui/local_display.rb +0 -0
  335. /data/{lib/scarpe → spikes}/glibui/para.rb +0 -0
  336. /data/{lib/scarpe → spikes}/glibui/spacing.rb +0 -0
  337. /data/{lib/scarpe → spikes}/glibui/stack.rb +0 -0
  338. /data/{lib/scarpe → spikes}/glibui/text_widget.rb +0 -0
  339. /data/{lib/scarpe → spikes}/libui/alert.rb +0 -0
  340. /data/{lib/scarpe → spikes}/libui/button.rb +0 -0
  341. /data/{lib/scarpe → spikes}/libui/colors.rb +0 -0
  342. /data/{lib/scarpe → spikes}/libui/core.rb +0 -0
  343. /data/{lib/scarpe → spikes}/libui/flow.rb +0 -0
  344. /data/{lib/scarpe → spikes}/libui/libui.rb +0 -0
  345. /data/{lib/scarpe → spikes}/libui/notepad.md +0 -0
  346. /data/{lib/scarpe → spikes}/libui/para.rb +0 -0
  347. /data/{lib/scarpe → spikes}/libui/stack.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b494d51af2b6c932398ba4bd9e4a4028bfb023d240c993d6ec2abc067867418a
4
- data.tar.gz: aadbaeaaf38a75e493aab9576513efa56fd7deb51decf23caba95124db910e68
3
+ metadata.gz: c83fb76fc149cffa58c679978dc3647689acb5b418d7e65a931bddfb1687b250
4
+ data.tar.gz: 2b73dae2f9f5be78d6b5637d605b089c3031b14aff91acc1eced51f021283f5a
5
5
  SHA512:
6
- metadata.gz: ed68d1232d8b5572b354e302359aeeacf34046eab08cc4dd4c42ff468b270dfb52e791c670cc81e8d7b94176a10d8356855c1c8f4b82a74c3136bd29ea1a7821
7
- data.tar.gz: bf95030dbc45c5e1383ba18dc0918270025d8d5fee8422cd2c523660bf87e8ef1b6935f31624a106977b2ff3bbea5b7542f2b3b042e293478cbdad37f6fce689
6
+ metadata.gz: 6da8066857ec4241252fcca4bbe01a60c369260b618a65f44384666a4ed67311ee3bd065ab68bed79f7084e3f8c5ba7c8db3244c3cbcf9e166d1ad5130ccb43d
7
+ data.tar.gz: b8ba6762940cc53078e1461024f26b762acd302a99cb6fccd965b4c4018ac1452ad85821c78c8ab59b28db572ac899781d1e84bacd77bce602a9edeb0fe84a85
data/.rubocop.yml CHANGED
@@ -8,6 +8,7 @@ AllCops:
8
8
  - 'bin/**/*'
9
9
  - 'exe/**/*'
10
10
  - 'examples/**/*'
11
+ - 'docs/**/*'
11
12
 
12
13
  Layout/LineLength:
13
14
  Max: 150
@@ -82,3 +83,6 @@ Style/ReturnNil:
82
83
 
83
84
  Style/ClassAndModuleChildren:
84
85
  Enabled: false
86
+
87
+ Layout/EmptyLineBetweenDefs:
88
+ Enabled: false
data/.yardopts CHANGED
@@ -1,3 +1,15 @@
1
1
  --markup-provider=redcarpet
2
2
  --markup=markdown
3
+ --protected
4
+ --no-private
5
+ --template-path docs/yard/template
6
+ --tag incompatibility:"Incompatibilities with Shoes"
7
+ --exclude lib/scarpe/libui
8
+ --exclude lib/scarpe/glibui
9
+ lib/**/*.rb
10
+ lacci/lib/**/*.rb
11
+ scarpe-components/lib/**/*.rb
12
+ -
13
+ docs/yard/*.md
14
+ docs/static/manual.md
3
15
 
data/CHANGELOG.md CHANGED
@@ -10,10 +10,24 @@ straightforward as possible.
10
10
 
11
11
  ### Fixed
12
12
 
13
- ## [0.2.0] - 2022-07-02
13
+ ## [0.3.0] - 2023-11-24 - You
14
+
15
+ - Progress bars
16
+ - Various new APIs and many bug fixes
17
+ - Added Tiranti, a Bootstrap-based Calzini HTML renderer replacement
18
+ - Added Calzini, a Drawable-to-HTML renderer
19
+ - Rename of Widget to Drawable
20
+ - Extremely early Shoes-Spec testing support
21
+ - Niente, a "no-op" testing display service
22
+
23
+ ## [0.2.1] - 2023-07-02 - Give
24
+
25
+ - Bugfix release
26
+
27
+ ## [0.2.0] - 2023-07-02 - Gonna
14
28
 
15
29
  - First batch of functionality. Will aggressively track to changelog from here on out.
16
30
 
17
- ## [0.1.0] - 2022-02-09
31
+ ## [0.1.0] - 2023-02-09 - Never
18
32
 
19
33
  - Initial release
data/Gemfile CHANGED
@@ -5,6 +5,9 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in scarpe.gemspec
6
6
  gemspec
7
7
 
8
+ gem "lacci", path: "lacci"
9
+ gem "scarpe-components", path: "scarpe-components"
10
+
8
11
  gem "bloops", "~> 0.5" #path: "../bloopsaphone" #git: "https://github.com/scarpe-team/bloopsaphone"
9
12
  gem "rake", "~> 13.0"
10
13
 
data/Gemfile.lock ADDED
@@ -0,0 +1,116 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ scarpe (0.3.0)
5
+ bloops (~> 0.5)
6
+ fastimage
7
+ lacci
8
+ logging (~> 2.3.1)
9
+ nokogiri
10
+ scarpe-components
11
+ sqlite3
12
+ webview_ruby (~> 0.1.1)
13
+
14
+ PATH
15
+ remote: lacci
16
+ specs:
17
+ lacci (0.3.0)
18
+ scarpe-components
19
+
20
+ PATH
21
+ remote: scarpe-components
22
+ specs:
23
+ scarpe-components (0.3.0)
24
+
25
+ GEM
26
+ remote: https://rubygems.org/
27
+ specs:
28
+ ansi (1.5.0)
29
+ ast (2.4.2)
30
+ bloops (0.5)
31
+ builder (3.2.4)
32
+ debug (1.8.0)
33
+ irb (>= 1.5.0)
34
+ reline (>= 0.3.1)
35
+ fastimage (2.2.7)
36
+ ffi (1.15.5)
37
+ ffi-compiler (1.0.1)
38
+ ffi (>= 1.0.0)
39
+ rake
40
+ io-console (0.6.0)
41
+ irb (1.6.4)
42
+ reline (>= 0.3.0)
43
+ json (2.6.3)
44
+ little-plugger (1.1.4)
45
+ logging (2.3.1)
46
+ little-plugger (~> 1.1)
47
+ multi_json (~> 1.14)
48
+ minitest (5.18.0)
49
+ minitest-reporters (1.6.0)
50
+ ansi
51
+ builder
52
+ minitest (>= 5.0)
53
+ ruby-progressbar
54
+ multi_json (1.15.0)
55
+ nokogiri (1.15.2-x86_64-darwin)
56
+ racc (~> 1.4)
57
+ nokogiri (1.15.2-x86_64-linux)
58
+ racc (~> 1.4)
59
+ parallel (1.22.1)
60
+ parser (3.2.1.0)
61
+ ast (~> 2.4.1)
62
+ racc (1.7.1)
63
+ rainbow (3.1.1)
64
+ rake (13.0.6)
65
+ redcarpet (3.6.0)
66
+ regexp_parser (2.7.0)
67
+ reline (0.3.4)
68
+ io-console (~> 0.5)
69
+ rexml (3.2.5)
70
+ rubocop (1.46.0)
71
+ json (~> 2.3)
72
+ parallel (~> 1.10)
73
+ parser (>= 3.2.0.0)
74
+ rainbow (>= 2.2.2, < 4.0)
75
+ regexp_parser (>= 1.8, < 3.0)
76
+ rexml (>= 3.2.5, < 4.0)
77
+ rubocop-ast (>= 1.26.0, < 2.0)
78
+ ruby-progressbar (~> 1.7)
79
+ unicode-display_width (>= 2.4.0, < 3.0)
80
+ rubocop-ast (1.26.0)
81
+ parser (>= 3.2.1.0)
82
+ rubocop-shopify (2.12.0)
83
+ rubocop (~> 1.44)
84
+ ruby-progressbar (1.11.0)
85
+ sqlite3 (1.6.3-x86_64-darwin)
86
+ sqlite3 (1.6.3-x86_64-linux)
87
+ unicode-display_width (2.4.2)
88
+ webrick (1.7.0)
89
+ webview_ruby (0.1.2)
90
+ ffi
91
+ ffi-compiler
92
+ rake
93
+ yard (0.9.28)
94
+ webrick (~> 1.7.0)
95
+
96
+ PLATFORMS
97
+ x86_64-darwin-19
98
+ x86_64-darwin-22
99
+ x86_64-linux
100
+
101
+ DEPENDENCIES
102
+ bloops (~> 0.5)
103
+ debug
104
+ lacci!
105
+ minitest (~> 5.0)
106
+ minitest-reporters
107
+ rake (~> 13.0)
108
+ redcarpet
109
+ rubocop (~> 1.21)
110
+ rubocop-shopify
111
+ scarpe!
112
+ scarpe-components!
113
+ yard
114
+
115
+ BUNDLED WITH
116
+ 2.4.10
data/README.md CHANGED
@@ -9,11 +9,11 @@
9
9
 
10
10
  "Scarpe" means shoes in Italian. "Scarpe" also means [Shoes](https://github.com/shoes/shoes-deprecated) in modern Ruby and webview!
11
11
 
12
- Scarpe isn't feature complete with any version of Shoes (yet?). We're initially targeting Shoes Classic.
12
+ Scarpe isn't feature complete with any version of Shoes (yet?). We're initially targeting [Shoes 3](https://github.com/scarpe-team/scarpe/wiki/ShoesImplementations.md), also called "Red Shoes."
13
13
 
14
14
  ## Wait, What's A Shoes?
15
15
 
16
- Shoes is an old library (really several different ones) that let you build little local desktop computer programs, package them up and give copies to people. Imagine if you can write a tiny little Ruby program (e.g. sneak a peek at the next section) and then it would make a runnable app, opening a window in Ruby, where you could click buttons and play sounds and stuff.
16
+ Shoes is an old library (really [several different ones](https://github.com/scarpe-team/scarpe/wiki/ShoesImplementations.md)) that let you build little local desktop computer programs, package them up and give copies to people. Imagine if you can write a tiny little Ruby program (e.g. sneak a peek at the next section) and then it would make a runnable app, opening a window in Ruby, where you could click buttons and play sounds and stuff.
17
17
 
18
18
  Scarpe is a rewrite of Shoes, because old Shoes doesn't really work any more. There have been a surprising number of rewrites of Shoes over the years -- people love it and miss having it around. This one is ours. Also it uses Webview.
19
19
 
@@ -29,47 +29,75 @@ Shoes.app do
29
29
  end
30
30
  ```
31
31
 
32
- More examples can be found in the `examples` folder!
32
+ <img width="480" alt="hello_world" src="https://user-images.githubusercontent.com/9624267/158565981-57240f72-fbaf-4b72-b66e-8c0d517a90d7.png">
33
33
 
34
- ## Screenshots
34
+ A bit more...
35
35
 
36
- From the hello world example:
36
+ ```ruby
37
+ Shoes.app do
38
+ @push = button "Push me"
39
+ @note = para "Nothing pushed so far"
40
+ @push.click {
41
+ @note.replace(
42
+ "Aha! Click! ",
43
+ link("Go back") { @note.replace "Nothing pushed so far" }
44
+ )
45
+ }
46
+ end
47
+ ```
37
48
 
38
- <img width="480" alt="hello_world" src="https://user-images.githubusercontent.com/9624267/158565981-57240f72-fbaf-4b72-b66e-8c0d517a90d7.png">
49
+ <img width="480" alt="hello_world" src="https://user-images.githubusercontent.com/9624267/158566011-0372d0c7-fbeb-4ed6-a082-73908f04a0b6.gif">
39
50
 
40
- From the button example:
51
+ More examples can be found in the [`examples` folder](https://github.com/scarpe-team/scarpe/tree/main/examples)!
52
+
53
+ ## Wiki
54
+
55
+ Explore more in the [Scarpe Wiki](https://github.com/scarpe-team/scarpe/wiki) for in-depth documentation, tutorials, and additional resources. Whether you're a new contributor or an experienced user, the Wiki provides valuable information to enhance your Scarpe experience.
41
56
 
42
- <img width="480" alt="hello_world" src="https://user-images.githubusercontent.com/9624267/158566011-0372d0c7-fbeb-4ed6-a082-73908f04a0b6.gif">
43
57
 
44
58
  ## Scarpe in Development
45
59
 
46
60
  ### Quickstart
47
61
 
48
- Scarpe requires [Ruby 3.2](https://www.ruby-lang.org/en/downloads/) or higher! use `rvm` or `rbenv` for version control
62
+ Scarpe requires [Ruby 3.2](https://www.ruby-lang.org/en/downloads/) or higher! You can use `rvm`, `rbenv` or your favourite version control just like normal.
49
63
 
50
- This is where most of the action is happening right now, and to have the full Scarpe experience _today_ this is probably what you want to do.
64
+ This repo is where most of the action is happening right now, and to have the full Scarpe experience _today_ this is probably what you want to do.
51
65
 
52
66
  ```
67
+ # dependencies - Mac version
68
+ brew install portaudio pkg-config # for sound!
69
+ # dependencies - Mac M1 version
70
+ brew install portaudio && bundle config build.bloops --with-portaudio-dir=$(brew --prefix portaudio)
71
+ # dependencies - Ubuntu Linux version
72
+ sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev portaudio19-dev
73
+
74
+ for any other linux or windows. please see the webview docs for your [platform](https://github.com/webview/webview#prerequisites)
75
+
53
76
  # get it
54
77
  git clone http://github.com/scarpe-team/scarpe
55
78
  cd scarpe; bundle install
79
+
56
80
  # run it
57
81
  ./exe/scarpe examples/button.rb --dev
58
82
  ```
59
83
 
84
+ If you are using Visual Studio Code, you can use this [extension](https://github.com/gintama91/Scarpe-Vscode-Extension). This extension simplifies the process of executing commands by eliminating the need to repeatedly type lengthy file paths, resulting in a more efficient and productive development experience.
85
+
60
86
  ### Finer details
61
87
 
62
88
  First, clone the [main GitHub repository](https://github.com/scarpe-team/scarpe).
63
89
 
64
90
  `bundle install` dependencies like webview from the cloned directory in your Ruby of choice.
65
91
 
66
- You can run without Scarpe being installed by including its directory. For instance, from the "examples" directory you can run `ruby -I../lib hello_world.rb`. You can also install Scarpe locally (`gem build scarpe.gemspec && gem install scarpe-0.1.0.gem`) or using a Gemfile with the "path" option for local Scarpe.
92
+ You can run without Scarpe being installed by including its directory. For instance, from the "examples" directory you can run `ruby -I../lib -I../lacci/lib -rscarpe hello_world.rb`. You can also install Scarpe locally (`gem build scarpe.gemspec && gem install scarpe-0.1.0.gem`) or using a Gemfile with the "path" option for local Scarpe.
67
93
 
68
- Most commonly we are all using this command: `./exe/scarpe examples/button.rb --dev`
94
+ Most commonly we are all using this command: `./exe/scarpe examples/button.rb --dev --debug`
69
95
 
70
96
  The `--dev` flag points to your local scarpe rather than an installed Scarpe gem.
71
97
 
72
- It's very early in the development process. If you'd like to help develop Scarpe, great! It would be useful to drop us a message/issue/PR on GitHub early on, so we know you're working in a particular area, and we can warn you if anybody else is currently doing so.
98
+ The `--debug` flag will dump a ton of useful information to the console if you want to see what's happening with your app.
99
+
100
+ It's very early in the development process. If you'd like to help develop Scarpe, great! It would be useful to drop us a message/issue/PR on GitHub early on, so we know you're working in a particular area, and we can warn you if anybody else is currently doing so. We also have a Discord.
73
101
 
74
102
  We'd love the help!
75
103
 
@@ -79,22 +107,13 @@ By leveraging the `ruby scarpegen.rb` command and the provided resources, you ca
79
107
 
80
108
  ## Are we done yet?
81
109
 
82
- Huh. Great question. Right now we have a few key things we want to achieve. The first is passing all of the examples we can get our hands on. The second is passing HacketyHack. We're manually keeping tabs on that here.
83
-
84
- 🚨 **This is manually checked and not an automation.** 🚨
110
+ Great question! Right now we have a few key things we want to achieve. The first is passing all of the examples we can get our hands on. The second is passing [Hackety-Hack](https://github.com/hacketyhack/hacketyhack). We're manually keeping tabs on that here.
85
111
 
86
112
  ### Webview Display Service Examples Passing
87
113
 
88
- ![](https://geps.dev/progress/16?dangerColor=800000&warningColor=ff9900&successColor=006600)
89
-
90
- __41/288__
91
-
92
- ### GlimmerLibUI Display Service Examples Passing
93
-
94
- ![](https://geps.dev/progress/2?dangerColor=800000&warningColor=ff9900&successColor=006600)
95
-
96
- __4/288__
114
+ ![](https://geps.dev/progress/30?dangerColor=800000&warningColor=ff9900&successColor=006600)
97
115
 
116
+ __92/304__
98
117
  ## Teach me more about Shoes, the DSL, what it is and why it is amazing
99
118
 
100
119
  1. [Nobody Knows Shoes - _why's Manual](https://github.com/whymirror/why-archive/raw/master/shoes/nobody-knows-shoes.pdf)
@@ -105,16 +124,16 @@ __4/288__
105
124
 
106
125
  Scarpe allows you to modify the app's behaviour outside of the normal Shoes API with environment variables.
107
126
 
108
- For example, we are working with multiple display services like Webview, Glimmer, and possibly some others.
109
-
110
- The SCARPE_DISPLAY_SERVICE environment variable allows you to choose one or more display services, from the default Webview service to potentially other experimental or incomplete services. This may be important if you're developing a new display method for Scarpe. The display service variable will contain a name like "wv_local" or "wv_remote" or "glibui" which corresponds to a require-able Ruby file under lib/scarpe, either in the Scarpe gem or another gem your app requires.
127
+ The SCARPE_DISPLAY_SERVICE environment variable allows you to choose one or more display services, from the default Webview service, to [Scarpe-Wasm](https://github.com/scarpe-team/scarpe-wasm) to potentially other experimental or incomplete services. This may be important if you're developing a new display method for Scarpe. The display service variable will contain a name like "wv_local" or "wv_remote" or "wasm_local" which correspond to a require-able Ruby file under lib/scarpe, either in the Scarpe gem or another gem your app requires.
111
128
 
112
129
  Example usage:
113
130
 
114
- `SCARPE_DISPLAY_SERVICE=glibui ./exe/scarpe examples/hello_world.rb`
131
+ `SCARPE_DISPLAY_SERVICE=wv_relay ./exe/scarpe examples/hello_world.rb`
115
132
 
116
133
  The SCARPE_TEST_CONTROL environment variable can contain a path to a test-control-interface script for the Webview display service. If you look at test_helper, it gives some examples of how to use it.
117
134
 
135
+ If you run ./exe/scarpe --dev env, you can see all current environment settings.
136
+
118
137
  ## More info
119
138
 
120
139
  * [Nobody Knows Shoes manual](https://github.com/whymirror/why-archive/raw/master/shoes/nobody-knows-shoes.pdf)
@@ -144,12 +163,16 @@ You can set SCARPE_LOG_CONFIG to an appropriate YAML file to set log levels per-
144
163
  ```
145
164
  {
146
165
  "default": "warn",
147
- "WV::WebWrangler": ["logger/web_wrangler.log", "debug"]
166
+ "Webview::WebWrangler": ["logger/web_wrangler.log", "debug"]
148
167
  }
149
168
  ```
150
169
 
151
170
  ## Documentation
152
171
 
172
+ Usually it's easiest to [just view the latest on GitHub](https://scarpe-team.github.io/scarpe/).
173
+
174
+ But you can also built it yourself, locally, for testing or to take on the road.
175
+
153
176
  Scarpe uses [YARD](https://yardoc.org/) for basic API documentation. You can run "yard doc" to generate documentation
154
177
  locally, and then view it with "yard server". Point your browser at "http://localhost:8808" for local viewing.
155
178
 
data/Rakefile CHANGED
@@ -10,6 +10,18 @@ Rake::TestTask.new(:test) do |t|
10
10
  t.test_files = FileList["test/**/test_*.rb"]
11
11
  end
12
12
 
13
+ Rake::TestTask.new(:lacci_test) do |t|
14
+ t.libs << "lacci/test"
15
+ t.libs << "lacci/lib"
16
+ t.test_files = FileList["lacci/test/**/test_*.rb"]
17
+ end
18
+
19
+ Rake::TestTask.new(:component_test) do |t|
20
+ t.libs << "scarpe-components/test"
21
+ t.libs << "scarpe-components/lib"
22
+ t.test_files = FileList["scarpe-components/test/**/test_*.rb"]
23
+ end
24
+
13
25
  RuboCop::RakeTask.new
14
26
 
15
- task default: [:test, :rubocop]
27
+ task default: [:test, :lacci_test, :component_test]
@@ -0,0 +1,44 @@
1
+ # CatsCradle and Fiber-Based Testing
2
+
3
+ We've tried a number of things for testing. We mock extensively in many places. We use promises to handle "assert thing X after the next redraw"-type testing.
4
+
5
+ Most recently, we have a Fiber-based approach to testing which is a little weird, but (so far) looks pretty good. Here's a representative test of that kind:
6
+
7
+ ```
8
+ def test_html_dom_multiple_update
9
+ run_test_scarpe_code(<<-'SCARPE_APP', app_test_code: <<-'TEST_CODE')
10
+ Shoes.app do
11
+ para "Hello World"
12
+ end
13
+ SCARPE_APP
14
+ on_heartbeat do
15
+ p = para()
16
+ assert_include dom_html, "Hello World"
17
+ p.replace("Goodbye World")
18
+ wait fully_updated
19
+ assert_include dom_html, "Goodbye World"
20
+ p.replace("Hello Again")
21
+ wait fully_updated
22
+ assert_include dom_html, "Hello Again"
23
+
24
+ test_finished
25
+ end
26
+ TEST_CODE
27
+ end
28
+ ```
29
+
30
+ That's fine. There's a very simple Scarpe app with a single para. The test finds it, then makes sure the page HTML includes the right text. Then it changes it, waits for the redraw and makes sure it contains the new right text. Then, basically, does those same things again. So what's interesting here?
31
+
32
+ Primarily that it waits. You could reasonably think, "waiting is easy - you can use promises or sleeps for that." And normally you'd be right. But in this case, this uses the Webview local display service. It will crash if you don't return control to its main loop within a fraction of a second. And until it gets back to its main loop it can't receive calls from Javascript. Those "dom_html" calls require looping to Webview and back, as (of course) does "wait fully_updated".
33
+
34
+ But this method appears to run through, line by line, until it's done. How?
35
+
36
+ Fibers. Specifically, Ruby 3.0 added some nice Fiber capabilities that we can use. You can go look [at the docs](https://ruby-doc.org/core-3.0.0/Fiber.html#method-i-transfer) if you want.
37
+
38
+ If you check catscradle.rb, you can see us doing a fun little dance where a block like the on_heartbeat above creates a Fiber, and there's a manager Fiber to coordinate them. On every heartbeat and redraw we run the manager Fiber, which in turn runs every other Fiber that's ready, which it tracks via Promises.
39
+
40
+ A ready Fiber will run until it does something blocking, like a dom_html or wait call. Then it returns a Promise object that will be fulfilled when it's ready to run again, like a Promise for being fully redrawn, or a promise for when a snippet of Javascript finishes.
41
+
42
+ Once the manager has run every ready Fiber once, it yields control and waits to be called again.
43
+
44
+ Right now (June 2023) we keep control simple by only being called on heartbeats or redraws, so sometimes a promise *not* involving promises or redraws can wait awhile extra (up to 1/10th of a second or so) before it runs again. It would be possible to run the manager in response to other promises completing, and that would probably be more efficient. I'm just worried about that complicating the flow of control and leading to weird order-dependent bugs. So right now we do the simple thing, which can be slower.
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ def generate_docpages_list
4
+ @file_list = true
5
+
6
+ # Customise these more?
7
+ @items = options.files.select { |m| m.filename.end_with?(".md") }
8
+
9
+ @list_title = "Doc Pages List"
10
+ @list_type = "file"
11
+ generate_list_contents
12
+ @file_list = nil
13
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ def menu_lists
3
+ [
4
+ {:type => 'docpages', :title => 'Doc Pages', :search_title => 'Doc Pages'},
5
+ {:type => 'class', :title => 'Classes', :search_title => 'Class List'},
6
+ {:type => 'method', :title => 'Methods', :search_title => 'Method List'},
7
+ {:type => 'file', :title => 'Files', :search_title => 'File List'},
8
+ ]
9
+ end
@@ -0,0 +1,20 @@
1
+ Shoes.app do
2
+ stack do
3
+ para "10 fps"
4
+ p = para "-"
5
+ animate do |frame|
6
+ p.replace(frame.to_s)
7
+ end
8
+ para "20 fps"
9
+ p2 = para "-"
10
+ animate(20) do |frame|
11
+ p2.replace(frame.to_s)
12
+ end
13
+ para "3spf"
14
+ p3 = para "-"
15
+ every(3) do |count|
16
+ p3.replace(count.to_s)
17
+ end
18
+ end
19
+ end
20
+
data/examples/arrow.rb ADDED
@@ -0,0 +1,10 @@
1
+ Shoes.app do
2
+ arrow 100, 100, 30
3
+
4
+ arrow 150, 120,40
5
+
6
+ arrow 30 ,60 ,40
7
+
8
+ arrow :left => 50, :top => 80,
9
+ :width => 40
10
+ end
@@ -0,0 +1,16 @@
1
+ Shoes.app do
2
+
3
+ stack width:100, height:100 do
4
+ background "docs/static/avatar.png"
5
+ border blue ,strokewidth: 4
6
+ end
7
+
8
+ stack width:100, height:100 do
9
+ background red
10
+ end
11
+
12
+ stack width:100, height:100 do
13
+ background "rgba(255,200,0,255)"
14
+ end
15
+
16
+ end
@@ -0,0 +1,66 @@
1
+ # Bronx Army Knife
2
+
3
+ # By analogy with "Bronx Cheer."
4
+
5
+ class SystemConfiguration
6
+ def self.checked_run(cmd, msg: "returned an error")
7
+ system(cmd)
8
+ unless $?.success?
9
+ puts "Command failed: #{cmd.inspect} in #{Dir.pwd}; #{$?.inspect}..."
10
+ raise msg
11
+ end
12
+ end
13
+
14
+ def self.basic_install_check
15
+ unless `uname -a`.include?("Darwin")
16
+ raise "Feel free to adjust this app, but right now it's very Mac-specific!"
17
+ end
18
+
19
+ unless system("which ffmpeg")
20
+ raise "Please install FFMPEG! On Mac this might be 'brew install ffmpeg'"
21
+ end
22
+
23
+ unless system("which basic-pitch")
24
+ puts <<~USAGE_TEXT
25
+ You'll need to install basic-pitch. It can be a bit involved.
26
+ Basic-Pitch requires Python 3.7+, or 3.10+ for Mac M1s.
27
+
28
+ See:
29
+ https://github.com/spotify/basic-pitch
30
+ https://basicpitch.spotify.com/
31
+ USAGE_TEXT
32
+ raise "Please install basic-pitch! On Mac this might be 'pip3 install basic_pitch'"
33
+ end
34
+ end
35
+
36
+ def self.mic_device_string
37
+ audio_devices_text = `ffmpeg -f avfoundation -list_devices true -i "" 2>&1`
38
+
39
+ if audio_devices_text.include?("] MacBook Pro Microphone")
40
+ dev_num = audio_devices_text.split("] MacBook Pro Microphone")[0][-1]
41
+ unless ("0".."5").include?(dev_num)
42
+ raise "Couldn't recognise your audio device as a small number in text:\n#{audio_devices_text}\n\n!!!"
43
+ end
44
+ return ":" + dev_num
45
+ end
46
+
47
+ raise "Time to improve the checking to recognise the Mac microphone!"
48
+ end
49
+
50
+ def self.record_audio_to_file(path, seconds: 1)
51
+ @mic_dev ||= mic_device_string
52
+ checked_run("ffmpeg -f avfoundation -i \"#{@mic_dev}\" -t #{seconds}s #{path}")
53
+ end
54
+ end
55
+
56
+ SystemConfiguration.basic_install_check
57
+
58
+ Shoes.app do
59
+ @status_text = para "Right now: nothing recorded"
60
+
61
+ @b = button "record" do
62
+ @status_text.replace("...")
63
+ SystemConfiguration.record_audio_to_file("~/Desktop/test_audio.wav")
64
+ @status_text.replace("Recorded: ~/Desktop/test_audio.wav")
65
+ end
66
+ end
@@ -0,0 +1,21 @@
1
+ Shoes.app height: 200, width: 200, title: "Morning Serenity" do
2
+ @sleepy_person = para "😴"
3
+
4
+ button "Good Morning!" do
5
+ @sleepy_person.replace "😀"
6
+ b = Bloops.new
7
+ b.tempo = 70
8
+
9
+ s1 = b.sound Bloops::SINE
10
+ s1.attack = 0.5
11
+ s1.sustain = 0.3
12
+ s1.decay = 0.4
13
+
14
+ pattern1 = "4:e5 4:d5 4:c5 4:d5 2:e5 4:e5 4:d5 4:c5 4:d5 2:e5 4:d5 4:c5 4:b4 4:c5 2:d5"
15
+
16
+ b.tune s1, pattern1
17
+
18
+ b.play
19
+ end
20
+
21
+ end
@@ -1,14 +1,16 @@
1
1
 
2
2
  b = Bloops.new
3
3
  b.tempo = 180
4
-
5
-
4
+
5
+
6
6
  sound = b.sound Bloops::SQUARE
7
7
  sound.volume = 0.4
8
8
  sound.sustain = 0.3
9
9
  sound.attack = 0.1
10
10
  sound.decay = 0.3
11
-
11
+
12
12
  b.tune sound, "32 + C E F# 8:A G E C - 8:A 8:F# 8:F# 8:F# 2:G"
13
-
14
13
  b.play
14
+
15
+ # Added, or it justs falls off the end
16
+ sleep 0.5 while not b.stopped?
@@ -0,0 +1,7 @@
1
+ Shoes.app do
2
+ @btn = button "who am i?", :tooltip => "i have no idea either"
3
+ @para = para "i am a button"
4
+ @btn.hover do
5
+ @para.replace "i am a button and i am being hovered"
6
+ end
7
+ end
@@ -1,4 +1,4 @@
1
- Shoes.app(debug: true) do
1
+ Shoes.app do
2
2
  @b = button "Go away, button"
3
3
  @b.click {
4
4
  @b.destroy
@@ -0,0 +1,7 @@
1
+ Shoes.app do
2
+ @p = para "This text will start red\n", stroke: :red
3
+ button "OK" do
4
+ @p.replace("... but turn green when you click it.")
5
+ @p.stroke = :green
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ Shoes.app do
2
+ style Shoes::Para, stroke: :red
3
+ para "This text should be red\n"
4
+ para "But this text should be green\n", stroke: :green
5
+ button "OK"
6
+ end