scarpe 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.yardopts +11 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.lock +112 -0
  6. data/README.md +31 -24
  7. data/Rakefile +13 -1
  8. data/docs/yard/catscradle.md +44 -0
  9. data/docs/yard/template/default/fulldoc/html/setup.rb +13 -0
  10. data/docs/yard/template/default/layout/html/setup.rb +9 -0
  11. data/examples/background_with_image.rb +16 -0
  12. data/examples/bloopsaphone/working/bronx_army_knife.rb +66 -0
  13. data/examples/bloopsaphone/working/morning_serenity.rb +21 -0
  14. data/examples/bloopsaphone/working/simpsons_theme_song_by_why.rb +6 -4
  15. data/examples/button_go_away.rb +1 -1
  16. data/examples/check.rb +18 -0
  17. data/examples/clear_and_append.rb +24 -0
  18. data/examples/download_and_show_image.rb +28 -0
  19. data/examples/edit_box.rb +3 -5
  20. data/examples/fonts.rb +2 -2
  21. data/examples/get_headers.rb +10 -0
  22. data/examples/highlander.rb +2 -0
  23. data/examples/link.rb +2 -2
  24. data/examples/local_fonts.rb +4 -0
  25. data/examples/local_images.rb +4 -0
  26. data/examples/motion_events.rb +20 -0
  27. data/examples/parse_xl_funnies.rb +58 -0
  28. data/examples/radio/radio.rb +16 -0
  29. data/examples/radio/radio_groups.rb +18 -0
  30. data/examples/radio/radio_same_slot.rb +6 -0
  31. data/examples/ruby_racer.rb +13 -15
  32. data/examples/selfitude.rb +18 -0
  33. data/examples/shapes/shapes_fill.rb +4 -3
  34. data/examples/shoes_school.rb +2 -4
  35. data/examples/show_hide.rb +6 -0
  36. data/examples/skip_ci/change_my_audio_source.rb +21 -0
  37. data/examples/skip_ci/guitar_fretboard.rb +137 -0
  38. data/examples/video.rb +10 -0
  39. data/exe/scarpe +42 -66
  40. data/fonts/Pacifico.ttf +0 -0
  41. data/lacci/Gemfile +22 -0
  42. data/lacci/Gemfile.lock +72 -0
  43. data/lacci/Rakefile +12 -0
  44. data/lacci/lacci.gemspec +37 -0
  45. data/lacci/lib/lacci/scarpe_cli.rb +70 -0
  46. data/lacci/lib/lacci/scarpe_core.rb +21 -0
  47. data/lacci/lib/lacci/version.rb +13 -0
  48. data/lacci/lib/shoes/app.rb +264 -0
  49. data/{lib/scarpe → lacci/lib/shoes}/background.rb +1 -1
  50. data/{lib/scarpe → lacci/lib/shoes}/border.rb +1 -1
  51. data/{lib/scarpe → lacci/lib/shoes}/colors.rb +1 -1
  52. data/lacci/lib/shoes/constants.rb +29 -0
  53. data/{lib/scarpe → lacci/lib/shoes}/display_service.rb +40 -45
  54. data/lacci/lib/shoes/download.rb +123 -0
  55. data/lacci/lib/shoes/log.rb +71 -0
  56. data/lacci/lib/shoes/spacing.rb +9 -0
  57. data/{lib/scarpe → lacci/lib/shoes}/widget.rb +63 -43
  58. data/{lib/scarpe → lacci/lib/shoes/widgets}/alert.rb +3 -3
  59. data/{lib/scarpe → lacci/lib/shoes/widgets}/arc.rb +7 -5
  60. data/{lib/scarpe → lacci/lib/shoes/widgets}/button.rb +3 -3
  61. data/lacci/lib/shoes/widgets/check.rb +28 -0
  62. data/lacci/lib/shoes/widgets/document_root.rb +20 -0
  63. data/{lib/scarpe → lacci/lib/shoes/widgets}/edit_box.rb +10 -5
  64. data/{lib/scarpe → lacci/lib/shoes/widgets}/edit_line.rb +2 -2
  65. data/lacci/lib/shoes/widgets/flow.rb +22 -0
  66. data/lacci/lib/shoes/widgets/font.rb +14 -0
  67. data/{lib/scarpe → lacci/lib/shoes/widgets}/image.rb +3 -7
  68. data/lacci/lib/shoes/widgets/line.rb +18 -0
  69. data/{lib/scarpe → lacci/lib/shoes/widgets}/link.rb +2 -2
  70. data/{lib/scarpe → lacci/lib/shoes/widgets}/list_box.rb +2 -2
  71. data/{lib/scarpe → lacci/lib/shoes/widgets}/para.rb +4 -26
  72. data/lacci/lib/shoes/widgets/radio.rb +35 -0
  73. data/lacci/lib/shoes/widgets/shape.rb +37 -0
  74. data/lacci/lib/shoes/widgets/slot.rb +75 -0
  75. data/{lib/scarpe → lacci/lib/shoes/widgets}/span.rb +2 -2
  76. data/lacci/lib/shoes/widgets/stack.rb +24 -0
  77. data/{lib/scarpe → lacci/lib/shoes/widgets}/star.rb +6 -9
  78. data/lacci/lib/shoes/widgets/subscription_item.rb +60 -0
  79. data/lacci/lib/shoes/widgets/text_widget.rb +51 -0
  80. data/lacci/lib/shoes/widgets/video.rb +15 -0
  81. data/lacci/lib/shoes/widgets.rb +29 -0
  82. data/lacci/lib/shoes.rb +127 -0
  83. data/lacci/test/test_colors.rb +39 -0
  84. data/lacci/test/test_helper.rb +9 -0
  85. data/lacci/test/test_lacci.rb +9 -0
  86. data/lib/scarpe/cats_cradle.rb +249 -0
  87. data/lib/scarpe/evented_assertions.rb +88 -0
  88. data/lib/scarpe/version.rb +1 -1
  89. data/lib/scarpe/wv/alert.rb +3 -2
  90. data/lib/scarpe/wv/app.rb +30 -8
  91. data/lib/scarpe/wv/arc.rb +5 -6
  92. data/lib/scarpe/wv/background.rb +10 -1
  93. data/lib/scarpe/wv/border.rb +5 -3
  94. data/lib/scarpe/wv/button.rb +11 -9
  95. data/lib/scarpe/wv/check.rb +29 -0
  96. data/lib/scarpe/wv/control_interface.rb +14 -20
  97. data/lib/scarpe/wv/control_interface_test.rb +13 -28
  98. data/lib/scarpe/wv/document_root.rb +3 -45
  99. data/lib/scarpe/wv/edit_box.rb +5 -7
  100. data/lib/scarpe/wv/edit_line.rb +2 -2
  101. data/lib/scarpe/wv/flow.rb +10 -20
  102. data/lib/scarpe/wv/font.rb +36 -0
  103. data/lib/scarpe/wv/html.rb +3 -2
  104. data/lib/scarpe/wv/image.rb +7 -2
  105. data/lib/scarpe/wv/line.rb +4 -7
  106. data/lib/scarpe/wv/link.rb +1 -0
  107. data/lib/scarpe/wv/list_box.rb +3 -3
  108. data/lib/scarpe/wv/para.rb +16 -14
  109. data/lib/scarpe/wv/radio.rb +34 -0
  110. data/lib/scarpe/wv/shape.rb +44 -8
  111. data/lib/scarpe/wv/slot.rb +81 -0
  112. data/lib/scarpe/wv/spacing.rb +1 -1
  113. data/lib/scarpe/wv/span.rb +10 -8
  114. data/lib/scarpe/wv/stack.rb +10 -30
  115. data/lib/scarpe/wv/star.rb +11 -12
  116. data/lib/scarpe/wv/subscription_item.rb +50 -0
  117. data/lib/scarpe/wv/video.rb +34 -0
  118. data/lib/scarpe/wv/web_wrangler.rb +238 -58
  119. data/lib/scarpe/wv/webview_local_display.rb +27 -5
  120. data/lib/scarpe/wv/webview_relay_display.rb +18 -119
  121. data/lib/scarpe/wv/webview_relay_util.rb +143 -0
  122. data/lib/scarpe/wv/widget.rb +80 -11
  123. data/lib/scarpe/wv/wv_display_worker.rb +17 -4
  124. data/lib/scarpe/wv.rb +33 -4
  125. data/lib/scarpe/wv_local.rb +1 -1
  126. data/lib/scarpe/wv_relay.rb +1 -1
  127. data/lib/scarpe.rb +3 -32
  128. data/scarpe-components/.gitignore +1 -0
  129. data/scarpe-components/Gemfile +22 -0
  130. data/scarpe-components/README.md +35 -0
  131. data/scarpe-components/Rakefile +12 -0
  132. data/scarpe-components/lib/scarpe/components/base64.rb +29 -0
  133. data/scarpe-components/lib/scarpe/components/file_helpers.rb +65 -0
  134. data/scarpe-components/lib/scarpe/components/modular_logger.rb +113 -0
  135. data/scarpe-components/lib/scarpe/components/print_logger.rb +43 -0
  136. data/{lib/scarpe → scarpe-components/lib/scarpe/components}/promises.rb +102 -35
  137. data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +170 -0
  138. data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +217 -0
  139. data/scarpe-components/lib/scarpe/components/version.rb +7 -0
  140. data/scarpe-components/scarpe-components.gemspec +38 -0
  141. data/scarpe-components/test/test_components.rb +9 -0
  142. data/scarpe-components/test/test_helper.rb +23 -0
  143. data/scarpe-components/test/test_promises.rb +260 -0
  144. data/scarpe-components/test/test_segmented_app_files.rb +182 -0
  145. data/{lib/scarpe → spikes}/glibui/widget.rb +2 -2
  146. data/{lib/scarpe → spikes}/glibui.rb +1 -1
  147. data/templates/basic_class_template.erb +1 -1
  148. data/templates/class_template_with_event_bind.erb +1 -1
  149. data/templates/class_template_with_shapes.erb +1 -1
  150. data/templates/webview_template.erb +0 -3
  151. metadata +151 -118
  152. data/examples/fill.rb +0 -25
  153. data/examples/legacy/not_checked/shoes-contrib/basic/class-book.yaml +0 -387
  154. data/examples/legacy/not_checked/shoes-contrib/good/good-clock.rb +0 -51
  155. data/examples/legacy/not_checked/shoes-contrib/good/good-follow.rb +0 -26
  156. data/examples/legacy/not_checked/shoes-contrib/good/good-reminder.rb +0 -174
  157. data/examples/legacy/not_checked/shoes-contrib/good/good-vjot.rb +0 -56
  158. data/examples/legacy/not_checked/shoes-contrib/simple/simple-timer.rb +0 -13
  159. data/examples/legacy/not_checked/shoes-dep-samples/good-clock.rb +0 -51
  160. data/examples/legacy/not_checked/shoes-dep-samples/good-follow.rb +0 -26
  161. data/examples/legacy/not_checked/shoes-dep-samples/good-reminder.rb +0 -174
  162. data/examples/legacy/not_checked/shoes-dep-samples/good-vjot.rb +0 -56
  163. data/examples/legacy/not_checked/shoes-dep-samples/simple-accordion.rb +0 -75
  164. data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-shapes.rb +0 -17
  165. data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-text.rb +0 -13
  166. data/examples/legacy/not_checked/shoes-dep-samples/simple-arc.rb +0 -23
  167. data/examples/legacy/not_checked/shoes-dep-samples/simple-bounce.rb +0 -24
  168. data/examples/legacy/not_checked/shoes-dep-samples/simple-calc.rb +0 -70
  169. data/examples/legacy/not_checked/shoes-dep-samples/simple-chipmunk.rb +0 -26
  170. data/examples/legacy/not_checked/shoes-dep-samples/simple-control-sizes.rb +0 -24
  171. data/examples/legacy/not_checked/shoes-dep-samples/simple-curve.rb +0 -26
  172. data/examples/legacy/not_checked/shoes-dep-samples/simple-dialogs.rb +0 -29
  173. data/examples/legacy/not_checked/shoes-dep-samples/simple-draw.rb +0 -13
  174. data/examples/legacy/not_checked/shoes-dep-samples/simple-editor.rb +0 -28
  175. data/examples/legacy/not_checked/shoes-dep-samples/simple-form.rb +0 -28
  176. data/examples/legacy/not_checked/shoes-dep-samples/simple-form.shy +0 -0
  177. data/examples/legacy/not_checked/shoes-dep-samples/simple-mask.rb +0 -21
  178. data/examples/legacy/not_checked/shoes-dep-samples/simple-menu.rb +0 -31
  179. data/examples/legacy/not_checked/shoes-dep-samples/simple-menu1.rb +0 -35
  180. data/examples/legacy/not_checked/shoes-dep-samples/simple-rubygems.rb +0 -29
  181. data/examples/legacy/not_checked/shoes-dep-samples/simple-slide.rb +0 -45
  182. data/examples/legacy/not_checked/shoes-dep-samples/simple-sphere.rb +0 -28
  183. data/examples/legacy/not_checked/shoes-dep-samples/simple-sqlite3.rb +0 -13
  184. data/examples/legacy/not_checked/shoes-dep-samples/simple-timer.rb +0 -13
  185. data/examples/legacy/not_checked/shoes-dep-samples/simple-video.rb +0 -13
  186. data/examples/legacy/not_checked/simple/anim-text.rb +0 -13
  187. data/examples/legacy/not_checked/simple/arc.rb +0 -23
  188. data/examples/legacy/not_checked/simple/bounce.rb +0 -24
  189. data/examples/legacy/not_checked/simple/chipmunk.rb +0 -26
  190. data/examples/legacy/not_checked/simple/curve.rb +0 -26
  191. data/examples/legacy/not_checked/simple/dialogs.rb +0 -29
  192. data/examples/legacy/not_checked/simple/downloader.rb +0 -40
  193. data/examples/legacy/not_checked/simple/draw.rb +0 -13
  194. data/examples/legacy/not_checked/simple/mask.rb +0 -21
  195. data/examples/legacy/not_checked/simple/slide.rb +0 -45
  196. data/examples/legacy/not_checked/simple/sphere.rb +0 -28
  197. data/lib/constants.rb +0 -5
  198. data/lib/scarpe/app.rb +0 -78
  199. data/lib/scarpe/document_root.rb +0 -20
  200. data/lib/scarpe/fill.rb +0 -23
  201. data/lib/scarpe/flow.rb +0 -19
  202. data/lib/scarpe/line.rb +0 -25
  203. data/lib/scarpe/logger.rb +0 -155
  204. data/lib/scarpe/shape.rb +0 -19
  205. data/lib/scarpe/spacing.rb +0 -9
  206. data/lib/scarpe/stack.rb +0 -70
  207. data/lib/scarpe/text_widget.rb +0 -42
  208. data/lib/scarpe/unit_test_helpers.rb +0 -163
  209. data/lib/scarpe/widgets.rb +0 -30
  210. data/lib/scarpe/wv/fill.rb +0 -30
  211. data/lib/scarpe/wv/shape_helper.rb +0 -44
  212. data/scarpe-0.2.0.gem +0 -0
  213. /data/{lib/scarpe → spikes}/glibui/README.md +0 -0
  214. /data/{lib/scarpe → spikes}/glibui/alert.rb +0 -0
  215. /data/{lib/scarpe → spikes}/glibui/app.rb +0 -0
  216. /data/{lib/scarpe → spikes}/glibui/background.rb +0 -0
  217. /data/{lib/scarpe → spikes}/glibui/border.rb +0 -0
  218. /data/{lib/scarpe → spikes}/glibui/button.rb +0 -0
  219. /data/{lib/scarpe → spikes}/glibui/dimensions.rb +0 -0
  220. /data/{lib/scarpe → spikes}/glibui/document_root.rb +0 -0
  221. /data/{lib/scarpe → spikes}/glibui/edit_box.rb +0 -0
  222. /data/{lib/scarpe → spikes}/glibui/edit_line.rb +0 -0
  223. /data/{lib/scarpe → spikes}/glibui/flow.rb +0 -0
  224. /data/{lib/scarpe → spikes}/glibui/html.rb +0 -0
  225. /data/{lib/scarpe → spikes}/glibui/image.rb +0 -0
  226. /data/{lib/scarpe → spikes}/glibui/link.rb +0 -0
  227. /data/{lib/scarpe → spikes}/glibui/local_display.rb +0 -0
  228. /data/{lib/scarpe → spikes}/glibui/para.rb +0 -0
  229. /data/{lib/scarpe → spikes}/glibui/spacing.rb +0 -0
  230. /data/{lib/scarpe → spikes}/glibui/stack.rb +0 -0
  231. /data/{lib/scarpe → spikes}/glibui/text_widget.rb +0 -0
  232. /data/{lib/scarpe → spikes}/libui/alert.rb +0 -0
  233. /data/{lib/scarpe → spikes}/libui/button.rb +0 -0
  234. /data/{lib/scarpe → spikes}/libui/colors.rb +0 -0
  235. /data/{lib/scarpe → spikes}/libui/core.rb +0 -0
  236. /data/{lib/scarpe → spikes}/libui/flow.rb +0 -0
  237. /data/{lib/scarpe → spikes}/libui/libui.rb +0 -0
  238. /data/{lib/scarpe → spikes}/libui/notepad.md +0 -0
  239. /data/{lib/scarpe → spikes}/libui/para.rb +0 -0
  240. /data/{lib/scarpe → spikes}/libui/stack.rb +0 -0
@@ -1,163 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tempfile"
4
- require "json"
5
- require "fileutils"
6
-
7
- # Helpers here should *not* use Webview-specific functionality.
8
- # The intention is that these are helpers for various Scarpe display
9
- # services that do *not* use Webview.
10
-
11
- module Scarpe::Test; end
12
-
13
- # We want test failures set up once *total*, not per Minitest::Test. So an instance var
14
- # doesn't do it.
15
- ALREADY_SET_UP_LOGGED_TEST_FAILURES = { setup: false }
16
-
17
- # General helpers for general usage
18
- module Scarpe::Test::Helpers
19
- def with_tempfile(prefix, contents, dir: Dir.tmpdir)
20
- t = Tempfile.new(prefix, dir)
21
- t.write(contents)
22
- t.flush # Make sure the contents are written out
23
-
24
- yield(t.path)
25
- ensure
26
- t.close
27
- t.unlink
28
- end
29
-
30
- # Temporarily set env vars for the block of code inside
31
- def with_env_vars(envs)
32
- old_env = {}
33
- envs.each do |k, v|
34
- old_env[k] = ENV[k]
35
- ENV[k] = v
36
- end
37
- yield
38
- ensure
39
- old_env.each { |k, v| ENV[k] = v }
40
- end
41
- end
42
-
43
- # This test will save extensive logs in case of test failure.
44
- # Note that it defines setup/teardown methods. If you want
45
- # multiple setup/teardowns from multiple places to happen you
46
- # may need to explictly call (e.g. with logged_test_setup/teardown)
47
- # to ensure everything you want happens.
48
- module Scarpe::Test::LoggedTest
49
- LOGGER_DIR = File.expand_path("#{__dir__}/../../logger")
50
-
51
- def file_id
52
- "#{self.class.name}_#{self.name}"
53
- end
54
-
55
- def logged_test_setup
56
- # Make sure test failures will be saved at the end of the run.
57
- # Delete stale test failures and logging only the *first* time this is called.
58
- set_up_test_failures
59
-
60
- @normal_log_config = Scarpe::Logger.current_log_config
61
- Scarpe::Logger.configure_logger(log_config_for_test)
62
-
63
- Scarpe::Logger.logger("LoggedScarpeTest").info("Test: #{self.class.name}##{self.name}")
64
- end
65
-
66
- # If you include this module and don't override setup/teardown, everything will
67
- # work fine. But if you need more setup/teardown steps, you can do that too.
68
- def setup
69
- logged_test_setup
70
- end
71
-
72
- def logged_test_teardown
73
- # Restore previous log config
74
- Scarpe::Logger.configure_logger(@normal_log_config)
75
-
76
- if self.failure
77
- save_failure_logs
78
- else
79
- remove_unsaved_logs
80
- end
81
- end
82
-
83
- def teardown
84
- logged_test_teardown
85
- end
86
-
87
- def log_config_for_test
88
- {
89
- "default" => ["debug", "logger/test_failure_#{file_id}.log"],
90
-
91
- "WebviewAPI" => ["debug", "logger/test_failure_wv_api_#{file_id}.log"],
92
-
93
- "DisplayService" => ["debug", "logger/test_failure_events_#{file_id}.log"],
94
- "WV::RelayDisplayService" => ["debug", "logger/test_failure_events_#{file_id}.log"],
95
- "WV::WebviewDisplayService" => ["debug", "logger/test_failure_events_#{file_id}.log"],
96
- "WV::ControlInterface" => ["debug", "logger/test_failure_events_#{file_id}.log"],
97
- }
98
- end
99
-
100
- # This could be a lot simpler except I want to only update the file list in one place,
101
- # log_config_for_test(). Having a single spot should (I hope) make it a lot friendlier to
102
- # add more logfiles for different components, logged API objects, etc.
103
- def saved_log_files
104
- lc = log_config_for_test
105
- log_outfiles = lc.values.map { |_level, loc| loc }
106
- log_outfiles.select { |s| s.start_with?("logger/") }.map { |s| s.delete_prefix("logger/") }
107
- end
108
-
109
- def set_up_test_failures
110
- return if ALREADY_SET_UP_LOGGED_TEST_FAILURES[:setup]
111
-
112
- ALREADY_SET_UP_LOGGED_TEST_FAILURES[:setup] = true
113
- # Delete stale test failures, if any, before starting the first failure-logged test
114
- Dir["#{LOGGER_DIR}/test_failure*.log"].each { |fn| File.unlink(fn) }
115
-
116
- Minitest.after_run do
117
- # Print test failure notice to console
118
- unless Dir["#{LOGGER_DIR}/test_failure*.out.log"].empty?
119
- puts "Some tests have failed! See #{LOGGER_DIR}/test_failure*.out.log for test logs!"
120
- end
121
-
122
- # Remove un-saved test logs
123
- Dir["#{LOGGER_DIR}/test_failure*.log"].each do |f|
124
- next if f.include?(".out.log")
125
-
126
- File.unlink(f) if File.exist?(f)
127
- end
128
- end
129
- end
130
-
131
- def logfail_out_loc(filepath)
132
- # Add a .out prefix before final .log
133
- out_loc = filepath.gsub(%r{.log\Z}, ".out.log")
134
-
135
- if out_loc == filepath
136
- raise "Something is wrong! Could not figure out failure-log output path for #{filepath.inspect}!"
137
- end
138
-
139
- if File.exist?(out_loc)
140
- raise "Duplicate test file #{out_loc.inspect}? This file should *not* already exist!"
141
- end
142
-
143
- out_loc
144
- end
145
-
146
- def save_failure_logs
147
- saved_log_files.each do |log_file|
148
- full_loc = File.expand_path("#{LOGGER_DIR}/#{log_file}")
149
- # TODO: we'd like to skip 0-length logfiles. But also Logging doesn't flush. For now, ignore.
150
- next unless File.exist?(full_loc)
151
-
152
- FileUtils.mv full_loc, logfail_out_loc(full_loc)
153
- end
154
- end
155
-
156
- def remove_unsaved_logs
157
- Dir["#{LOGGER_DIR}/test_failure*.log"].each do |f|
158
- next if f.include?(".out.log") # Don't delete saved logs
159
-
160
- File.unlink(f)
161
- end
162
- end
163
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "colors"
4
- require_relative "widget"
5
- require_relative "app"
6
-
7
- require_relative "spacing"
8
- require_relative "background"
9
- require_relative "border"
10
- require_relative "star"
11
-
12
- require_relative "fill"
13
-
14
- require_relative "document_root"
15
- require_relative "para"
16
- require_relative "stack"
17
- require_relative "flow"
18
- require_relative "button"
19
- require_relative "image"
20
- require_relative "edit_box"
21
- require_relative "edit_line"
22
- require_relative "list_box"
23
- require_relative "alert"
24
- require_relative "span"
25
- require_relative "shape"
26
- require_relative "arc"
27
-
28
- require_relative "text_widget"
29
- require_relative "link"
30
- require_relative "line"
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Scarpe
4
- class WebviewFill < WebviewWidget
5
- def initialize(properties)
6
- super(properties)
7
- end
8
-
9
- def element
10
- width = @parent.get_style[:width]
11
- height = @parent.get_style[:height]
12
-
13
- HTML.render do |h|
14
- h.div(id: html_id, style: style(width, height)) do
15
- @text
16
- end
17
- end
18
- end
19
-
20
- private
21
-
22
- def style(width, height)
23
- styles = {}
24
- styles[:width] = width
25
- styles[:height] = height
26
- styles[:background] = @color if @color
27
- styles
28
- end
29
- end
30
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ShapeHelper
4
- def path_commands
5
- $path_commands ||= []
6
- end
7
-
8
- def move_to(x, y)
9
- validate_coordinates(x, y)
10
- path_commands << "M #{x} #{y}"
11
- end
12
-
13
- def line_to(x, y)
14
- validate_coordinates(x, y)
15
- path_commands << "L #{x} #{y}"
16
- end
17
-
18
- def shape_path
19
- path_commands_str = path_commands.join(" ")
20
- path_commands_str
21
- end
22
-
23
- def colors
24
- $colors ||= []
25
- end
26
-
27
- def fill(color)
28
- $current_color = color
29
- end
30
-
31
- def color_for_fill
32
- $current_color || "black"
33
- end
34
-
35
- private
36
-
37
- def validate_coordinates(x, y)
38
- raise ArgumentError, "Invalid coordinates: x=#{x}, y=#{y}" unless valid_coordinate?(x) && valid_coordinate?(y)
39
- end
40
-
41
- def valid_coordinate?(coordinate)
42
- coordinate.is_a?(Numeric)
43
- end
44
- end
data/scarpe-0.2.0.gem DELETED
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes