scarpe 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.yardopts +12 -0
- data/CHANGELOG.md +16 -2
- data/Gemfile +3 -0
- data/Gemfile.lock +116 -0
- data/README.md +53 -30
- data/Rakefile +13 -1
- data/docs/yard/catscradle.md +44 -0
- data/docs/yard/template/default/fulldoc/html/setup.rb +13 -0
- data/docs/yard/template/default/layout/html/setup.rb +9 -0
- data/examples/animate.rb +20 -0
- data/examples/arrow.rb +10 -0
- data/examples/background_with_image.rb +16 -0
- data/examples/bloopsaphone/working/bronx_army_knife.rb +66 -0
- data/examples/bloopsaphone/working/morning_serenity.rb +21 -0
- data/examples/bloopsaphone/working/simpsons_theme_song_by_why.rb +6 -4
- data/examples/btn_tooltip.rb +7 -0
- data/examples/button_go_away.rb +1 -1
- data/examples/button_style_changed.rb +7 -0
- data/examples/button_styles_default.rb +6 -0
- data/examples/check.rb +18 -0
- data/examples/clear_and_append.rb +24 -0
- data/examples/download_and_show_image.rb +28 -0
- data/examples/edit_box.rb +3 -5
- data/examples/fonts.rb +2 -2
- data/examples/gen.rb +8 -8
- data/examples/get_headers.rb +10 -0
- data/examples/highlander.rb +4 -2
- data/examples/legacy/README.md +6 -0
- data/examples/legacy/not_checked/shoes-contrib/basic/shoes-notes.rb +1 -1
- data/examples/legacy/not_checked/simple/anim-shapes.rb +1 -1
- data/examples/legacy/not_checked/speedometer_app.rb +55 -0
- data/examples/legacy/working/simple/image-icon.rb +3 -0
- data/examples/legacy/{not_checked → working}/simple/image.rb +1 -1
- data/examples/link.rb +2 -2
- data/examples/list_box_choose.rb +17 -0
- data/examples/local_assets/local_file_server.rb +82 -0
- data/examples/local_assets/sample.gif +0 -0
- data/examples/local_assets/sample.mp4 +0 -0
- data/examples/local_fonts.rb +4 -0
- data/examples/local_images.rb +3 -0
- data/examples/motion_events.rb +20 -0
- data/examples/para/para_text.rb +14 -0
- data/examples/parse_xl_funnies.rb +58 -0
- data/examples/progress.rb +31 -0
- data/examples/radio/radio.rb +16 -0
- data/examples/radio/radio_groups.rb +18 -0
- data/examples/radio/radio_same_slot.rb +6 -0
- data/examples/rect.rb +4 -0
- data/examples/rotate_shapes.rb +17 -0
- data/examples/ruby_racer.rb +13 -15
- data/examples/selfitude.rb +18 -0
- data/examples/shapes/shapes_fill.rb +4 -3
- data/examples/shoes_school.rb +2 -4
- data/examples/show_hide.rb +6 -0
- data/examples/simpler-menu.rb +21 -0
- data/examples/skip_ci/change_my_audio_source.rb +21 -0
- data/examples/skip_ci/guitar_fretboard.rb +137 -0
- data/examples/video.rb +10 -0
- data/exe/scarpe +43 -66
- data/fonts/Pacifico.ttf +0 -0
- data/lacci/Gemfile +24 -0
- data/lacci/Gemfile.lock +79 -0
- data/lacci/Rakefile +12 -0
- data/lacci/lacci.gemspec +37 -0
- data/lacci/lib/lacci/scarpe_cli.rb +71 -0
- data/lacci/lib/lacci/scarpe_core.rb +22 -0
- data/lacci/lib/lacci/version.rb +13 -0
- data/lacci/lib/scarpe/niente/app.rb +23 -0
- data/lacci/lib/scarpe/niente/display_service.rb +62 -0
- data/lacci/lib/scarpe/niente/drawable.rb +57 -0
- data/lacci/lib/scarpe/niente/logger.rb +29 -0
- data/lacci/lib/scarpe/niente/shoes_spec.rb +87 -0
- data/lacci/lib/scarpe/niente.rb +20 -0
- data/lacci/lib/shoes/app.rb +309 -0
- data/{lib/scarpe → lacci/lib/shoes}/background.rb +2 -2
- data/{lib/scarpe → lacci/lib/shoes}/border.rb +2 -2
- data/lacci/lib/shoes/builtins.rb +63 -0
- data/lacci/lib/shoes/changelog.rb +52 -0
- data/{lib/scarpe → lacci/lib/shoes}/colors.rb +3 -1
- data/lacci/lib/shoes/constants.rb +47 -0
- data/{lib/scarpe → lacci/lib/shoes}/display_service.rb +71 -53
- data/lacci/lib/shoes/download.rb +123 -0
- data/lacci/lib/shoes/drawable.rb +380 -0
- data/lacci/lib/shoes/drawables/arc.rb +49 -0
- data/lacci/lib/shoes/drawables/arrow.rb +41 -0
- data/lacci/lib/shoes/drawables/button.rb +73 -0
- data/lacci/lib/shoes/drawables/check.rb +29 -0
- data/lacci/lib/shoes/drawables/document_root.rb +20 -0
- data/lacci/lib/shoes/drawables/edit_box.rb +29 -0
- data/{lib/scarpe → lacci/lib/shoes/drawables}/edit_line.rb +6 -6
- data/lacci/lib/shoes/drawables/flow.rb +22 -0
- data/{lib/scarpe → lacci/lib/shoes/drawables}/image.rb +7 -11
- data/lacci/lib/shoes/drawables/line.rb +20 -0
- data/lacci/lib/shoes/drawables/link.rb +34 -0
- data/lacci/lib/shoes/drawables/list_box.rb +56 -0
- data/lacci/lib/shoes/drawables/para.rb +118 -0
- data/lacci/lib/shoes/drawables/progress.rb +14 -0
- data/lacci/lib/shoes/drawables/radio.rb +33 -0
- data/lacci/lib/shoes/drawables/rect.rb +17 -0
- data/lacci/lib/shoes/drawables/shape.rb +36 -0
- data/lacci/lib/shoes/drawables/slot.rb +87 -0
- data/{lib/scarpe → lacci/lib/shoes/drawables}/span.rb +8 -7
- data/lacci/lib/shoes/drawables/stack.rb +26 -0
- data/lacci/lib/shoes/drawables/star.rb +50 -0
- data/lacci/lib/shoes/drawables/subscription_item.rb +93 -0
- data/lacci/lib/shoes/drawables/text_drawable.rb +63 -0
- data/lacci/lib/shoes/drawables/video.rb +16 -0
- data/lacci/lib/shoes/drawables/widget.rb +69 -0
- data/lacci/lib/shoes/drawables.rb +31 -0
- data/lacci/lib/shoes/errors.rb +28 -0
- data/lacci/lib/shoes/log.rb +71 -0
- data/lacci/lib/shoes/ruby_extensions.rb +15 -0
- data/lacci/lib/shoes/spacing.rb +9 -0
- data/lacci/lib/shoes-spec.rb +93 -0
- data/lacci/lib/shoes.rb +147 -0
- data/lacci/test/test_colors.rb +39 -0
- data/lacci/test/test_helper.rb +63 -0
- data/lacci/test/test_lacci.rb +18 -0
- data/lacci/test/test_shoes_errors.rb +49 -0
- data/lib/scarpe/cats_cradle.rb +271 -0
- data/lib/scarpe/errors.rb +77 -0
- data/lib/scarpe/evented_assertions.rb +121 -0
- data/lib/scarpe/shoes_spec.rb +181 -0
- data/lib/scarpe/version.rb +2 -2
- data/lib/scarpe/wv/app.rb +45 -23
- data/lib/scarpe/wv/arc.rb +4 -48
- data/lib/scarpe/wv/arrow.rb +9 -0
- data/lib/scarpe/wv/button.rb +7 -33
- data/lib/scarpe/wv/check.rb +27 -0
- data/lib/scarpe/wv/control_interface.rb +32 -40
- data/lib/scarpe/wv/document_root.rb +66 -31
- data/lib/scarpe/wv/drawable.rb +273 -0
- data/lib/scarpe/wv/edit_box.rb +4 -19
- data/lib/scarpe/wv/edit_line.rb +4 -18
- data/lib/scarpe/wv/flow.rb +2 -28
- data/lib/scarpe/wv/image.rb +10 -25
- data/lib/scarpe/wv/line.rb +3 -28
- data/lib/scarpe/wv/link.rb +3 -15
- data/lib/scarpe/wv/list_box.rb +6 -29
- data/lib/scarpe/wv/para.rb +11 -28
- data/lib/scarpe/wv/progress.rb +19 -0
- data/lib/scarpe/wv/radio.rb +33 -0
- data/lib/scarpe/wv/rect.rb +13 -0
- data/lib/scarpe/wv/shape.rb +41 -10
- data/lib/scarpe/wv/slot.rb +64 -0
- data/lib/scarpe/wv/span.rb +3 -25
- data/lib/scarpe/wv/stack.rb +2 -38
- data/lib/scarpe/wv/star.rb +3 -54
- data/lib/scarpe/wv/subscription_item.rb +84 -0
- data/lib/scarpe/wv/text_drawable.rb +32 -0
- data/lib/scarpe/wv/video.rb +34 -0
- data/lib/scarpe/wv/web_wrangler.rb +449 -299
- data/lib/scarpe/wv/webview_local_display.rb +63 -26
- data/lib/scarpe/wv/webview_relay_display.rb +24 -125
- data/lib/scarpe/wv/webview_relay_util.rb +140 -0
- data/lib/scarpe/wv/wv_display_worker.rb +19 -6
- data/lib/scarpe/wv.rb +76 -14
- data/lib/scarpe/wv_local.rb +1 -1
- data/lib/scarpe/wv_relay.rb +1 -1
- data/lib/scarpe.rb +4 -32
- data/logger/debug_web_wrangler.json +1 -1
- data/logger/scarpe_wv_test.json +1 -1
- data/scarpe-components/.gitignore +1 -0
- data/scarpe-components/Gemfile +22 -0
- data/scarpe-components/Gemfile.lock +86 -0
- data/scarpe-components/README.md +35 -0
- data/scarpe-components/Rakefile +12 -0
- data/scarpe-components/lib/scarpe/components/base64.rb +25 -0
- data/scarpe-components/lib/scarpe/components/calzini/alert.rb +49 -0
- data/scarpe-components/lib/scarpe/components/calzini/art_widgets.rb +203 -0
- data/scarpe-components/lib/scarpe/components/calzini/button.rb +39 -0
- data/scarpe-components/lib/scarpe/components/calzini/misc.rb +146 -0
- data/scarpe-components/lib/scarpe/components/calzini/para.rb +35 -0
- data/scarpe-components/lib/scarpe/components/calzini/slots.rb +155 -0
- data/scarpe-components/lib/scarpe/components/calzini/text_widgets.rb +65 -0
- data/scarpe-components/lib/scarpe/components/calzini.rb +149 -0
- data/scarpe-components/lib/scarpe/components/errors.rb +20 -0
- data/scarpe-components/lib/scarpe/components/file_helpers.rb +66 -0
- data/scarpe-components/lib/scarpe/components/html.rb +131 -0
- data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +75 -0
- data/scarpe-components/lib/scarpe/components/minitest_import_runnable.rb +98 -0
- data/scarpe-components/lib/scarpe/components/minitest_result.rb +86 -0
- data/scarpe-components/lib/scarpe/components/modular_logger.rb +113 -0
- data/scarpe-components/lib/scarpe/components/print_logger.rb +47 -0
- data/{lib/scarpe → scarpe-components/lib/scarpe/components}/promises.rb +115 -48
- data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +189 -0
- data/scarpe-components/lib/scarpe/components/string_helpers.rb +10 -0
- data/scarpe-components/lib/scarpe/components/tiranti.rb +225 -0
- data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +257 -0
- data/scarpe-components/lib/scarpe/components/version.rb +7 -0
- data/scarpe-components/scarpe-components.gemspec +38 -0
- data/scarpe-components/test/calzini/test_calzini_alert.rb +30 -0
- data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +105 -0
- data/scarpe-components/test/calzini/test_calzini_button.rb +52 -0
- data/scarpe-components/test/calzini/test_calzini_misc.rb +115 -0
- data/scarpe-components/test/calzini/test_calzini_para.rb +37 -0
- data/scarpe-components/test/calzini/test_calzini_slots.rb +130 -0
- data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +41 -0
- data/scarpe-components/test/mtr_data/exception.json +1 -0
- data/scarpe-components/test/mtr_data/fail_with_message.json +1 -0
- data/scarpe-components/test/mtr_data/skipped_no_message.json +1 -0
- data/scarpe-components/test/mtr_data/skipped_w_msg.json +1 -0
- data/scarpe-components/test/mtr_data/succeed_2_asserts.json +1 -0
- data/scarpe-components/test/test_components.rb +9 -0
- data/scarpe-components/test/test_dimensions.rb +26 -0
- data/scarpe-components/test/test_helper.rb +43 -0
- data/scarpe-components/test/test_html.rb +65 -0
- data/scarpe-components/test/test_minitest_result.rb +61 -0
- data/scarpe-components/test/test_promises.rb +261 -0
- data/scarpe-components/test/test_segmented_app_files.rb +184 -0
- data/scarpegen.rb +14 -14
- data/sig/scarpe.rbs +1 -1
- data/{lib/scarpe → spikes}/glibui/widget.rb +2 -2
- data/{lib/scarpe → spikes}/glibui.rb +1 -1
- data/templates/basic_class_template.erb +13 -14
- data/templates/class_template_with_event_bind.erb +4 -4
- data/templates/class_template_with_shapes.erb +8 -17
- data/templates/example_template.erb +1 -1
- data/templates/module_template.erb +4 -4
- data/templates/webview_template.erb +3 -5
- metadata +236 -145
- data/examples/fill.rb +0 -25
- data/examples/legacy/not_checked/shoes-contrib/basic/class-book.yaml +0 -387
- data/examples/legacy/not_checked/shoes-contrib/elements/image-icon.rb +0 -3
- data/examples/legacy/not_checked/shoes-contrib/good/good-clock.rb +0 -51
- data/examples/legacy/not_checked/shoes-contrib/good/good-follow.rb +0 -26
- data/examples/legacy/not_checked/shoes-contrib/good/good-reminder.rb +0 -174
- data/examples/legacy/not_checked/shoes-contrib/good/good-vjot.rb +0 -56
- data/examples/legacy/not_checked/shoes-contrib/simple/simple-timer.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/good-clock.rb +0 -51
- data/examples/legacy/not_checked/shoes-dep-samples/good-follow.rb +0 -26
- data/examples/legacy/not_checked/shoes-dep-samples/good-reminder.rb +0 -174
- data/examples/legacy/not_checked/shoes-dep-samples/good-vjot.rb +0 -56
- data/examples/legacy/not_checked/shoes-dep-samples/simple-accordion.rb +0 -75
- data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-shapes.rb +0 -17
- data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-text.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-arc.rb +0 -23
- data/examples/legacy/not_checked/shoes-dep-samples/simple-bounce.rb +0 -24
- data/examples/legacy/not_checked/shoes-dep-samples/simple-calc.rb +0 -70
- data/examples/legacy/not_checked/shoes-dep-samples/simple-chipmunk.rb +0 -26
- data/examples/legacy/not_checked/shoes-dep-samples/simple-control-sizes.rb +0 -24
- data/examples/legacy/not_checked/shoes-dep-samples/simple-curve.rb +0 -26
- data/examples/legacy/not_checked/shoes-dep-samples/simple-dialogs.rb +0 -29
- data/examples/legacy/not_checked/shoes-dep-samples/simple-draw.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-editor.rb +0 -28
- data/examples/legacy/not_checked/shoes-dep-samples/simple-form.rb +0 -28
- data/examples/legacy/not_checked/shoes-dep-samples/simple-form.shy +0 -0
- data/examples/legacy/not_checked/shoes-dep-samples/simple-mask.rb +0 -21
- data/examples/legacy/not_checked/shoes-dep-samples/simple-menu.rb +0 -31
- data/examples/legacy/not_checked/shoes-dep-samples/simple-menu1.rb +0 -35
- data/examples/legacy/not_checked/shoes-dep-samples/simple-rubygems.rb +0 -29
- data/examples/legacy/not_checked/shoes-dep-samples/simple-slide.rb +0 -45
- data/examples/legacy/not_checked/shoes-dep-samples/simple-sphere.rb +0 -28
- data/examples/legacy/not_checked/shoes-dep-samples/simple-sqlite3.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-timer.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-video.rb +0 -13
- data/examples/legacy/not_checked/simple/anim-text.rb +0 -13
- data/examples/legacy/not_checked/simple/arc.rb +0 -23
- data/examples/legacy/not_checked/simple/bounce.rb +0 -24
- data/examples/legacy/not_checked/simple/chipmunk.rb +0 -26
- data/examples/legacy/not_checked/simple/curve.rb +0 -26
- data/examples/legacy/not_checked/simple/dialogs.rb +0 -29
- data/examples/legacy/not_checked/simple/downloader.rb +0 -40
- data/examples/legacy/not_checked/simple/draw.rb +0 -13
- data/examples/legacy/not_checked/simple/mask.rb +0 -21
- data/examples/legacy/not_checked/simple/slide.rb +0 -45
- data/examples/legacy/not_checked/simple/sphere.rb +0 -28
- data/lib/constants.rb +0 -5
- data/lib/scarpe/alert.rb +0 -19
- data/lib/scarpe/app.rb +0 -78
- data/lib/scarpe/arc.rb +0 -49
- data/lib/scarpe/button.rb +0 -35
- data/lib/scarpe/document_root.rb +0 -20
- data/lib/scarpe/edit_box.rb +0 -24
- data/lib/scarpe/fill.rb +0 -23
- data/lib/scarpe/flow.rb +0 -19
- data/lib/scarpe/line.rb +0 -25
- data/lib/scarpe/link.rb +0 -25
- data/lib/scarpe/list_box.rb +0 -25
- data/lib/scarpe/logger.rb +0 -155
- data/lib/scarpe/para.rb +0 -90
- data/lib/scarpe/shape.rb +0 -19
- data/lib/scarpe/spacing.rb +0 -9
- data/lib/scarpe/stack.rb +0 -70
- data/lib/scarpe/star.rb +0 -47
- data/lib/scarpe/text_widget.rb +0 -42
- data/lib/scarpe/unit_test_helpers.rb +0 -163
- data/lib/scarpe/widget.rb +0 -198
- data/lib/scarpe/widgets.rb +0 -30
- data/lib/scarpe/wv/alert.rb +0 -65
- data/lib/scarpe/wv/background.rb +0 -18
- data/lib/scarpe/wv/border.rb +0 -22
- data/lib/scarpe/wv/control_interface_test.rb +0 -253
- data/lib/scarpe/wv/dimensions.rb +0 -22
- data/lib/scarpe/wv/fill.rb +0 -30
- data/lib/scarpe/wv/html.rb +0 -107
- data/lib/scarpe/wv/shape_helper.rb +0 -44
- data/lib/scarpe/wv/spacing.rb +0 -41
- data/lib/scarpe/wv/text_widget.rb +0 -30
- data/lib/scarpe/wv/widget.rb +0 -181
- data/scarpe-0.2.0.gem +0 -0
- /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/definr.rb +0 -0
- /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/funnies.rb +0 -0
- /data/examples/legacy/not_checked/shoes-contrib/{elements → basic}/list_box-select-class.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/basic-edit-box.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/basic-fps.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/border-cat.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/check-mate.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/manipulation → working/simple}/clear-slot.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/clock.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/gradient-shoes.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/list_box-shape-report.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/list_box.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/phat-button.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib → working}/simple/simple-calc.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/position → working/simple}/stack-width.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/width-introspec.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/README.md +0 -0
- /data/{lib/scarpe → spikes}/glibui/alert.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/app.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/background.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/border.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/button.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/dimensions.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/document_root.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/edit_box.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/edit_line.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/flow.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/html.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/image.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/link.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/local_display.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/para.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/spacing.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/stack.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/text_widget.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/alert.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/button.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/colors.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/core.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/flow.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/libui.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/notepad.md +0 -0
- /data/{lib/scarpe → spikes}/libui/para.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/stack.rb +0 -0
@@ -1,72 +1,109 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
module Scarpe
|
4
|
+
# This is the simplest type of Webview DisplayService. It creates Webview drawables
|
5
|
+
# corresponding to Shoes drawables, manages the Webview and its DOM tree, and
|
6
|
+
# generally keeps the Shoes/Webview connection working.
|
7
|
+
#
|
4
8
|
# This is an in-process Webview-based display service, with all the limitations that
|
5
9
|
# entails. Slow handlers will crash, ending this display service will end the
|
6
10
|
# process, too many or too large evals can crash the process, etc.
|
7
|
-
#
|
11
|
+
# Frequently it's better to use a RelayDisplayService to a second
|
8
12
|
# process containing one of these.
|
9
|
-
class
|
10
|
-
include
|
13
|
+
class Webview::DisplayService < Shoes::DisplayService
|
14
|
+
include Shoes::Log
|
11
15
|
|
12
16
|
class << self
|
13
17
|
attr_accessor :instance
|
14
18
|
end
|
15
19
|
|
16
|
-
#
|
20
|
+
# The ControlInterface is used to handle internal events in Webview Scarpe
|
17
21
|
attr_reader :control_interface
|
22
|
+
|
23
|
+
# The DocumentRoot is the top drawable of the Webview-side drawable tree
|
18
24
|
attr_reader :doc_root
|
25
|
+
|
26
|
+
# app is the Scarpe::Webview::App
|
27
|
+
attr_reader :app
|
28
|
+
|
29
|
+
# wrangler is the Scarpe::WebWrangler
|
19
30
|
attr_reader :wrangler
|
20
31
|
|
21
|
-
# This is called before any of the various
|
32
|
+
# This is called before any of the various Webview::Drawables are created, to be
|
33
|
+
# able to create them and look them up.
|
22
34
|
def initialize
|
23
|
-
if
|
24
|
-
raise "ERROR! This is meant to be a singleton!"
|
35
|
+
if Webview::DisplayService.instance
|
36
|
+
raise Shoes::Errors::SingletonError, "ERROR! This is meant to be a singleton!"
|
25
37
|
end
|
26
38
|
|
27
|
-
|
39
|
+
Webview::DisplayService.instance = self
|
28
40
|
|
29
41
|
super()
|
30
|
-
log_init("
|
42
|
+
log_init("Webview::DisplayService")
|
31
43
|
|
32
|
-
@
|
44
|
+
@display_drawable_for = {}
|
33
45
|
end
|
34
46
|
|
35
|
-
|
36
|
-
|
47
|
+
# Create a Webview display drawable for a specific Shoes drawable, and pair it with
|
48
|
+
# the linkable ID for this Shoes drawable.
|
49
|
+
#
|
50
|
+
# @param drawable_class_name [String] The class name of the Shoes drawable, e.g. Shoes::Button
|
51
|
+
# @param drawable_id [String] the linkable ID for drawable events
|
52
|
+
# @param properties [Hash] a JSON-serialisable Hash with the drawable's Shoes styles
|
53
|
+
# @param is_widget [Boolean] whether the class is a user-defined Shoes::Widget subclass
|
54
|
+
# @return [Webview::Drawable] the newly-created Webview drawable
|
55
|
+
def create_display_drawable_for(drawable_class_name, drawable_id, properties, is_widget:)
|
56
|
+
existing = query_display_drawable_for(drawable_id, nil_ok: true)
|
57
|
+
if existing
|
58
|
+
@log.warn("There is already a display drawable for #{drawable_id.inspect}! Returning #{existing.class.name}.")
|
59
|
+
return existing
|
60
|
+
end
|
61
|
+
|
62
|
+
if drawable_class_name == "App"
|
37
63
|
unless @doc_root
|
38
|
-
raise "
|
64
|
+
raise Scarpe::MissingDocRootError, "Webview::DocumentRoot is supposed to be created before Webview::App!"
|
39
65
|
end
|
40
66
|
|
41
|
-
display_app = Scarpe::
|
67
|
+
display_app = Scarpe::Webview::App.new(properties)
|
42
68
|
display_app.document_root = @doc_root
|
43
69
|
@control_interface = display_app.control_interface
|
44
70
|
@control_interface.doc_root = @doc_root
|
45
71
|
@app = @control_interface.app
|
46
72
|
@wrangler = @control_interface.wrangler
|
47
73
|
|
48
|
-
|
74
|
+
set_drawable_pairing(drawable_id, display_app)
|
49
75
|
|
50
76
|
return display_app
|
51
77
|
end
|
52
78
|
|
53
|
-
# Create a corresponding display
|
54
|
-
|
55
|
-
|
56
|
-
|
79
|
+
# Create a corresponding display drawable
|
80
|
+
|
81
|
+
if is_widget
|
82
|
+
display_class = Scarpe::Webview::Flow
|
83
|
+
else
|
84
|
+
display_class = Scarpe::Webview::Drawable.display_class_for(drawable_class_name)
|
85
|
+
unless display_class < Scarpe::Webview::Drawable
|
86
|
+
raise Scarpe::BadDisplayClassType, "Wrong display class type #{display_class.inspect} for class name #{drawable_class_name.inspect}!"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
display_drawable = display_class.new(properties)
|
90
|
+
set_drawable_pairing(drawable_id, display_drawable)
|
57
91
|
|
58
|
-
if
|
59
|
-
#
|
60
|
-
# but we'll want a reference to it when we create
|
61
|
-
@doc_root =
|
92
|
+
if drawable_class_name == "DocumentRoot"
|
93
|
+
# DocumentRoot is created before App. Mostly doc_root is just like any other drawable,
|
94
|
+
# but we'll want a reference to it when we create App.
|
95
|
+
@doc_root = display_drawable
|
62
96
|
end
|
63
97
|
|
64
|
-
|
98
|
+
display_drawable
|
65
99
|
end
|
66
100
|
|
101
|
+
# Destroy the display service and the app. Quit the process (eventually.)
|
102
|
+
#
|
103
|
+
# @return [void]
|
67
104
|
def destroy
|
68
105
|
@app.destroy
|
69
|
-
|
106
|
+
Webview::DisplayService.instance = nil
|
70
107
|
end
|
71
108
|
end
|
72
109
|
end
|
@@ -3,132 +3,27 @@
|
|
3
3
|
require "socket"
|
4
4
|
require "rbconfig"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
!r.empty?
|
21
|
-
end
|
22
|
-
|
23
|
-
def send_datagram(contents)
|
24
|
-
str_data = JSON.dump contents
|
25
|
-
dgram_str = (str_data.length.to_s + "a" + str_data).encode(Encoding::BINARY)
|
26
|
-
to_write = dgram_str.bytesize
|
27
|
-
written = 0
|
28
|
-
|
29
|
-
until written == to_write
|
30
|
-
count = @to.write(dgram_str.byteslice(written..-1))
|
31
|
-
if count.nil? || count == 0
|
32
|
-
raise "Something was wrong in send_datagram! Write returned #{count.inspect}!"
|
33
|
-
end
|
34
|
-
|
35
|
-
written += count
|
36
|
-
end
|
37
|
-
|
38
|
-
nil
|
39
|
-
end
|
40
|
-
|
41
|
-
def receive_datagram
|
42
|
-
@readbuf ||= String.new.encode(Encoding::BINARY)
|
43
|
-
to_read = nil
|
44
|
-
|
45
|
-
loop do
|
46
|
-
# Have we read a packet length already, sitting in @readbuf?
|
47
|
-
a_idx = @readbuf.index("a")
|
48
|
-
if a_idx
|
49
|
-
to_read = @readbuf[0..a_idx].to_i
|
50
|
-
@readbuf = @readbuf[(a_idx + 1)..-1]
|
51
|
-
break
|
52
|
-
end
|
53
|
-
|
54
|
-
# If not, read more bytes
|
55
|
-
new_bytes = @from.read(10)
|
56
|
-
if new_bytes.nil?
|
57
|
-
# This is perfectly normal, if the connection closed
|
58
|
-
raise AppShutdownError, "Got an unexpected EOF reading datagram! " +
|
59
|
-
"Did the #{@i_am == :child ? "parent" : "child"} process die?"
|
60
|
-
end
|
61
|
-
@readbuf << new_bytes
|
62
|
-
end
|
63
|
-
|
64
|
-
loop do
|
65
|
-
if @readbuf.bytesize >= to_read
|
66
|
-
out = @readbuf.byteslice(0, to_read)
|
67
|
-
@readbuf = @readbuf.byteslice(to_read, -1)
|
68
|
-
return out
|
69
|
-
end
|
70
|
-
|
71
|
-
new_bytes = @from.read(to_read - @readbuf.bytesize)
|
72
|
-
@readbuf << new_bytes
|
73
|
-
end
|
74
|
-
rescue
|
75
|
-
raise AppShutdownError, "Got exception #{$!.class} when receiving datagram... #{$!.inspect}"
|
76
|
-
end
|
77
|
-
|
78
|
-
def respond_to_datagram
|
79
|
-
message = receive_datagram
|
80
|
-
m_data = JSON.parse(message)
|
81
|
-
|
82
|
-
if m_data["type"] == "event"
|
83
|
-
kwargs_hash = {}
|
84
|
-
m_data["kwargs"].each { |k, v| kwargs_hash[k.to_sym] = v }
|
85
|
-
send_shoes_event(
|
86
|
-
*m_data["args"],
|
87
|
-
event_name: m_data["kwargs"]["event_name"],
|
88
|
-
target: m_data["kwargs"]["event_target"],
|
89
|
-
**kwargs_hash,
|
90
|
-
)
|
91
|
-
elsif m_data["type"] == "create"
|
92
|
-
raise "Parent process should never receive :create datagram!" if @i_am == :parent
|
93
|
-
|
94
|
-
@wv_display.create_display_widget_for(m_data["class_name"], m_data["id"], m_data["properties"])
|
95
|
-
elsif m_data["type"] == "destroy"
|
96
|
-
if @i_am == :parent
|
97
|
-
@shutdown = true
|
98
|
-
else
|
99
|
-
@log.info("Shutting down...")
|
100
|
-
exit 0
|
101
|
-
end
|
102
|
-
else
|
103
|
-
@log.error("Unrecognized datagram type:event: #{m_data.inspect}!")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def event_loop_for(t = 1.5)
|
108
|
-
t_start = Time.now
|
109
|
-
delay_time = t
|
110
|
-
|
111
|
-
while Time.now - t_start < delay_time
|
112
|
-
if ready_to_read?(0.1)
|
113
|
-
respond_to_datagram
|
114
|
-
else
|
115
|
-
sleep 0.1
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
# This "display service" actually creates a child process and sends events
|
122
|
-
# back and forth, but creates no widgets of its own.
|
123
|
-
class WVRelayDisplayService < Scarpe::DisplayService
|
124
|
-
include Scarpe::Log
|
125
|
-
include WVRelayUtil # Needs Scarpe::Log
|
6
|
+
require_relative "webview_relay_util"
|
7
|
+
|
8
|
+
module Scarpe
|
9
|
+
# This display service creates a child process and sends events
|
10
|
+
# back and forth, but creates no drawables of its own. The child
|
11
|
+
# process will spawn a worker with its own Webview::DisplayService
|
12
|
+
# where the real Webview exists. By splitting the Webview
|
13
|
+
# process from the Shoes drawables, it can be easier to return
|
14
|
+
# control to Webview's event handler promptly. Also, the Ruby
|
15
|
+
# process could run background threads if it wanted, and
|
16
|
+
# otherwise behave like a process ***not*** containing Webview.
|
17
|
+
class Webview::RelayDisplayService < Shoes::DisplayService
|
18
|
+
include Shoes::Log
|
19
|
+
include WVRelayUtil # Needs Shoes::Log
|
126
20
|
|
127
21
|
attr_accessor :shutdown
|
128
22
|
|
23
|
+
# Create a Webview Relay Display Service
|
129
24
|
def initialize
|
130
25
|
super()
|
131
|
-
log_init("
|
26
|
+
log_init("Webview::RelayDisplayService")
|
132
27
|
|
133
28
|
@event_subs = []
|
134
29
|
@shutdown = false
|
@@ -151,29 +46,33 @@ class Scarpe
|
|
151
46
|
if event_name == "run"
|
152
47
|
run_event_loop
|
153
48
|
end
|
154
|
-
rescue AppShutdownError
|
49
|
+
rescue Scarpe::AppShutdownError
|
155
50
|
@shutdown = true
|
156
51
|
@log.info("Attempting to shut down...")
|
157
52
|
self.destroy
|
158
53
|
end
|
159
54
|
end
|
160
55
|
|
56
|
+
# Run, sending and responding to datagrams continuously.
|
161
57
|
def run_event_loop
|
162
58
|
until @shutdown
|
163
59
|
respond_to_datagram while ready_to_read?
|
164
60
|
sleep 0.1
|
165
61
|
end
|
166
|
-
rescue AppShutdownError
|
62
|
+
rescue Scarpe::AppShutdownError
|
167
63
|
@shutdown = true
|
168
64
|
@log.info("Attempting to shut down...")
|
169
65
|
self.destroy
|
170
66
|
end
|
171
67
|
|
172
|
-
|
173
|
-
|
68
|
+
# This method sends a message to the worker process to create a drawable. No actual
|
69
|
+
# drawable is created or registered with the display service.
|
70
|
+
def create_display_drawable_for(drawable_class_name, drawable_id, properties)
|
71
|
+
send_datagram({ type: :create, class_name: drawable_class_name, id: drawable_id, properties: })
|
174
72
|
# Don't need to return anything. It wouldn't be used anyway.
|
175
73
|
end
|
176
74
|
|
75
|
+
# Tell the worker process to quit, and set a flag telling the event loop to shut down.
|
177
76
|
def destroy
|
178
77
|
unless @shutdown
|
179
78
|
send_datagram({ type: :destroy })
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "socket"
|
4
|
+
|
5
|
+
module Scarpe
|
6
|
+
# WVRelayUtil defines the datagram format for the sockets that connect a parent
|
7
|
+
# Shoes application with a child display server.
|
8
|
+
#
|
9
|
+
# The class including this module should also include Shoes::Log so that it can
|
10
|
+
# be used.
|
11
|
+
module WVRelayUtil
|
12
|
+
# Checks whether the internal socket is ready to be read from.
|
13
|
+
# If timeout is greater than 0, this will block for up to that long.
|
14
|
+
#
|
15
|
+
# @param timeout [Float] the longest to wait for more input to read
|
16
|
+
# @return [Boolean] whether the socket has data ready for reading
|
17
|
+
def ready_to_read?(timeout = 0.0)
|
18
|
+
r, _, e = IO.select [@from], [], [@from, @to].uniq, timeout
|
19
|
+
|
20
|
+
# On timeout, select returns nil instead of arrays.
|
21
|
+
return if r.nil?
|
22
|
+
|
23
|
+
unless e.empty?
|
24
|
+
raise Scarpe::ConnectionError, "#{@i_am}: Got error on connection(s) from IO.select! Dying!"
|
25
|
+
end
|
26
|
+
|
27
|
+
!r.empty?
|
28
|
+
end
|
29
|
+
|
30
|
+
# Send bytes on the internal socket to the opposite side.
|
31
|
+
#
|
32
|
+
# @param contents [String] data to send
|
33
|
+
# @return [void]
|
34
|
+
def send_datagram(contents)
|
35
|
+
str_data = JSON.dump contents
|
36
|
+
dgram_str = (str_data.length.to_s + "a" + str_data).encode(Encoding::BINARY)
|
37
|
+
to_write = dgram_str.bytesize
|
38
|
+
written = 0
|
39
|
+
|
40
|
+
until written == to_write
|
41
|
+
count = @to.write(dgram_str.byteslice(written..-1))
|
42
|
+
if count.nil? || count == 0
|
43
|
+
raise Scarpe::DatagramSendError, "Something was wrong in send_datagram! Write returned #{count.inspect}!"
|
44
|
+
end
|
45
|
+
|
46
|
+
written += count
|
47
|
+
end
|
48
|
+
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
# Read data from the internal socket. Read until a whole datagram
|
53
|
+
# has been received and then return it.
|
54
|
+
#
|
55
|
+
# @return [String] the received datagram
|
56
|
+
def receive_datagram
|
57
|
+
@readbuf ||= String.new.encode(Encoding::BINARY)
|
58
|
+
to_read = nil
|
59
|
+
|
60
|
+
loop do
|
61
|
+
# Have we read a packet length already, sitting in @readbuf?
|
62
|
+
a_idx = @readbuf.index("a")
|
63
|
+
if a_idx
|
64
|
+
to_read = @readbuf[0..a_idx].to_i
|
65
|
+
@readbuf = @readbuf[(a_idx + 1)..-1]
|
66
|
+
break
|
67
|
+
end
|
68
|
+
|
69
|
+
# If not, read more bytes
|
70
|
+
new_bytes = @from.read(10)
|
71
|
+
if new_bytes.nil?
|
72
|
+
# This is perfectly normal, if the connection closed
|
73
|
+
raise Scarpe::AppShutdownError, "Got an unexpected EOF reading datagram! " +
|
74
|
+
"Did the #{@i_am == :child ? "parent" : "child"} process die?"
|
75
|
+
end
|
76
|
+
@readbuf << new_bytes
|
77
|
+
end
|
78
|
+
|
79
|
+
loop do
|
80
|
+
if @readbuf.bytesize >= to_read
|
81
|
+
out = @readbuf.byteslice(0, to_read)
|
82
|
+
@readbuf = @readbuf.byteslice(to_read, -1)
|
83
|
+
return out
|
84
|
+
end
|
85
|
+
|
86
|
+
new_bytes = @from.read(to_read - @readbuf.bytesize)
|
87
|
+
@readbuf << new_bytes
|
88
|
+
end
|
89
|
+
rescue
|
90
|
+
raise Scarpe::AppShutdownError, "Got exception #{$!.class} when receiving datagram... #{$!.inspect}"
|
91
|
+
end
|
92
|
+
|
93
|
+
# Read a datagram from the internal buffer and then dispatch it to the
|
94
|
+
# appropriate handler.
|
95
|
+
def respond_to_datagram
|
96
|
+
message = receive_datagram
|
97
|
+
m_data = JSON.parse(message)
|
98
|
+
|
99
|
+
if m_data["type"] == "event"
|
100
|
+
kwargs_hash = {}
|
101
|
+
m_data["kwargs"].each { |k, v| kwargs_hash[k.to_sym] = v }
|
102
|
+
send_shoes_event(
|
103
|
+
*m_data["args"],
|
104
|
+
event_name: m_data["kwargs"]["event_name"],
|
105
|
+
target: m_data["kwargs"]["event_target"],
|
106
|
+
**kwargs_hash,
|
107
|
+
)
|
108
|
+
elsif m_data["type"] == "create"
|
109
|
+
raise Scarpe::InvalidOperationError, "Parent process should never receive :create datagram!" if @i_am == :parent
|
110
|
+
|
111
|
+
@wv_display.create_display_drawable_for(m_data["class_name"], m_data["id"], m_data["properties"])
|
112
|
+
elsif m_data["type"] == "destroy"
|
113
|
+
if @i_am == :parent
|
114
|
+
@shutdown = true
|
115
|
+
else
|
116
|
+
@log.info("Shutting down...")
|
117
|
+
exit 0
|
118
|
+
end
|
119
|
+
else
|
120
|
+
@log.error("Unrecognized datagram type:event: #{m_data.inspect}!")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Loop for up to `t` seconds, reading data and waiting.
|
125
|
+
#
|
126
|
+
# @param t [Float] the number of seconds to loop for
|
127
|
+
def event_loop_for(t = 1.5)
|
128
|
+
t_start = Time.now
|
129
|
+
delay_time = t
|
130
|
+
|
131
|
+
while Time.now - t_start < delay_time
|
132
|
+
if ready_to_read?(0.1)
|
133
|
+
respond_to_datagram
|
134
|
+
else
|
135
|
+
sleep 0.1
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -7,9 +7,12 @@ require "socket"
|
|
7
7
|
SCARPE_DIR = File.join(__dir__, "../..")
|
8
8
|
|
9
9
|
$LOAD_PATH.prepend(SCARPE_DIR)
|
10
|
+
ENV["SCARPE_DISPLAY_SERVICE"] = "wv_local"
|
10
11
|
require "scarpe"
|
11
12
|
require "scarpe/wv_local"
|
12
13
|
|
14
|
+
require_relative "webview_relay_util"
|
15
|
+
|
13
16
|
# This script exists to create a WebviewDisplayService that can be operated remotely over a socket.
|
14
17
|
|
15
18
|
if ARGV.length != 1
|
@@ -17,19 +20,29 @@ if ARGV.length != 1
|
|
17
20
|
exit(-1)
|
18
21
|
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
# This is the implementation of a freestanding Scarpe Webview display server,
|
24
|
+
# which connects via sockets and sends events and properties back and forth
|
25
|
+
# with a display-less Shoes app. The interface is designed to allow fork-based
|
26
|
+
# usage, where a parent process could create a paired sockets and start the
|
27
|
+
# child server. It can also be used via TCP sockets or similar, where a single
|
28
|
+
# socket is both input and output.
|
29
|
+
class Scarpe::Webview::ContainedService < Shoes::Linkable
|
30
|
+
include Shoes::Log
|
31
|
+
include Scarpe::WVRelayUtil # Needs Shoes::Log
|
23
32
|
|
24
33
|
attr_reader :log
|
25
34
|
|
35
|
+
# Create a new DisplayService.
|
36
|
+
#
|
37
|
+
# @param from [Socket] a readable socket to get input from the Shoes process
|
38
|
+
# @param to [Socket] a writable socket on which to send output to the Shoes process
|
26
39
|
def initialize(from, to)
|
27
40
|
super()
|
28
|
-
log_init("
|
41
|
+
log_init("Webview::DisplayWorker")
|
29
42
|
|
30
43
|
@i_am = :child
|
31
44
|
@event_subs = []
|
32
|
-
@wv_display = Scarpe::
|
45
|
+
@wv_display = Scarpe::Webview::DisplayService.new
|
33
46
|
|
34
47
|
@from = from
|
35
48
|
@to = to
|
@@ -60,6 +73,6 @@ end
|
|
60
73
|
|
61
74
|
s = TCPSocket.new("localhost", ARGV[0].to_i)
|
62
75
|
|
63
|
-
SERVICE =
|
76
|
+
SERVICE = Scarpe::Webview::ContainedService.new(s, s)
|
64
77
|
|
65
78
|
SERVICE.log.info("Finished event loop. Exiting!")
|
data/lib/scarpe/wv.rb
CHANGED
@@ -2,38 +2,100 @@
|
|
2
2
|
|
3
3
|
# Scarpe Webview Display Services
|
4
4
|
|
5
|
+
# This file is for everything that should be included by *both* wv_local and wv_relay
|
6
|
+
|
7
|
+
require "securerandom"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
require "bloops"
|
11
|
+
require "scarpe/components/html" # HTML renderer
|
12
|
+
require "scarpe/components/modular_logger"
|
13
|
+
require "scarpe/components/promises"
|
14
|
+
require "scarpe/components/string_helpers"
|
15
|
+
|
16
|
+
# Module to contain the various Scarpe Webview classes
|
17
|
+
module Scarpe::Webview
|
18
|
+
HTML = Scarpe::Components::HTML
|
19
|
+
end
|
20
|
+
|
21
|
+
# Set up Scarpe-Webview's HTML renderer
|
22
|
+
ren = ENV["SCARPE_HTML_RENDERER"] || "calzini"
|
23
|
+
# This should *not* be require_relative so that other gems can implement HTML renderers.
|
24
|
+
require "scarpe/components/#{ren}"
|
25
|
+
class Scarpe::Webview::Drawable < Shoes::Linkable
|
26
|
+
# By default it's Scarpe::Components::Calzini
|
27
|
+
comp = Scarpe::Components::StringHelpers.camelize(ENV["SCARPE_HTML_RENDERER"] || "calzini")
|
28
|
+
mod = Scarpe::Components.const_get(comp)
|
29
|
+
include mod
|
30
|
+
end
|
31
|
+
|
32
|
+
# Set up hierarchical logging using the SCARPE_LOG_CONFIG var for configuration
|
33
|
+
log_config = if ENV["SCARPE_LOG_CONFIG"]
|
34
|
+
JSON.load_file(ENV["SCARPE_LOG_CONFIG"])
|
35
|
+
else
|
36
|
+
ENV["SCARPE_DEBUG"] ? Shoes::Log::DEFAULT_DEBUG_LOG_CONFIG : Shoes::Log::DEFAULT_LOG_CONFIG
|
37
|
+
end
|
38
|
+
|
39
|
+
Shoes::Log.instance = Scarpe::Components::ModularLogImpl.new
|
40
|
+
Shoes::Log.configure_logger(log_config)
|
41
|
+
|
42
|
+
require "scarpe/components/segmented_file_loader"
|
43
|
+
loader = Scarpe::Components::SegmentedFileLoader.new
|
44
|
+
Shoes.add_file_loader loader
|
45
|
+
|
46
|
+
# Fun trivia: listing the full set of available fonts is a fingerprinting attack, so it's not
|
47
|
+
# available from JS. These are all commonly available web fonts, though.
|
48
|
+
Shoes::FONTS.push(
|
49
|
+
"Helvetica",
|
50
|
+
"Arial",
|
51
|
+
"Arial Black",
|
52
|
+
"Verdana",
|
53
|
+
"Tahoma",
|
54
|
+
"Trebuchet MS",
|
55
|
+
"Impact",
|
56
|
+
"Gill Sans",
|
57
|
+
"Times New Roman",
|
58
|
+
"Georgia",
|
59
|
+
"Palatino",
|
60
|
+
"Baskerville",
|
61
|
+
"Courier",
|
62
|
+
"Lucida",
|
63
|
+
"Monaco",
|
64
|
+
)
|
65
|
+
|
66
|
+
require_relative "shoes_spec"
|
67
|
+
Shoes::Spec.instance = Scarpe::Test
|
68
|
+
|
5
69
|
require_relative "wv/web_wrangler"
|
6
70
|
require_relative "wv/control_interface"
|
7
71
|
|
8
|
-
require_relative "wv/
|
9
|
-
require_relative "wv/webview_local_display"
|
10
|
-
require_relative "wv/webview_relay_display"
|
72
|
+
require_relative "wv/drawable"
|
11
73
|
|
12
|
-
require_relative "wv/dimensions"
|
13
|
-
require_relative "wv/html"
|
14
|
-
|
15
|
-
require_relative "wv/spacing"
|
16
74
|
require_relative "wv/star"
|
17
|
-
require_relative "wv/
|
18
|
-
require_relative "wv/border"
|
75
|
+
require_relative "wv/radio"
|
19
76
|
|
20
|
-
require_relative "wv/fill"
|
21
77
|
require_relative "wv/arc"
|
22
78
|
|
23
79
|
require_relative "wv/app"
|
24
|
-
require_relative "wv/document_root"
|
25
80
|
require_relative "wv/para"
|
81
|
+
require_relative "wv/slot"
|
26
82
|
require_relative "wv/stack"
|
27
83
|
require_relative "wv/flow"
|
84
|
+
require_relative "wv/document_root"
|
85
|
+
require_relative "wv/subscription_item"
|
28
86
|
require_relative "wv/button"
|
29
87
|
require_relative "wv/image"
|
30
88
|
require_relative "wv/edit_box"
|
31
89
|
require_relative "wv/edit_line"
|
32
90
|
require_relative "wv/list_box"
|
33
|
-
require_relative "wv/alert"
|
34
|
-
require_relative "wv/span"
|
35
91
|
require_relative "wv/shape"
|
36
92
|
|
37
|
-
require_relative "wv/
|
93
|
+
require_relative "wv/text_drawable"
|
94
|
+
require_relative "wv/span"
|
38
95
|
require_relative "wv/link"
|
39
96
|
require_relative "wv/line"
|
97
|
+
require_relative "wv/rect"
|
98
|
+
require_relative "wv/video"
|
99
|
+
require_relative "wv/check"
|
100
|
+
require_relative "wv/progress"
|
101
|
+
require_relative "wv/arrow"
|
data/lib/scarpe/wv_local.rb
CHANGED
data/lib/scarpe/wv_relay.rb
CHANGED