whirled_peas 0.6.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +30 -1
- data/README.md +710 -136
- data/Rakefile +3 -32
- data/bin/easing +33 -0
- data/bin/reset_cursor +11 -0
- data/bin/screen_test +68 -0
- data/examples/graph.rb +54 -0
- data/examples/intro.rb +3 -3
- data/examples/scrolling.rb +5 -4
- data/lib/whirled_peas.rb +2 -4
- data/lib/whirled_peas/animator.rb +5 -0
- data/lib/whirled_peas/animator/debug_consumer.rb +17 -0
- data/lib/whirled_peas/animator/easing.rb +72 -0
- data/lib/whirled_peas/animator/frame.rb +5 -0
- data/lib/whirled_peas/animator/frameset.rb +33 -0
- data/lib/whirled_peas/animator/producer.rb +35 -0
- data/lib/whirled_peas/animator/renderer_consumer.rb +31 -0
- data/lib/whirled_peas/command.rb +5 -0
- data/lib/whirled_peas/command/base.rb +86 -0
- data/lib/whirled_peas/command/config_command.rb +44 -0
- data/lib/whirled_peas/command/debug.rb +21 -0
- data/lib/whirled_peas/command/fonts.rb +22 -0
- data/lib/whirled_peas/command/frame_command.rb +34 -0
- data/lib/whirled_peas/command/frames.rb +24 -0
- data/lib/whirled_peas/command/help.rb +38 -0
- data/lib/whirled_peas/command/play.rb +108 -0
- data/lib/whirled_peas/command/record.rb +57 -0
- data/lib/whirled_peas/command/still.rb +29 -0
- data/lib/whirled_peas/command_line.rb +22 -212
- data/lib/whirled_peas/config.rb +56 -6
- data/lib/whirled_peas/device.rb +5 -0
- data/lib/whirled_peas/device/null_device.rb +8 -0
- data/lib/whirled_peas/device/output_file.rb +19 -0
- data/lib/whirled_peas/device/screen.rb +26 -0
- data/lib/whirled_peas/graphics.rb +14 -0
- data/lib/whirled_peas/graphics/box_painter.rb +39 -46
- data/lib/whirled_peas/graphics/canvas.rb +22 -11
- data/lib/whirled_peas/graphics/composer.rb +18 -0
- data/lib/whirled_peas/graphics/container_coords.rb +6 -5
- data/lib/whirled_peas/graphics/container_dimensions.rb +26 -8
- data/lib/whirled_peas/graphics/container_painter.rb +133 -4
- data/lib/whirled_peas/graphics/content_dimensions.rb +19 -0
- data/lib/whirled_peas/graphics/content_painter.rb +20 -0
- data/lib/whirled_peas/graphics/graph_dimensions.rb +12 -0
- data/lib/whirled_peas/graphics/graph_painter.rb +97 -0
- data/lib/whirled_peas/graphics/grid_painter.rb +12 -14
- data/lib/whirled_peas/graphics/painter.rb +15 -1
- data/lib/whirled_peas/graphics/renderer.rb +13 -2
- data/lib/whirled_peas/graphics/text_painter.rb +9 -13
- data/lib/whirled_peas/settings/alignment.rb +24 -0
- data/lib/whirled_peas/settings/bg_color.rb +2 -0
- data/lib/whirled_peas/settings/border.rb +16 -16
- data/lib/whirled_peas/settings/color.rb +13 -14
- data/lib/whirled_peas/settings/container_settings.rb +126 -44
- data/lib/whirled_peas/settings/display_flow.rb +13 -11
- data/lib/whirled_peas/settings/element_settings.rb +8 -3
- data/lib/whirled_peas/settings/graph_settings.rb +21 -0
- data/lib/whirled_peas/settings/grid_settings.rb +12 -1
- data/lib/whirled_peas/settings/sizing.rb +19 -0
- data/lib/whirled_peas/settings/spacing.rb +34 -0
- data/lib/whirled_peas/settings/text_color.rb +2 -0
- data/lib/whirled_peas/settings/vert_alignment.rb +24 -0
- data/lib/whirled_peas/utils/ansi.rb +13 -0
- data/lib/whirled_peas/utils/file_handler.rb +57 -0
- data/lib/whirled_peas/utils/title_font.rb +1 -1
- data/lib/whirled_peas/version.rb +1 -1
- data/screen_test/{rendered/elements → elements}/box.frame +1 -1
- data/screen_test/{rendered/elements → elements}/box.rb +0 -0
- data/screen_test/elements/graph.frame +1 -0
- data/screen_test/elements/graph.rb +12 -0
- data/screen_test/elements/grid.frame +1 -0
- data/screen_test/{rendered/elements → elements}/grid.rb +0 -0
- data/screen_test/elements/screen_overflow_x.frame +1 -0
- data/screen_test/{rendered/elements/screen_overflow.rb → elements/screen_overflow_x.rb} +0 -0
- data/screen_test/elements/screen_overflow_y.frame +1 -0
- data/screen_test/elements/screen_overflow_y.rb +9 -0
- data/screen_test/elements/text.frame +1 -0
- data/screen_test/{rendered/elements → elements}/text.rb +0 -0
- data/screen_test/elements/text_multiline.frame +1 -0
- data/screen_test/{rendered/elements → elements}/text_multiline.rb +0 -0
- data/screen_test/settings/align/box_around.frame +1 -0
- data/screen_test/settings/align/box_around.rb +16 -0
- data/screen_test/settings/align/box_between.frame +1 -0
- data/screen_test/settings/align/box_between.rb +16 -0
- data/screen_test/settings/align/box_center.frame +1 -0
- data/screen_test/{rendered/settings/align/grid.rb → settings/align/box_center.rb} +7 -6
- data/screen_test/settings/align/box_default.frame +1 -0
- data/screen_test/settings/align/box_default.rb +20 -0
- data/screen_test/settings/align/box_evenly.frame +1 -0
- data/screen_test/settings/align/box_evenly.rb +16 -0
- data/screen_test/settings/align/box_left.frame +1 -0
- data/screen_test/settings/align/box_left.rb +21 -0
- data/screen_test/settings/align/box_right.frame +1 -0
- data/screen_test/settings/align/box_right.rb +21 -0
- data/screen_test/settings/align/children_center.frame +1 -0
- data/screen_test/settings/align/children_center.rb +15 -0
- data/screen_test/settings/align/children_left.frame +1 -0
- data/screen_test/settings/align/children_left.rb +15 -0
- data/screen_test/settings/align/children_right.frame +1 -0
- data/screen_test/settings/align/children_right.rb +15 -0
- data/screen_test/settings/align/grid_center.frame +1 -0
- data/screen_test/settings/align/grid_center.rb +18 -0
- data/screen_test/settings/align/grid_default.frame +1 -0
- data/screen_test/settings/align/grid_default.rb +17 -0
- data/screen_test/settings/align/grid_left.frame +1 -0
- data/screen_test/settings/align/grid_left.rb +18 -0
- data/screen_test/settings/align/grid_right.frame +1 -0
- data/screen_test/settings/align/grid_right.rb +18 -0
- data/screen_test/settings/ansi/bold.frame +1 -0
- data/screen_test/{rendered/settings/height/overflow_box_t2b.rb → settings/ansi/bold.rb} +4 -4
- data/screen_test/{rendered/settings → settings}/ansi/color.frame +1 -1
- data/screen_test/{rendered/settings → settings}/ansi/color.rb +0 -0
- data/screen_test/settings/ansi/underline.frame +1 -0
- data/screen_test/{rendered/settings → settings}/ansi/underline.rb +4 -5
- data/screen_test/{rendered/settings → settings}/border.frame +1 -1
- data/screen_test/{rendered/settings → settings}/border.rb +1 -1
- data/screen_test/settings/flow/box_b2t.frame +1 -0
- data/screen_test/settings/flow/box_b2t.rb +26 -0
- data/screen_test/settings/flow/box_l2r.frame +1 -0
- data/screen_test/settings/flow/box_l2r.rb +26 -0
- data/screen_test/settings/flow/box_r2l.frame +1 -0
- data/screen_test/settings/flow/box_r2l.rb +26 -0
- data/screen_test/settings/flow/box_t2b.frame +1 -0
- data/screen_test/settings/flow/box_t2b.rb +26 -0
- data/screen_test/settings/flow/grid_b2t.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_b2t.rb +1 -1
- data/screen_test/settings/flow/grid_l2r.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_l2r.rb +1 -1
- data/screen_test/settings/flow/grid_r2l.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_r2l.rb +1 -1
- data/screen_test/settings/flow/grid_t2b.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_t2b.rb +1 -1
- data/screen_test/settings/height/box.frame +1 -0
- data/screen_test/{rendered/settings → settings}/height/box.rb +0 -0
- data/screen_test/settings/height/box_border_sizing.frame +1 -0
- data/screen_test/settings/height/box_border_sizing.rb +15 -0
- data/screen_test/settings/height/grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/height/grid.rb +0 -0
- data/screen_test/settings/height/overflow_box.frame +1 -0
- data/screen_test/settings/height/overflow_box.rb +13 -0
- data/screen_test/settings/height/overflow_box_l2r.frame +1 -0
- data/screen_test/settings/height/overflow_box_l2r.rb +17 -0
- data/screen_test/settings/height/overflow_box_t2b.frame +1 -0
- data/screen_test/settings/height/overflow_box_t2b.rb +16 -0
- data/screen_test/settings/height/overflow_grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/height/overflow_grid.rb +0 -0
- data/screen_test/settings/margin.frame +1 -0
- data/screen_test/settings/margin.rb +16 -0
- data/screen_test/settings/padding.frame +1 -0
- data/screen_test/settings/padding.rb +13 -0
- data/screen_test/settings/position/box_left.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_left.rb +2 -2
- data/screen_test/settings/position/box_left_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_left_negative.rb +2 -2
- data/screen_test/settings/position/box_top.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_top.rb +1 -1
- data/screen_test/settings/position/box_top_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_top_negative.rb +2 -2
- data/screen_test/settings/position/grid_left.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_left.rb +1 -1
- data/screen_test/settings/position/grid_left_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_left_negative.rb +1 -1
- data/screen_test/settings/position/grid_top.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_top.rb +1 -1
- data/screen_test/settings/position/grid_top_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_top_negative.rb +1 -1
- data/screen_test/settings/scroll/horiz_box.frame +1 -0
- data/screen_test/settings/scroll/horiz_box.rb +17 -0
- data/screen_test/settings/scroll/horiz_box_align_center.rb +18 -0
- data/screen_test/settings/scroll/horiz_box_align_right.rb +18 -0
- data/screen_test/settings/scroll/vert_box.frame +1 -0
- data/screen_test/settings/scroll/vert_box.rb +20 -0
- data/screen_test/settings/title_font.frame +1 -0
- data/screen_test/{rendered/settings → settings}/title_font.rb +1 -1
- data/screen_test/settings/valign/box_around.frame +1 -0
- data/screen_test/settings/valign/box_around.rb +17 -0
- data/screen_test/settings/valign/box_between.frame +1 -0
- data/screen_test/settings/valign/box_between.rb +17 -0
- data/screen_test/settings/valign/box_bottom.frame +1 -0
- data/screen_test/settings/valign/box_bottom.rb +17 -0
- data/screen_test/settings/valign/box_default.frame +1 -0
- data/screen_test/settings/valign/box_default.rb +16 -0
- data/screen_test/settings/valign/box_evenly.frame +1 -0
- data/screen_test/settings/valign/box_evenly.rb +17 -0
- data/screen_test/settings/valign/box_middle.frame +1 -0
- data/screen_test/settings/valign/box_middle.rb +17 -0
- data/screen_test/settings/valign/box_top.frame +1 -0
- data/screen_test/settings/valign/box_top.rb +17 -0
- data/screen_test/settings/valign/grid_bottom.frame +1 -0
- data/screen_test/settings/valign/grid_bottom.rb +15 -0
- data/screen_test/settings/valign/grid_default.frame +1 -0
- data/screen_test/settings/valign/grid_default.rb +14 -0
- data/screen_test/settings/valign/grid_middle.frame +1 -0
- data/screen_test/settings/valign/grid_middle.rb +15 -0
- data/screen_test/settings/valign/grid_top.frame +1 -0
- data/screen_test/settings/valign/grid_top.rb +15 -0
- data/screen_test/settings/width/box_border_sizing.frame +1 -0
- data/screen_test/settings/width/box_border_sizing.rb +15 -0
- data/screen_test/settings/width/box_content.frame +1 -0
- data/screen_test/settings/width/box_content.rb +15 -0
- data/screen_test/settings/width/box_default.frame +1 -0
- data/screen_test/{rendered/settings/width/box.rb → settings/width/box_default.rb} +3 -2
- data/screen_test/settings/width/grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/width/grid.rb +2 -2
- data/screen_test/settings/width/overflow_align_center.frame +1 -0
- data/screen_test/settings/width/overflow_align_center.rb +14 -0
- data/screen_test/settings/width/overflow_align_right.frame +1 -0
- data/screen_test/settings/width/overflow_align_right.rb +14 -0
- data/screen_test/settings/width/overflow_box.frame +1 -0
- data/screen_test/settings/width/overflow_box.rb +13 -0
- data/screen_test/settings/width/overflow_box_l2r.frame +1 -0
- data/screen_test/settings/width/overflow_box_l2r.rb +16 -0
- data/screen_test/settings/width/overflow_box_t2b.frame +1 -0
- data/screen_test/settings/width/overflow_box_t2b.rb +17 -0
- data/screen_test/settings/width/overflow_grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/width/overflow_grid.rb +0 -0
- data/tools/whirled_peas/tools/screen_tester.rb +285 -0
- metadata +188 -105
- data/lib/whirled_peas/frame.rb +0 -6
- data/lib/whirled_peas/frame/consumer.rb +0 -30
- data/lib/whirled_peas/frame/debug_consumer.rb +0 -30
- data/lib/whirled_peas/frame/event_loop.rb +0 -90
- data/lib/whirled_peas/frame/producer.rb +0 -67
- data/lib/whirled_peas/graphics/screen.rb +0 -70
- data/lib/whirled_peas/graphics/text_dimensions.rb +0 -15
- data/lib/whirled_peas/settings/text_align.rb +0 -19
- data/screen_test/rendered/elements/grid.frame +0 -1
- data/screen_test/rendered/elements/screen_overflow.frame +0 -1
- data/screen_test/rendered/elements/text.frame +0 -1
- data/screen_test/rendered/elements/text_multiline.frame +0 -1
- data/screen_test/rendered/settings/align/box.frame +0 -1
- data/screen_test/rendered/settings/align/box.rb +0 -24
- data/screen_test/rendered/settings/align/children_center.frame +0 -1
- data/screen_test/rendered/settings/align/children_center.rb +0 -13
- data/screen_test/rendered/settings/align/children_left.frame +0 -1
- data/screen_test/rendered/settings/align/children_left.rb +0 -13
- data/screen_test/rendered/settings/align/children_right.frame +0 -1
- data/screen_test/rendered/settings/align/children_right.rb +0 -13
- data/screen_test/rendered/settings/align/grid.frame +0 -1
- data/screen_test/rendered/settings/ansi/bold.frame +0 -1
- data/screen_test/rendered/settings/ansi/bold.rb +0 -15
- data/screen_test/rendered/settings/ansi/underline.frame +0 -1
- data/screen_test/rendered/settings/flow/box_b2t.frame +0 -1
- data/screen_test/rendered/settings/flow/box_b2t.rb +0 -24
- data/screen_test/rendered/settings/flow/box_l2r.frame +0 -1
- data/screen_test/rendered/settings/flow/box_l2r.rb +0 -24
- data/screen_test/rendered/settings/flow/box_r2l.frame +0 -1
- data/screen_test/rendered/settings/flow/box_r2l.rb +0 -24
- data/screen_test/rendered/settings/flow/box_t2b.frame +0 -1
- data/screen_test/rendered/settings/flow/box_t2b.rb +0 -24
- data/screen_test/rendered/settings/flow/grid_b2t.frame +0 -1
- data/screen_test/rendered/settings/flow/grid_l2r.frame +0 -1
- data/screen_test/rendered/settings/flow/grid_r2l.frame +0 -1
- data/screen_test/rendered/settings/flow/grid_t2b.frame +0 -1
- data/screen_test/rendered/settings/height/box.frame +0 -1
- data/screen_test/rendered/settings/height/grid.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_box.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_box.rb +0 -13
- data/screen_test/rendered/settings/height/overflow_box_l2r.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_box_l2r.rb +0 -15
- data/screen_test/rendered/settings/height/overflow_box_t2b.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_grid.frame +0 -1
- data/screen_test/rendered/settings/margin.frame +0 -1
- data/screen_test/rendered/settings/margin.rb +0 -14
- data/screen_test/rendered/settings/padding.frame +0 -1
- data/screen_test/rendered/settings/padding.rb +0 -11
- data/screen_test/rendered/settings/position/box_left.frame +0 -1
- data/screen_test/rendered/settings/position/box_left_negative.frame +0 -1
- data/screen_test/rendered/settings/position/box_top.frame +0 -1
- data/screen_test/rendered/settings/position/box_top_negative.frame +0 -1
- data/screen_test/rendered/settings/position/grid_left.frame +0 -1
- data/screen_test/rendered/settings/position/grid_left_negative.frame +0 -1
- data/screen_test/rendered/settings/position/grid_top.frame +0 -1
- data/screen_test/rendered/settings/position/grid_top_negative.frame +0 -1
- data/screen_test/rendered/settings/scroll/horiz_box.frame +0 -1
- data/screen_test/rendered/settings/scroll/horiz_box.rb +0 -15
- data/screen_test/rendered/settings/scroll/vert_box.frame +0 -1
- data/screen_test/rendered/settings/scroll/vert_box.rb +0 -18
- data/screen_test/rendered/settings/title_font.frame +0 -1
- data/screen_test/rendered/settings/width/box.frame +0 -1
- data/screen_test/rendered/settings/width/grid.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box.rb +0 -11
- data/screen_test/rendered/settings/width/overflow_box_l2r.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box_l2r.rb +0 -14
- data/screen_test/rendered/settings/width/overflow_box_t2b.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box_t2b.rb +0 -15
- data/screen_test/rendered/settings/width/overflow_grid.frame +0 -1
- data/screen_test/screen_tester.rb +0 -201
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 424038cc2fb2f4b48edb6e43219f515eb5564f7e78871506d63ea1bbbc724ff9
|
4
|
+
data.tar.gz: 6f35ac5a2d32f3a37a6876e0b2b7022d9c0f07a1f71eb1f3d628def4840926e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bf7a9b822e06e095fed812f5408358dd6562e604fa5da7c4e91a8cfcf9f96f081b9f33198767e0221563b2f2304a70e38e637c10830c16664440d46346cef6f
|
7
|
+
data.tar.gz: 7f402bf1c932d58893df06874f314216b053fdf2019704a13e317d5b0512e20558b0019eafb5d5c7796975e45e6ddc01fc3a0fd70e1c9179485de60f527dc422
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,35 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## v0.
|
3
|
+
## v0.9.1 - 2021-01-29
|
4
|
+
|
5
|
+
- [c35b134](https://github.com/tcollier/whirled_peas/tree/c35b134e1340b8b5f1d1fb0e6e56dc2a99b52e94): Improve graph plots
|
6
|
+
|
7
|
+
## v0.9.0 - 2021-01-29
|
8
|
+
|
9
|
+
BREAKING: `Frameset#add_frame` signature changed
|
10
|
+
|
11
|
+
- [1c28947](https://github.com/tcollier/whirled_peas/tree/1c28947980eedce034d2596732ee4860717904c5): Add graph support
|
12
|
+
|
13
|
+
## v0.8.0 - 2021-01-29
|
14
|
+
|
15
|
+
BREAKING: `Producer` now responds to `#add_frame` instead of `#send_frame`
|
16
|
+
|
17
|
+
- [67fdc17](https://github.com/tcollier/whirled_peas/tree/67fdc172434cb97f31ca20a674f28aefec6babb3): Add easing functions for frame transitions
|
18
|
+
- [b888f2e](https://github.com/tcollier/whirled_peas/tree/b888f2e7a3b7c3341300326b417641cc8cf2e89b): Add record and playback functionality to command line tool
|
19
|
+
|
20
|
+
## v0.7.1 - 2021-01-27
|
21
|
+
|
22
|
+
- [b98781d](https://github.com/tcollier/whirled_peas/tree/b98781de23a24b596955f25cfc48936c0cc1efac): Fix num_cols bug for vertical grid flow
|
23
|
+
|
24
|
+
## v0.7.0 - 2021-01-27
|
25
|
+
|
26
|
+
BREAKING: the settings for the template now fills the full screen and disallows margin.
|
27
|
+
|
28
|
+
- [b7c12c2](https://github.com/tcollier/whirled_peas/tree/b7c12c2c34d7077b9c2496d05ddd0c6d1eb90699): Update template to fill full screen with border sizing
|
29
|
+
- [963b819](https://github.com/tcollier/whirled_peas/tree/963b8196f0d046ba03c893f07e5578bf8c88b7a3): Implement vertical alignment
|
30
|
+
- [4bddd54](https://github.com/tcollier/whirled_peas/tree/4bddd54bec5c8f93d145c285379c1816f313f35e): Add `between`, `around`, and `evenly` alignments
|
31
|
+
|
32
|
+
## v0.6.0 - 2021-01-25
|
4
33
|
|
5
34
|
- [73df2af](https://github.com/tcollier/whirled_peas/tree/73df2af1f1eac37fe94f720dce16da1ed568dade): Add support for scroll bars along both axes
|
6
35
|
- [f4f44e1](https://github.com/tcollier/whirled_peas/tree/f4f44e1ff6c75ed03cd682e3fa9921401dcd2d00): Implement remaining 3 flow directions for grids
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
╚══╝╚══╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝
|
19
19
|
```
|
20
20
|
|
21
|
-
Easily create terminal-based graphics to
|
21
|
+
Easily create terminal-based graphics to visualize the execution of your code. Whirled Peas offers templating inspired by HTML and CSS and provides a lightweight tie-in for your code to produce visual animations with these templates.
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -40,9 +40,8 @@ Or install it yourself as:
|
|
40
40
|
|
41
41
|
A Whirled Peas application consists of the following pieces
|
42
42
|
|
43
|
-
- The
|
44
|
-
- The main template factory (required) - builds templates to convert frame events from the
|
45
|
-
- A loading screen template factory (optional) - builds templates to display while content is loading
|
43
|
+
- The application (required) - the code that is to be visualized, it emits lightweight frame events through a producer
|
44
|
+
- The main template factory (required) - builds templates to convert frame events from the application into terminal graphics
|
46
45
|
|
47
46
|
These pieces are configured as following
|
48
47
|
|
@@ -62,15 +61,15 @@ class TemplateFactory
|
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
65
|
-
class
|
64
|
+
class Application
|
66
65
|
def start(producer)
|
67
|
-
producer.
|
66
|
+
producer.add_frame('starting', args: { name: 'World' })
|
68
67
|
# ...
|
69
68
|
end
|
70
69
|
end
|
71
70
|
|
72
71
|
WhirledPeas.configure do |config|
|
73
|
-
config.
|
72
|
+
config.application = Application.new
|
74
73
|
config.template_factory = TemplateFactory.new
|
75
74
|
end
|
76
75
|
```
|
@@ -78,34 +77,12 @@ end
|
|
78
77
|
Then the visualizer is started on the command line with
|
79
78
|
|
80
79
|
```
|
81
|
-
$ whirled_peas
|
80
|
+
$ whirled_peas play visualize.rb
|
82
81
|
```
|
83
82
|
|
84
|
-
|
83
|
+
### Application
|
85
84
|
|
86
|
-
|
87
|
-
class LoadingTemplateFactory
|
88
|
-
def build
|
89
|
-
WhirledPeas.template do |composer|
|
90
|
-
composer.add_box('Loading') do |_, settings|
|
91
|
-
settings.set_margin(top: 15)
|
92
|
-
settings.align = :center
|
93
|
-
settings.full_border(color: :blue, style: :double)
|
94
|
-
"Loading..."
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
WhirledPeas.configure do |config|
|
101
|
-
# ...
|
102
|
-
config.loading_template_factory = LoadingTemplateFactory.new
|
103
|
-
end
|
104
|
-
```
|
105
|
-
|
106
|
-
### Driver
|
107
|
-
|
108
|
-
The driver is the application code to be visualized. This is typically a lightweight wrapper around an existing application that conforms to the signature below.
|
85
|
+
The application is code to be visualized that integrates with Whirled Peas by providing the signature below
|
109
86
|
|
110
87
|
```ruby
|
111
88
|
# Start the application and pass frame events to the producer to be rendered by the UI
|
@@ -116,16 +93,33 @@ def start(producer)
|
|
116
93
|
end
|
117
94
|
```
|
118
95
|
|
119
|
-
The producer provides
|
96
|
+
The producer provides the following methods
|
120
97
|
|
121
98
|
```ruby
|
122
|
-
#
|
99
|
+
# Add a frame to be displayed
|
123
100
|
#
|
124
101
|
# @param name [String] application defined name for the frame. The template factory will be provided this name
|
125
102
|
# @param duration [Number] time in seconds this frame should be displayed for (defaults to 1 frame)
|
126
103
|
# @param args [Hash<Symbol, Object>] key value pairs to send as arguments to the template factory
|
127
|
-
def
|
128
|
-
|
104
|
+
def add_frame(name, duration:, args:)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Create and yield a frameset instance that allows applications to add multiple frames to play over the
|
108
|
+
# given duration. Adding frames to the yielded frameset will result in playback that is eased by the
|
109
|
+
# gvien `easing` and `effect` arguments (default is `:linear` easing)
|
110
|
+
def frameset(duration, easing:, effect:, &block)
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
114
|
+
A frameset instance provides one method
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
# Add a frame to be displayed, the duration will be determine by the number of frames in the frameset along
|
118
|
+
# with the duration and easing of the frameset
|
119
|
+
#
|
120
|
+
# @param name [String] application defined name for the frame. The template factory will be provided this name
|
121
|
+
# @param args [Hash<Symbol, Object>] key value pairs to send as arguments to the template factory
|
122
|
+
def add_frame(name, args:)
|
129
123
|
end
|
130
124
|
```
|
131
125
|
|
@@ -136,47 +130,49 @@ end
|
|
136
130
|
Simple application that loads a set of numbers and looks for a pair that adds up to 1,000
|
137
131
|
|
138
132
|
```ruby
|
139
|
-
class
|
133
|
+
class Application
|
140
134
|
def start(producer)
|
141
135
|
numbers = File.readlines('/path/to/numbers.txt').map(&:to_i)
|
142
|
-
producer.
|
136
|
+
producer.add_frame('load-numbers', duration: 3, args: { numbers: numbers })
|
143
137
|
numbers.sort!
|
144
|
-
producer.
|
138
|
+
producer.add_frame('sort-numbers', duration: 3, args: { numbers: numbers })
|
145
139
|
low = 0
|
146
140
|
high = numbers.length - 1
|
147
141
|
while low < high
|
148
142
|
sum = numbers[low] + numbers[high]
|
149
143
|
if sum == 1000
|
150
|
-
producer.
|
144
|
+
producer.add_frame('found-pair', duration: 5, args: { low: low, high: high, sum: sum })
|
151
145
|
return
|
152
146
|
elsif sum < 1000
|
153
|
-
producer.
|
147
|
+
producer.add_frame('too-low', args: { low: low, high: high, sum: sum })
|
154
148
|
low += 1
|
155
149
|
else
|
156
|
-
producer.
|
150
|
+
producer.add_frame('too-high', args: { low: low, high: high, sum: sum })
|
157
151
|
high -= 1
|
158
152
|
end
|
159
153
|
end
|
160
|
-
producer.
|
154
|
+
producer.add_frame('no-solution', duration: 5)
|
161
155
|
end
|
162
156
|
end
|
163
157
|
```
|
164
158
|
|
165
159
|
### Template Factory
|
166
160
|
|
167
|
-
To render the frame events sent by the
|
168
|
-
|
169
|
-
#### Loading Template Factory
|
170
|
-
|
171
|
-
`WhirledPeas.configure` takes an optional template factory to build a loading screen. This instance must implement `#build` (taking no arguments). The template returned by that method will be painted while the event loop is waiting for frames. The factory method will be called once per refresh cycle, so it's possible to implement animation.
|
161
|
+
To render the frame events sent by the application, the application requires a template factory. This factory will be called for each frame event, with the frame name and the arguments supplied by the application. A template factory can be an instance of ruby class and thus can maintain state. Whirled Peas provides a few basic building blocks to make simple, yet elegant terminal-based UIs.
|
172
162
|
|
173
163
|
#### Building Blocks
|
174
164
|
|
175
|
-
A template is created with `WhirledPeas.template`, which yields a `Composer` object for a `Box` and `BoxSettings`. The composer allows for attaching child elements and the settings for setting layout options.
|
165
|
+
A template is created with `WhirledPeas.template`, which yields a `Composer` object for a `Box` and `BoxSettings`. The composer allows for attaching child elements and the settings for setting layout options. The following attributes of the template's settings will be overridden before it is rendered to ensure that it fills the screen exactly
|
166
|
+
|
167
|
+
- `margin` - all margin will be set to 0
|
168
|
+
- `width` - will be set to the screen's width
|
169
|
+
- `height` - will be set to the screen's height
|
170
|
+
- `sizing` - will be set `:border` to ensure the entire box fits on the screen and fills it entirely.
|
176
171
|
|
177
172
|
A `Composer` provides the following methods to add child elements, each of these takes an optional string argument that is set as the name of the element (which can be useful when debugging).
|
178
173
|
|
179
174
|
- `add_box` - yields a `Composer` for a `Box` and a `BoxSettings`, which will be added to the parent's children
|
175
|
+
- `add_graph` - yields a `nil` and a `GraphSettings`, which will be added to the parent's children, the block should return an array of numbers
|
180
176
|
- `add_grid` - yields a `Composer` for a `Grid` and a `GridSettings`, which will be added to the parent's children
|
181
177
|
- `add_text` - yields `nil` and a `TextSettings`, which will be added to the parent's children
|
182
178
|
|
@@ -239,23 +235,212 @@ end
|
|
239
235
|
Each element type has an associated settings type, which provide a custom set of options to format the output. Child settings will inherit from the parent, where applicable
|
240
236
|
The available settigs are
|
241
237
|
|
242
|
-
| Setting | Description
|
243
|
-
| ------------ |
|
244
|
-
| `align` | Justifies the content
|
245
|
-
| `
|
246
|
-
| `
|
247
|
-
| `
|
248
|
-
| `
|
249
|
-
| `
|
250
|
-
| `
|
251
|
-
| `
|
252
|
-
| `
|
253
|
-
| `
|
254
|
-
| `
|
255
|
-
| `
|
256
|
-
| `
|
257
|
-
| `
|
258
|
-
| `
|
238
|
+
| Setting | Description | Default | Availability | Inherited |
|
239
|
+
| ------------ | -------------------------------------------------------------------------------- | ---------- | ------------ | -------------------- |
|
240
|
+
| `align` | Justifies the content in the horizontal direction | `:left` | `Container` | No |
|
241
|
+
| `axis_color` | Color used to paint the axes of the graph (see [Colors](#colors)) | | `Graph` | No |
|
242
|
+
| `bg_color` | Background color (see [Colors](#colors)) | | all | Yes |
|
243
|
+
| `bold` | `true` makes the font bold | `false` | all | Yes |
|
244
|
+
| `border` | Set the border for the lements | none | `Container`, | Only style and color |
|
245
|
+
| `color` | Foreground text color (see [Colors](#colors)) | | all | Yes |
|
246
|
+
| `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` | `Container` | No |
|
247
|
+
| `height` | Override the calculated height of an element's content area | | all | No |
|
248
|
+
| `margin` | Set the (left, top, right, bottom) margin of the element | `0` | `Container` | No |
|
249
|
+
| `num_cols` | Number of columns in the grid (must be set!) | | `Grid` | No |
|
250
|
+
| `padding` | Set the (left, top, right, bottom) padding of the element | `0` | `Container` | No |
|
251
|
+
| `position` | Set the (left, top) position of the element relative to parent content area | `0` | `Container` | No |
|
252
|
+
| `scrollbar` | Display a scroll bar for vertical or horizontal scrolling | | `Box` | No |
|
253
|
+
| `sizing` | Sizing model (`:content` or `:border`) used in conjunction with `width`/`height` | `:content` | `Box` | No |
|
254
|
+
| `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text` | No |
|
255
|
+
| `underline` | `true` underlines the font | `false` | all | Yes |
|
256
|
+
| `width` | Override the calculated width of an element's content area | | all | No |
|
257
|
+
| `valign` | Justifies the content in the vertical direction | `:top` | `Container` | No |
|
258
|
+
|
259
|
+
##### Alignment
|
260
|
+
|
261
|
+
The `align` setting takes one of several values
|
262
|
+
|
263
|
+
- `:left` - align content starting at the leftmost edge of the container's content area
|
264
|
+
|
265
|
+
```
|
266
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
267
|
+
┃[child 1][child 2][child 3] ┃
|
268
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
269
|
+
```
|
270
|
+
|
271
|
+
- `:right` - align content starting at the rightmost edge of the container's content area
|
272
|
+
|
273
|
+
```
|
274
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
275
|
+
┃ [child 1][child 2][child 3]┃
|
276
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
277
|
+
```
|
278
|
+
|
279
|
+
- `:center` - align content starting in the horizontal center of the container's content area
|
280
|
+
|
281
|
+
```
|
282
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
283
|
+
┃ [child 1][child 2][child 3] ┃
|
284
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
285
|
+
```
|
286
|
+
|
287
|
+
- `:between` - distribute children so there is equal space between children no space outside of the children
|
288
|
+
|
289
|
+
```
|
290
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
291
|
+
┃[child 1] [child 2] [child 3]┃
|
292
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
293
|
+
```
|
294
|
+
|
295
|
+
- `:around` - distribute children so that they have equal spacing around them, space between two children is twice the space between an edge and a child.
|
296
|
+
|
297
|
+
```
|
298
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
299
|
+
┃ [child 1] [child 2] [child 3] ┃
|
300
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
301
|
+
```
|
302
|
+
|
303
|
+
- `:evenly` - distribute children so there is even spacing between any two children (or space to the edge)
|
304
|
+
|
305
|
+
```
|
306
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
307
|
+
┃ [child 1] [child 2] [child 3] ┃
|
308
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
309
|
+
```
|
310
|
+
|
311
|
+
The `valign` setting takes one of several values
|
312
|
+
|
313
|
+
- `:top` - align content starting at the top of the container's content area
|
314
|
+
|
315
|
+
```
|
316
|
+
┏━━━━━━━━━┓
|
317
|
+
┃[child 1]┃
|
318
|
+
┃[child 2]┃
|
319
|
+
┃[child 3]┃
|
320
|
+
┃ ┃
|
321
|
+
┃ ┃
|
322
|
+
┃ ┃
|
323
|
+
┃ ┃
|
324
|
+
┃ ┃
|
325
|
+
┃ ┃
|
326
|
+
┃ ┃
|
327
|
+
┃ ┃
|
328
|
+
┃ ┃
|
329
|
+
┃ ┃
|
330
|
+
┃ ┃
|
331
|
+
┃ ┃
|
332
|
+
┗━━━━━━━━━┛
|
333
|
+
```
|
334
|
+
|
335
|
+
- `:bottom` - align content starting at the bottom of the container's content area
|
336
|
+
|
337
|
+
```
|
338
|
+
┏━━━━━━━━━┓
|
339
|
+
┃ ┃
|
340
|
+
┃ ┃
|
341
|
+
┃ ┃
|
342
|
+
┃ ┃
|
343
|
+
┃ ┃
|
344
|
+
┃ ┃
|
345
|
+
┃ ┃
|
346
|
+
┃ ┃
|
347
|
+
┃ ┃
|
348
|
+
┃ ┃
|
349
|
+
┃ ┃
|
350
|
+
┃ ┃
|
351
|
+
┃[child 1]┃
|
352
|
+
┃[child 2]┃
|
353
|
+
┃[child 3]┃
|
354
|
+
┗━━━━━━━━━┛
|
355
|
+
```
|
356
|
+
|
357
|
+
- `:middle` - align content starting in the vertical middle of the container's content area
|
358
|
+
|
359
|
+
```
|
360
|
+
┏━━━━━━━━━┓
|
361
|
+
┃ ┃
|
362
|
+
┃ ┃
|
363
|
+
┃ ┃
|
364
|
+
┃ ┃
|
365
|
+
┃ ┃
|
366
|
+
┃ ┃
|
367
|
+
┃[child 1]┃
|
368
|
+
┃[child 2]┃
|
369
|
+
┃[child 3]┃
|
370
|
+
┃ ┃
|
371
|
+
┃ ┃
|
372
|
+
┃ ┃
|
373
|
+
┃ ┃
|
374
|
+
┃ ┃
|
375
|
+
┃ ┃
|
376
|
+
┗━━━━━━━━━┛
|
377
|
+
```
|
378
|
+
|
379
|
+
- `:between` - distribute children so there is equal space between children no space outside of the children
|
380
|
+
|
381
|
+
```
|
382
|
+
┏━━━━━━━━━┓
|
383
|
+
┃[child 1]┃
|
384
|
+
┃ ┃
|
385
|
+
┃ ┃
|
386
|
+
┃ ┃
|
387
|
+
┃ ┃
|
388
|
+
┃ ┃
|
389
|
+
┃ ┃
|
390
|
+
┃[child 2]┃
|
391
|
+
┃ ┃
|
392
|
+
┃ ┃
|
393
|
+
┃ ┃
|
394
|
+
┃ ┃
|
395
|
+
┃ ┃
|
396
|
+
┃ ┃
|
397
|
+
┃[child 3]┃
|
398
|
+
┗━━━━━━━━━┛
|
399
|
+
```
|
400
|
+
|
401
|
+
- `:around` - distribute children so that they have equal spacing around them, space between two children is twice the space between an edge and a child.
|
402
|
+
|
403
|
+
```
|
404
|
+
┏━━━━━━━━━┓
|
405
|
+
┃ ┃
|
406
|
+
┃ ┃
|
407
|
+
┃[child 1]┃
|
408
|
+
┃ ┃
|
409
|
+
┃ ┃
|
410
|
+
┃ ┃
|
411
|
+
┃ ┃
|
412
|
+
┃[child 2]┃
|
413
|
+
┃ ┃
|
414
|
+
┃ ┃
|
415
|
+
┃ ┃
|
416
|
+
┃ ┃
|
417
|
+
┃[child 3]┃
|
418
|
+
┃ ┃
|
419
|
+
┃ ┃
|
420
|
+
┗━━━━━━━━━┛
|
421
|
+
```
|
422
|
+
|
423
|
+
- `:evenly` - distribute children so there is even spacing between any two children (or space to the edge)
|
424
|
+
|
425
|
+
```
|
426
|
+
┏━━━━━━━━━┓
|
427
|
+
┃ ┃
|
428
|
+
┃ ┃
|
429
|
+
┃ ┃
|
430
|
+
┃[child 1]┃
|
431
|
+
┃ ┃
|
432
|
+
┃ ┃
|
433
|
+
┃ ┃
|
434
|
+
┃[child 2]┃
|
435
|
+
┃ ┃
|
436
|
+
┃ ┃
|
437
|
+
┃ ┃
|
438
|
+
┃[child 3]┃
|
439
|
+
┃ ┃
|
440
|
+
┃ ┃
|
441
|
+
┃ ┃
|
442
|
+
┗━━━━━━━━━┛
|
443
|
+
```
|
259
444
|
|
260
445
|
##### Position
|
261
446
|
|
@@ -263,11 +448,56 @@ Position settings dictate the relative position from where the painter would hav
|
|
263
448
|
|
264
449
|
- `set_position(left:, top:)`
|
265
450
|
|
451
|
+
##### Sizing Model
|
452
|
+
|
453
|
+
The sizing model determines how to interpret the `width` and `height` settings. The default sizing model is `:content`, which sets the width and height of the cotent area, whereas `:border` sets the width and height of the element inlcuding the padding and border and scroll bars.
|
454
|
+
|
455
|
+
###### Examples
|
456
|
+
|
457
|
+
In the examples below, the `~` character represents padding and would not be displayed in the acutal rendered screen.
|
458
|
+
|
459
|
+
```ruby
|
460
|
+
settings.width = 10
|
461
|
+
settings.height = 3
|
462
|
+
settings.set_padding(left: 3, top: 1, right: 3, bottom: 1)
|
463
|
+
settings.full_border
|
464
|
+
|
465
|
+
## Content sizing
|
466
|
+
settings.sizing = :content
|
467
|
+
|
468
|
+
# Results in the box
|
469
|
+
#
|
470
|
+
# ┏━━━━━━━━━━━━━━━━┓
|
471
|
+
# ┃~~~~~~~~~~~~~~~~┃
|
472
|
+
# ┃~~~1234567890~~~┃
|
473
|
+
# ┃~~~1234567890~~~┃
|
474
|
+
# ┃~~~1234567890~~~┃
|
475
|
+
# ┃~~~~~~~~~~~~~~~~┃
|
476
|
+
# ┗━━━━━━━━━━━━━━━━┛
|
477
|
+
|
478
|
+
## Border sizing
|
479
|
+
settings.sizing = :border
|
480
|
+
|
481
|
+
# Results in the box
|
482
|
+
#
|
483
|
+
# ┏━━━━━━━━┓
|
484
|
+
# ┃~~~12~~~┃
|
485
|
+
# ┗━━━━━━━━┛
|
486
|
+
```
|
487
|
+
|
488
|
+
Notice that a box rendered with `:border` sizing would fit exactly in the content area of a box with the same `width` and `height` that is rendered with `:content` sizing. For containers with no padding and no border, the resulting size is the same for either sizing model.
|
489
|
+
|
266
490
|
##### Margin
|
267
491
|
|
268
492
|
Margin settings dictate the spacing on the outside (i.e. outside of the border) of each of the 4 sides of the container independently. To set these values, use
|
269
493
|
|
270
|
-
- `set_margin(left:, top:, right:, bottom:)`
|
494
|
+
- `set_margin(left:, top:, right:, bottom:, horiz:, vert:)` - set any combination of margin (note: setting `horiz` and `left`/`right` or setting `vert` and `top`/`bottom` is not allowed)
|
495
|
+
- `margin.left=(value)` - set left margin
|
496
|
+
- `margin.top=(value)` - set top margin
|
497
|
+
- `margin.right=(value)` - set right margin
|
498
|
+
- `margin.bottom=(value)` - set bottom margin
|
499
|
+
- `margin.horiz=(value)` - set left and right margin to the same value
|
500
|
+
- `margin.vert=(value)` - set top and bottom margin to the same value
|
271
501
|
|
272
502
|
Note: values cannot be negative
|
273
503
|
|
@@ -275,7 +505,13 @@ Note: values cannot be negative
|
|
275
505
|
|
276
506
|
Padding settings dictate the spacing on the inside (i.e. inside of the border) of each of the 4 sides of the container independently. To set these values, use
|
277
507
|
|
278
|
-
- `set_padding(left:, top:, right:, bottom:)`
|
508
|
+
- `set_padding(left:, top:, right:, bottom:, horiz:, vert:)` - set any combination of padding (note: setting `horiz` and `left`/`right` or setting `vert` and `top`/`bottom` is not allowed)
|
509
|
+
- `padding.left=(value)` - set left padding
|
510
|
+
- `padding.top=(value)` - set top padding
|
511
|
+
- `padding.right=(value)` - set right padding
|
512
|
+
- `padding.bottom=(value)` - set bottom padding
|
513
|
+
- `padding.horiz=(value)` - set left and right padding to the same value
|
514
|
+
- `padding.vert=(value)` - set top and bottom padding to the same value
|
279
515
|
|
280
516
|
Note: values cannot be negative
|
281
517
|
|
@@ -283,14 +519,26 @@ Note: values cannot be negative
|
|
283
519
|
|
284
520
|
Scroll settings dictate whether the scrollbar will be shown when child content is larger the the container's viewport. A scrollbar adds a unit to the dimensions of a container (as opposed to overwriting the leftmost/bottommost padding)
|
285
521
|
|
286
|
-
- `
|
522
|
+
- `set_scrollbar(horiz:, vert:)` - set both scrollbar settings
|
523
|
+
- `scrollbar.horiz=(flag)` - show/hide the horizontal scrollbar
|
524
|
+
- `scrollbar.vert=(flag)` - show/hide the vertical scrollbar
|
525
|
+
|
526
|
+
Note: there is a know bug with scrollbars and `center`/`right` alignments. Using `left` alignment is the supported workaround
|
287
527
|
|
288
528
|
##### Border
|
289
529
|
|
290
530
|
The border settings consist of 6 boolean values (border are either width 1 or not shown), the 4 obvious values (`left`, `top`, `right`, and `bottom`) along with 2 other values for inner borders (`inner_horiz` and `inner_vert`) in a grid. A border also has a foreground color (defaults to `:white`) and a style. The background color is determined by the `bg_color` of the element. Border values can be set with
|
291
531
|
|
292
|
-
- `set_border(left:, top:, right:, bottom:, inner_horiz:, inner_vert:, color:, style:)`
|
293
|
-
- `full_border(style:, color:)`
|
532
|
+
- `set_border(left:, top:, right:, bottom:, inner_horiz:, inner_vert:, color:, style:)` - set any combination of border settings
|
533
|
+
- `full_border(style:, color:)` - set all borders to true and optionally set the style or color
|
534
|
+
- `border.left=(flag)` - show/hide left border
|
535
|
+
- `border.top=(flag)` - show/hide top border
|
536
|
+
- `border.right=(flag)` - show/hide right border
|
537
|
+
- `border.bottom=(flag)` - show/hide bottom border
|
538
|
+
- `border.inner_horiz=(flag)` - show/hide inner horizontal border (dividing grid rows)
|
539
|
+
- `border.inner_vert=(flag)` - show/hide inner vertical border (dividing grid columns)
|
540
|
+
- `border.color=(text_color)` - set the border color
|
541
|
+
- `border.style=(style)` - set the border style
|
294
542
|
|
295
543
|
Available border styles are
|
296
544
|
|
@@ -332,52 +580,70 @@ Child elements can flow in one of 4 directions
|
|
332
580
|
|
333
581
|
```
|
334
582
|
# In a Box
|
335
|
-
|
583
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
584
|
+
┃[child 1] [child 2] ... [child N]┃
|
585
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
336
586
|
|
337
587
|
# In a Grid
|
338
|
-
|
339
|
-
[
|
588
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
589
|
+
┃[child 1]┃[child 2]┃[child 3]┃
|
590
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
591
|
+
┃[chiid 4]┃[child 5]┃ ┃
|
592
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
340
593
|
```
|
341
594
|
|
342
595
|
- `:r2l` right-to-left
|
343
596
|
|
344
597
|
```
|
345
598
|
# In a Box
|
346
|
-
|
599
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
600
|
+
┃[child N] [child N - 1] ... [child 1]┃
|
601
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
347
602
|
|
348
603
|
# In a Grid
|
349
|
-
|
350
|
-
|
604
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
605
|
+
┃[child 3]┃[child 2]┃[child 1]┃
|
606
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
607
|
+
┃ ┃[chiid 5]┃[child 4]┃
|
608
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
351
609
|
```
|
352
610
|
|
353
611
|
- `:t2b` top-to-bottom
|
354
612
|
|
355
613
|
```
|
356
614
|
# In a Box
|
357
|
-
|
358
|
-
[child
|
359
|
-
|
360
|
-
|
615
|
+
┏━━━━━━━━━┓
|
616
|
+
┃[child 1]┃
|
617
|
+
┃[child 2]┃
|
618
|
+
┃ ... ┃
|
619
|
+
┃[child N]┃
|
620
|
+
┗━━━━━━━━━┛
|
361
621
|
|
362
622
|
# In a Grid
|
363
|
-
|
364
|
-
[child
|
365
|
-
|
623
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
624
|
+
┃[child 1]┃[child 3]┃[child 5]┃
|
625
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
626
|
+
┃[child 2]┃[child 4]┃ ┃
|
627
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
366
628
|
```
|
367
629
|
|
368
630
|
- `:b2t` bottom-to-top
|
369
631
|
|
370
632
|
```
|
371
633
|
# In a Box
|
372
|
-
|
373
|
-
[child N
|
374
|
-
|
375
|
-
|
634
|
+
┏━━━━━━━━━━━━━┓
|
635
|
+
┃[child N] ┃
|
636
|
+
┃[child N - 1]┃
|
637
|
+
┃ ... ┃
|
638
|
+
┃[child 1] ┃
|
639
|
+
┗━━━━━━━━━━━━━┛
|
376
640
|
|
377
641
|
# In a Grid
|
378
|
-
|
379
|
-
[child 2]
|
380
|
-
|
642
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
643
|
+
┃[child 2]┃[child 4]┃ ┃
|
644
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
645
|
+
┃[child 1]┃[child 3]┃[child 5]┃
|
646
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
381
647
|
```
|
382
648
|
|
383
649
|
##### Colors
|
@@ -424,7 +690,265 @@ $ whirled_peas title_fonts
|
|
424
690
|
|
425
691
|
Note: when using a title font with WhirledPeas for the first time on a system, the gem loads all fonts to check which ones are available. This can be a slow process and may cause a noticeable delay when running a visualization. Running the command above will cache the results and thus when a WhirledPeas visualization is run, there will be no lag from loading fonts.
|
426
692
|
|
427
|
-
|
693
|
+
#### Easing
|
694
|
+
|
695
|
+
The play duration of a frame within a frameset is determined by the easing function and effect along with the frames relative position within the frameset. The three effects are
|
696
|
+
|
697
|
+
- `:in` - apply easing only to the start of the frameset
|
698
|
+
- `:out` - apply easing only to the end of the frameset
|
699
|
+
- `:in_out` - apply easing to the start and end of the frameset
|
700
|
+
|
701
|
+
The available easing functions are
|
702
|
+
|
703
|
+
- `:bezier`
|
704
|
+
|
705
|
+
```
|
706
|
+
# bezier (in)
|
707
|
+
┃ ▄▀
|
708
|
+
┃ ▄▄▀
|
709
|
+
┃ ▄▀
|
710
|
+
┃ ▄▀▀
|
711
|
+
┃ ▄▄▀
|
712
|
+
┃ ▄▄▀
|
713
|
+
┃ ▄▄▀
|
714
|
+
┃ ▄▀
|
715
|
+
┃ ▄▄▀▀
|
716
|
+
┃ ▄▄▀
|
717
|
+
┃ ▄▀▀
|
718
|
+
┃ ▄▄▀▀
|
719
|
+
┃ ▄▄▀▀▀
|
720
|
+
┃ ▄▄▄▀▀▀
|
721
|
+
┃▄▄▄▄▄▄▄▄▄▄▀▀▀
|
722
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
723
|
+
```
|
724
|
+
|
725
|
+
```
|
726
|
+
# bezier (out)
|
727
|
+
┃ ▄▄▄▀▀▀▀▀▀▀▀▀
|
728
|
+
┃ ▄▄▄▀▀▀
|
729
|
+
┃ ▄▄▄▀▀
|
730
|
+
┃ ▄▄▀▀
|
731
|
+
┃ ▄▄▀
|
732
|
+
┃ ▄▀▀
|
733
|
+
┃ ▄▄▀▀
|
734
|
+
┃ ▄▀
|
735
|
+
┃ ▄▀▀
|
736
|
+
┃ ▄▀▀
|
737
|
+
┃ ▄▀▀
|
738
|
+
┃ ▄▄▀
|
739
|
+
┃ ▄▀
|
740
|
+
┃ ▄▀▀
|
741
|
+
┃▄▄▀
|
742
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
743
|
+
```
|
744
|
+
|
745
|
+
```
|
746
|
+
# bezier (in_out)
|
747
|
+
┃ ▄▄▄▀▀▀▀▀▀
|
748
|
+
┃ ▄▄▀▀
|
749
|
+
┃ ▄▀▀
|
750
|
+
┃ ▄▀▀
|
751
|
+
┃ ▄▀▀
|
752
|
+
┃ ▄▀▀
|
753
|
+
┃ ▄▄▀
|
754
|
+
┃ ▄▀
|
755
|
+
┃ ▄▀▀
|
756
|
+
┃ ▄▄▀
|
757
|
+
┃ ▄▄▀
|
758
|
+
┃ ▄▄▀
|
759
|
+
┃ ▄▄▀
|
760
|
+
┃ ▄▄▀▀
|
761
|
+
┃▄▄▄▄▄▄▄▀▀▀
|
762
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
763
|
+
```
|
764
|
+
|
765
|
+
`:linear`
|
766
|
+
|
767
|
+
```
|
768
|
+
# linear (in)
|
769
|
+
┃ ▄▄▀
|
770
|
+
┃ ▄▄▀▀
|
771
|
+
┃ ▄▄▀▀
|
772
|
+
┃ ▄▄▀▀
|
773
|
+
┃ ▄▄▀▀
|
774
|
+
┃ ▄▄▀▀
|
775
|
+
┃ ▄▄▀▀
|
776
|
+
┃ ▄▄▀▀
|
777
|
+
┃ ▄▄▀▀
|
778
|
+
┃ ▄▄▀▀
|
779
|
+
┃ ▄▄▀▀
|
780
|
+
┃ ▄▄▀▀
|
781
|
+
┃ ▄▄▀▀
|
782
|
+
┃ ▄▄▀▀
|
783
|
+
┃▄▄▀▀
|
784
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
785
|
+
```
|
786
|
+
|
787
|
+
```
|
788
|
+
# linear (out)
|
789
|
+
┃ ▄▄▀
|
790
|
+
┃ ▄▄▀▀
|
791
|
+
┃ ▄▄▀▀
|
792
|
+
┃ ▄▄▀▀
|
793
|
+
┃ ▄▄▀▀
|
794
|
+
┃ ▄▄▀▀
|
795
|
+
┃ ▄▄▀▀
|
796
|
+
┃ ▄▄▀▀
|
797
|
+
┃ ▄▄▀▀
|
798
|
+
┃ ▄▄▀▀
|
799
|
+
┃ ▄▄▀▀
|
800
|
+
┃ ▄▄▀▀
|
801
|
+
┃ ▄▄▀▀
|
802
|
+
┃ ▄▄▀▀
|
803
|
+
┃▄▄▀▀
|
804
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
805
|
+
```
|
806
|
+
|
807
|
+
```
|
808
|
+
# linear (in_out)
|
809
|
+
┃ ▄▄▀
|
810
|
+
┃ ▄▄▀▀
|
811
|
+
┃ ▄▄▀▀
|
812
|
+
┃ ▄▄▀▀
|
813
|
+
┃ ▄▄▀▀
|
814
|
+
┃ ▄▄▀▀
|
815
|
+
┃ ▄▄▀▀
|
816
|
+
┃ ▄▄▀▀
|
817
|
+
┃ ▄▄▀▀
|
818
|
+
┃ ▄▄▀▀
|
819
|
+
┃ ▄▄▀▀
|
820
|
+
┃ ▄▄▀▀
|
821
|
+
┃ ▄▄▀▀
|
822
|
+
┃ ▄▄▀▀
|
823
|
+
┃▄▄▀▀
|
824
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
825
|
+
```
|
826
|
+
|
827
|
+
`:parametric`
|
828
|
+
|
829
|
+
```
|
830
|
+
# parametric (in)
|
831
|
+
┃ ▄
|
832
|
+
┃ ▄▀
|
833
|
+
┃ ▄▀
|
834
|
+
┃ ▄▄▀
|
835
|
+
┃ ▄▀
|
836
|
+
┃ ▄▀
|
837
|
+
┃ ▄▀
|
838
|
+
┃ ▄▄▀
|
839
|
+
┃ ▄▀
|
840
|
+
┃ ▄▀▀
|
841
|
+
┃ ▄▀▀
|
842
|
+
┃ ▄▄▀▀
|
843
|
+
┃ ▄▄▄▀▀
|
844
|
+
┃ ▄▄▄▄▀▀
|
845
|
+
┃▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
|
846
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
847
|
+
```
|
848
|
+
|
849
|
+
```
|
850
|
+
# parametric (out)
|
851
|
+
┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀
|
852
|
+
┃ ▄▄▀▀▀▀
|
853
|
+
┃ ▄▄▀▀▀
|
854
|
+
┃ ▄▄▀▀
|
855
|
+
┃ ▄▄▀
|
856
|
+
┃ ▄▄▀
|
857
|
+
┃ ▄▀
|
858
|
+
┃ ▄▀▀
|
859
|
+
┃ ▄▀
|
860
|
+
┃ ▄▀
|
861
|
+
┃ ▄▀
|
862
|
+
┃ ▄▀▀
|
863
|
+
┃ ▄▀
|
864
|
+
┃ ▄▀
|
865
|
+
┃▄▀
|
866
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
867
|
+
```
|
868
|
+
|
869
|
+
```
|
870
|
+
# parametric (in_out)
|
871
|
+
┃ ▄▄▄▀▀▀▀▀▀▀▀▀
|
872
|
+
┃ ▄▄▀▀
|
873
|
+
┃ ▄▀▀
|
874
|
+
┃ ▄▄▀
|
875
|
+
┃ ▄▀
|
876
|
+
┃ ▄▀
|
877
|
+
┃ ▄▀
|
878
|
+
┃ ▄▀
|
879
|
+
┃ ▄▀
|
880
|
+
┃ ▄▀
|
881
|
+
┃ ▄▀
|
882
|
+
┃ ▄▀▀
|
883
|
+
┃ ▄▄▀
|
884
|
+
┃ ▄▄▀▀
|
885
|
+
┃▄▄▄▄▄▄▄▄▄▄▀▀▀
|
886
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
887
|
+
```
|
888
|
+
|
889
|
+
`:quadratic`
|
890
|
+
|
891
|
+
```
|
892
|
+
# quadratic (in)
|
893
|
+
┃ ▄▄
|
894
|
+
┃ ▄▀
|
895
|
+
┃ ▄▀
|
896
|
+
┃ ▄▀
|
897
|
+
┃ ▄▀
|
898
|
+
┃ ▄▀▀
|
899
|
+
┃ ▄▀
|
900
|
+
┃ ▄▀▀
|
901
|
+
┃ ▄▀▀
|
902
|
+
┃ ▄▀▀
|
903
|
+
┃ ▄▄▀▀
|
904
|
+
┃ ▄▄▀▀
|
905
|
+
┃ ▄▄▄▀▀
|
906
|
+
┃ ▄▄▄▀▀▀
|
907
|
+
┃▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
|
908
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
909
|
+
```
|
910
|
+
|
911
|
+
```
|
912
|
+
# quadratic (out)
|
913
|
+
┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀
|
914
|
+
┃ ▄▄▄▀▀▀
|
915
|
+
┃ ▄▄▀▀▀
|
916
|
+
┃ ▄▄▀▀
|
917
|
+
┃ ▄▄▀▀
|
918
|
+
┃ ▄▄▀
|
919
|
+
┃ ▄▄▀
|
920
|
+
┃ ▄▄▀
|
921
|
+
┃ ▄▀
|
922
|
+
┃ ▄▄▀
|
923
|
+
┃ ▄▀
|
924
|
+
┃ ▄▀
|
925
|
+
┃ ▄▀
|
926
|
+
┃ ▄▀
|
927
|
+
┃▄▀▀
|
928
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
929
|
+
```
|
930
|
+
|
931
|
+
```
|
932
|
+
# quadratic (in_out)
|
933
|
+
┃ ▄▄▄▀▀▀▀▀▀▀
|
934
|
+
┃ ▄▄▀▀▀
|
935
|
+
┃ ▄▀▀
|
936
|
+
┃ ▄▀▀
|
937
|
+
┃ ▄▄▀
|
938
|
+
┃ ▄▀
|
939
|
+
┃ ▄▀
|
940
|
+
┃ ▄▀
|
941
|
+
┃ ▄▀
|
942
|
+
┃ ▄▀
|
943
|
+
┃ ▄▀▀
|
944
|
+
┃ ▄▄▀
|
945
|
+
┃ ▄▄▀
|
946
|
+
┃ ▄▄▄▀▀
|
947
|
+
┃▄▄▄▄▄▄▄▄▀▀▀
|
948
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
949
|
+
```
|
950
|
+
|
951
|
+
### Full template example
|
428
952
|
|
429
953
|
```ruby
|
430
954
|
class TemplateFactory
|
@@ -472,64 +996,106 @@ class TemplateFactory
|
|
472
996
|
end
|
473
997
|
```
|
474
998
|
|
475
|
-
###
|
999
|
+
### Full usage
|
1000
|
+
|
1001
|
+
```
|
1002
|
+
Usage: whirled_peas <command> [command options]
|
1003
|
+
|
1004
|
+
Available commands:
|
476
1005
|
|
477
|
-
|
1006
|
+
debug Print template tree for specified frame
|
1007
|
+
fonts List installed title fonts with sample text
|
1008
|
+
frames Print out list of frames generated by application
|
1009
|
+
help Show detailed help for a command
|
1010
|
+
play Play an animation from an application or prerecorded file
|
1011
|
+
record Record animation to a file
|
1012
|
+
still Show the specified still frame
|
1013
|
+
```
|
478
1014
|
|
479
|
-
####
|
1015
|
+
#### `debug`
|
480
1016
|
|
481
|
-
|
1017
|
+
Print the template tree for specified frame.
|
482
1018
|
|
483
1019
|
```
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
1020
|
+
# Usage: whirled_peas debug <config file> <frame> [args as a JSON string]
|
1021
|
+
% whirled_peas debug my_app.rb greeting '{"name":"World"}'
|
1022
|
+
* WhirledPeas::Graphics::BoxPainter(TEMPLATE)
|
1023
|
+
- Dimensions(outer=140x27, content=120x15, grid=1x1)
|
1024
|
+
- Settings
|
1025
|
+
WhirledPeas::Settings::BoxSettings
|
1026
|
+
padding: Padding(left: 10, top: 6, right: 10, bottom: 6)
|
1027
|
+
align: :center
|
1028
|
+
width: 120
|
1029
|
+
flow: :t2b
|
1030
|
+
bold: true
|
1031
|
+
bg_color: BgColor(code=107, bright=true)
|
1032
|
+
- Children
|
1033
|
+
* WhirledPeas::Graphics::BoxPainter(Element-1)
|
1034
|
+
- Dimensions(outer=64x6, content=64x6, grid=1x1)
|
489
1035
|
```
|
490
1036
|
|
491
|
-
####
|
1037
|
+
#### `fonts`
|
492
1038
|
|
493
|
-
|
1039
|
+
List all installed title fonts with sample text.
|
494
1040
|
|
495
1041
|
```
|
496
|
-
|
1042
|
+
# Usage: whirled_peas fonts
|
497
1043
|
```
|
498
1044
|
|
499
|
-
|
1045
|
+
#### `frames`
|
1046
|
+
|
1047
|
+
Print out list of frames generated by application.
|
500
1048
|
|
501
1049
|
```
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
<default>
|
507
|
-
- Children
|
508
|
-
+ TitleContainer [WhirledPeas::Graphics::BoxPainter]
|
1050
|
+
# Usage: whirled_peas frames <config file>
|
1051
|
+
% whirled_peas frames my_app.rb
|
1052
|
+
Frame 'intro' displayed for 3 second(s) '{"title":"Foo"}'
|
1053
|
+
Frame 'greet' displayed for 0.3 second(s)
|
509
1054
|
...
|
510
1055
|
```
|
511
1056
|
|
512
|
-
|
1057
|
+
#### `help`
|
1058
|
+
|
1059
|
+
Print out command-specific help message
|
1060
|
+
|
1061
|
+
```
|
1062
|
+
Usage: whirled_peas help <command>
|
1063
|
+
```
|
1064
|
+
|
1065
|
+
#### `play`
|
1066
|
+
|
1067
|
+
Play an animation from an application or prerecorded file
|
1068
|
+
|
1069
|
+
```
|
1070
|
+
# Usage: whirled_peas play <config/wpz file>
|
1071
|
+
|
1072
|
+
# Play animation directly from app
|
1073
|
+
% whirled_peas play my_app.rb
|
1074
|
+
# Animation plays
|
1075
|
+
|
1076
|
+
# Play animation from previously recorded file
|
1077
|
+
% whirled_peas play my_animation.wpz
|
1078
|
+
# Animation plays
|
1079
|
+
```
|
513
1080
|
|
514
|
-
####
|
1081
|
+
#### `record`
|
515
1082
|
|
516
|
-
|
1083
|
+
Record animation to a file
|
517
1084
|
|
518
1085
|
```
|
519
|
-
|
1086
|
+
# Usage: whirled_peas record <config file> <output file>
|
1087
|
+
% whirled_peas record my_app.rb my_animation.wpz
|
1088
|
+
# Record animation to my_animation.wpz
|
520
1089
|
```
|
521
1090
|
|
522
|
-
|
1091
|
+
#### `still`
|
1092
|
+
|
1093
|
+
Show the specified still frame
|
523
1094
|
|
524
1095
|
```
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
WhirledPeas::Settings::BoxSettings
|
529
|
-
<default>
|
530
|
-
- Children
|
531
|
-
+ TitleContainer [WhirledPeas::Graphics::BoxPainter]
|
532
|
-
...
|
1096
|
+
# Usage: whirled_peas still <config file> <frame> [args as a JSON string]
|
1097
|
+
% whirled_peas still my_app.rb greeting '{"name":"World"}'
|
1098
|
+
# Still frame is displayed
|
533
1099
|
```
|
534
1100
|
|
535
1101
|
## Development
|
@@ -540,23 +1106,31 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
540
1106
|
|
541
1107
|
### Testing
|
542
1108
|
|
543
|
-
In addition to standard RSpec tests, WhirledPeas has custom tests for rendered templates. These files live in `screen_test
|
1109
|
+
In addition to standard RSpec tests, WhirledPeas has custom tests for rendered templates. These files live in `screen_test/`. Each ruby file is expected to define a class named `TemplateFactory` that responds to `#build(name, args)` returning a template (the standard template factory role). Each file should also be accompanied by a `.frame` file with the same base name. This file will contain the output of the rendered screen and is considered the correct output when running tests.
|
544
1110
|
|
545
1111
|
Note: viewing `.frame` files with `cat` works better than most other text editors.
|
546
1112
|
|
547
|
-
|
1113
|
+
```
|
1114
|
+
|
1115
|
+
Usage: screen_test [file] [options]
|
1116
|
+
|
1117
|
+
If not file or options are provide, all tests are run
|
548
1118
|
|
549
|
-
|
550
|
-
|
551
|
-
-
|
552
|
-
-
|
553
|
-
|
554
|
-
|
555
|
-
|
1119
|
+
If no file is provided, the supported options are
|
1120
|
+
--help print this usage statement and exit
|
1121
|
+
--view-pending interactively display and optionally save rendered output for each pending test
|
1122
|
+
--view-failed interactively display and optionally save rendered output for each faiing test
|
1123
|
+
|
1124
|
+
If a screen test file is provided as the first argument, the supported options are
|
1125
|
+
--run run screen test for given file
|
1126
|
+
--view interactively display and optionally save the file's test output
|
1127
|
+
--template print out template tree for the test template
|
1128
|
+
--debug render the test template without displying it, printing out debug information
|
1129
|
+
```
|
556
1130
|
|
557
1131
|
## Contributing
|
558
1132
|
|
559
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
1133
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tcollier/whirled_peas. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/tcollier/whirled_peas/blob/master/CODE_OF_CONDUCT.md).
|
560
1134
|
|
561
1135
|
## License
|
562
1136
|
|
@@ -564,4 +1138,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
564
1138
|
|
565
1139
|
## Code of Conduct
|
566
1140
|
|
567
|
-
Everyone interacting in the WhirledPeas project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
1141
|
+
Everyone interacting in the WhirledPeas project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/tcollier/whirled_peas/blob/master/CODE_OF_CONDUCT.md).
|