whirled_peas 0.7.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +25 -0
  4. data/README.md +467 -120
  5. data/Rakefile +1 -20
  6. data/bin/easing +33 -0
  7. data/bin/reset_cursor +11 -0
  8. data/bin/screen_test +68 -0
  9. data/examples/graph.rb +54 -0
  10. data/examples/intro.rb +3 -3
  11. data/examples/scrolling.rb +5 -4
  12. data/lib/data/themes.yaml +13 -0
  13. data/lib/whirled_peas.rb +12 -6
  14. data/lib/whirled_peas/animator.rb +5 -0
  15. data/lib/whirled_peas/animator/debug_consumer.rb +17 -0
  16. data/lib/whirled_peas/animator/easing.rb +72 -0
  17. data/lib/whirled_peas/animator/frame.rb +5 -0
  18. data/lib/whirled_peas/animator/frameset.rb +33 -0
  19. data/lib/whirled_peas/animator/producer.rb +35 -0
  20. data/lib/whirled_peas/animator/renderer_consumer.rb +31 -0
  21. data/lib/whirled_peas/command.rb +5 -0
  22. data/lib/whirled_peas/command/base.rb +86 -0
  23. data/lib/whirled_peas/command/config_command.rb +43 -0
  24. data/lib/whirled_peas/command/debug.rb +21 -0
  25. data/lib/whirled_peas/command/fonts.rb +22 -0
  26. data/lib/whirled_peas/command/frame_command.rb +34 -0
  27. data/lib/whirled_peas/command/frames.rb +24 -0
  28. data/lib/whirled_peas/command/help.rb +38 -0
  29. data/lib/whirled_peas/command/play.rb +111 -0
  30. data/lib/whirled_peas/command/record.rb +57 -0
  31. data/lib/whirled_peas/command/still.rb +29 -0
  32. data/lib/whirled_peas/command/themes.rb +76 -0
  33. data/lib/whirled_peas/command_line.rb +24 -212
  34. data/lib/whirled_peas/config.rb +56 -6
  35. data/lib/whirled_peas/device.rb +5 -0
  36. data/lib/whirled_peas/device/null_device.rb +8 -0
  37. data/lib/whirled_peas/device/output_file.rb +19 -0
  38. data/lib/whirled_peas/device/screen.rb +26 -0
  39. data/lib/whirled_peas/graphics/composer.rb +23 -2
  40. data/lib/whirled_peas/graphics/container_painter.rb +91 -0
  41. data/lib/whirled_peas/graphics/content_dimensions.rb +19 -0
  42. data/lib/whirled_peas/graphics/content_painter.rb +20 -0
  43. data/lib/whirled_peas/graphics/graph_dimensions.rb +12 -0
  44. data/lib/whirled_peas/graphics/graph_painter.rb +97 -0
  45. data/lib/whirled_peas/graphics/grid_painter.rb +1 -4
  46. data/lib/whirled_peas/graphics/painter.rb +10 -0
  47. data/lib/whirled_peas/graphics/renderer.rb +8 -2
  48. data/lib/whirled_peas/graphics/text_painter.rb +7 -11
  49. data/lib/whirled_peas/settings/border.rb +25 -4
  50. data/lib/whirled_peas/settings/container_settings.rb +2 -4
  51. data/lib/whirled_peas/settings/element_settings.rb +12 -3
  52. data/lib/whirled_peas/settings/graph_settings.rb +21 -0
  53. data/lib/whirled_peas/settings/grid_settings.rb +7 -0
  54. data/lib/whirled_peas/settings/text_settings.rb +1 -0
  55. data/lib/whirled_peas/settings/theme.rb +40 -0
  56. data/lib/whirled_peas/settings/theme_library.rb +63 -0
  57. data/lib/whirled_peas/utils/ansi.rb +13 -0
  58. data/lib/whirled_peas/utils/file_handler.rb +57 -0
  59. data/lib/whirled_peas/version.rb +1 -1
  60. data/screen_test/elements/box.frame +1 -1
  61. data/screen_test/elements/box.rb +1 -1
  62. data/screen_test/elements/graph.frame +1 -0
  63. data/screen_test/elements/graph.rb +12 -0
  64. data/screen_test/elements/grid.frame +1 -1
  65. data/screen_test/elements/grid.rb +1 -1
  66. data/screen_test/elements/screen_overflow_x.frame +1 -1
  67. data/screen_test/elements/screen_overflow_x.rb +1 -1
  68. data/screen_test/elements/screen_overflow_y.frame +1 -1
  69. data/screen_test/elements/screen_overflow_y.rb +1 -1
  70. data/screen_test/elements/text.frame +1 -1
  71. data/screen_test/elements/text.rb +1 -1
  72. data/screen_test/elements/text_multiline.frame +1 -1
  73. data/screen_test/elements/text_multiline.rb +1 -1
  74. data/screen_test/elements/theme.frame +1 -0
  75. data/screen_test/elements/theme.rb +26 -0
  76. data/screen_test/settings/align/box_around.frame +1 -1
  77. data/screen_test/settings/align/box_around.rb +1 -1
  78. data/screen_test/settings/align/box_between.frame +1 -1
  79. data/screen_test/settings/align/box_between.rb +1 -1
  80. data/screen_test/settings/align/box_center.frame +1 -1
  81. data/screen_test/settings/align/box_center.rb +1 -1
  82. data/screen_test/settings/align/box_default.frame +1 -1
  83. data/screen_test/settings/align/box_default.rb +1 -1
  84. data/screen_test/settings/align/box_evenly.frame +1 -1
  85. data/screen_test/settings/align/box_evenly.rb +1 -1
  86. data/screen_test/settings/align/box_left.frame +1 -1
  87. data/screen_test/settings/align/box_left.rb +1 -1
  88. data/screen_test/settings/align/box_right.frame +1 -1
  89. data/screen_test/settings/align/box_right.rb +1 -1
  90. data/screen_test/settings/align/children_center.frame +1 -1
  91. data/screen_test/settings/align/children_center.rb +1 -1
  92. data/screen_test/settings/align/children_left.frame +1 -1
  93. data/screen_test/settings/align/children_left.rb +1 -1
  94. data/screen_test/settings/align/children_right.frame +1 -1
  95. data/screen_test/settings/align/children_right.rb +1 -1
  96. data/screen_test/settings/align/grid_center.frame +1 -1
  97. data/screen_test/settings/align/grid_center.rb +1 -1
  98. data/screen_test/settings/align/grid_default.frame +1 -1
  99. data/screen_test/settings/align/grid_default.rb +1 -1
  100. data/screen_test/settings/align/grid_left.frame +1 -1
  101. data/screen_test/settings/align/grid_left.rb +1 -1
  102. data/screen_test/settings/align/grid_right.frame +1 -1
  103. data/screen_test/settings/align/grid_right.rb +1 -1
  104. data/screen_test/settings/ansi/bold.frame +1 -1
  105. data/screen_test/settings/ansi/bold.rb +1 -1
  106. data/screen_test/settings/ansi/color.frame +1 -1
  107. data/screen_test/settings/ansi/color.rb +1 -1
  108. data/screen_test/settings/ansi/underline.frame +1 -1
  109. data/screen_test/settings/ansi/underline.rb +1 -1
  110. data/screen_test/settings/border.frame +1 -1
  111. data/screen_test/settings/border.rb +1 -1
  112. data/screen_test/settings/flow/box_b2t.frame +1 -1
  113. data/screen_test/settings/flow/box_b2t.rb +1 -1
  114. data/screen_test/settings/flow/box_l2r.frame +1 -1
  115. data/screen_test/settings/flow/box_l2r.rb +1 -1
  116. data/screen_test/settings/flow/box_r2l.frame +1 -1
  117. data/screen_test/settings/flow/box_r2l.rb +1 -1
  118. data/screen_test/settings/flow/box_t2b.frame +1 -1
  119. data/screen_test/settings/flow/box_t2b.rb +1 -1
  120. data/screen_test/settings/flow/grid_b2t.frame +1 -1
  121. data/screen_test/settings/flow/grid_b2t.rb +2 -2
  122. data/screen_test/settings/flow/grid_l2r.frame +1 -1
  123. data/screen_test/settings/flow/grid_l2r.rb +2 -2
  124. data/screen_test/settings/flow/grid_r2l.frame +1 -1
  125. data/screen_test/settings/flow/grid_r2l.rb +2 -2
  126. data/screen_test/settings/flow/grid_t2b.frame +1 -1
  127. data/screen_test/settings/flow/grid_t2b.rb +2 -2
  128. data/screen_test/settings/height/box.frame +1 -1
  129. data/screen_test/settings/height/box.rb +1 -1
  130. data/screen_test/settings/height/box_border_sizing.frame +1 -1
  131. data/screen_test/settings/height/box_border_sizing.rb +1 -1
  132. data/screen_test/settings/height/grid.frame +1 -1
  133. data/screen_test/settings/height/grid.rb +1 -1
  134. data/screen_test/settings/height/overflow_box.frame +1 -1
  135. data/screen_test/settings/height/overflow_box.rb +1 -1
  136. data/screen_test/settings/height/overflow_box_l2r.frame +1 -1
  137. data/screen_test/settings/height/overflow_box_l2r.rb +1 -1
  138. data/screen_test/settings/height/overflow_box_t2b.frame +1 -1
  139. data/screen_test/settings/height/overflow_box_t2b.rb +1 -1
  140. data/screen_test/settings/height/overflow_grid.frame +1 -1
  141. data/screen_test/settings/height/overflow_grid.rb +1 -1
  142. data/screen_test/settings/margin.frame +1 -1
  143. data/screen_test/settings/margin.rb +1 -1
  144. data/screen_test/settings/padding.frame +1 -1
  145. data/screen_test/settings/padding.rb +1 -1
  146. data/screen_test/settings/position/box_left.frame +1 -1
  147. data/screen_test/settings/position/box_left.rb +1 -1
  148. data/screen_test/settings/position/box_left_negative.frame +1 -1
  149. data/screen_test/settings/position/box_left_negative.rb +1 -1
  150. data/screen_test/settings/position/box_top.frame +1 -1
  151. data/screen_test/settings/position/box_top.rb +1 -1
  152. data/screen_test/settings/position/box_top_negative.frame +1 -1
  153. data/screen_test/settings/position/box_top_negative.rb +1 -1
  154. data/screen_test/settings/position/grid_left.frame +1 -1
  155. data/screen_test/settings/position/grid_left.rb +1 -1
  156. data/screen_test/settings/position/grid_left_negative.frame +1 -1
  157. data/screen_test/settings/position/grid_left_negative.rb +1 -1
  158. data/screen_test/settings/position/grid_top.frame +1 -1
  159. data/screen_test/settings/position/grid_top.rb +1 -1
  160. data/screen_test/settings/position/grid_top_negative.frame +1 -1
  161. data/screen_test/settings/position/grid_top_negative.rb +1 -1
  162. data/screen_test/settings/scroll/horiz_box.frame +1 -1
  163. data/screen_test/settings/scroll/horiz_box.rb +1 -1
  164. data/screen_test/settings/scroll/horiz_box_align_center.rb +1 -1
  165. data/screen_test/settings/scroll/horiz_box_align_right.rb +1 -1
  166. data/screen_test/settings/scroll/vert_box.frame +1 -1
  167. data/screen_test/settings/scroll/vert_box.rb +1 -1
  168. data/screen_test/settings/title_font.frame +1 -1
  169. data/screen_test/settings/title_font.rb +1 -1
  170. data/screen_test/settings/valign/box_around.frame +1 -1
  171. data/screen_test/settings/valign/box_around.rb +1 -1
  172. data/screen_test/settings/valign/box_between.frame +1 -1
  173. data/screen_test/settings/valign/box_between.rb +1 -1
  174. data/screen_test/settings/valign/box_bottom.frame +1 -1
  175. data/screen_test/settings/valign/box_bottom.rb +1 -1
  176. data/screen_test/settings/valign/box_default.frame +1 -1
  177. data/screen_test/settings/valign/box_default.rb +1 -1
  178. data/screen_test/settings/valign/box_evenly.frame +1 -1
  179. data/screen_test/settings/valign/box_evenly.rb +1 -1
  180. data/screen_test/settings/valign/box_middle.frame +1 -1
  181. data/screen_test/settings/valign/box_middle.rb +1 -1
  182. data/screen_test/settings/valign/box_top.frame +1 -1
  183. data/screen_test/settings/valign/box_top.rb +1 -1
  184. data/screen_test/settings/valign/grid_bottom.frame +1 -1
  185. data/screen_test/settings/valign/grid_bottom.rb +1 -1
  186. data/screen_test/settings/valign/grid_default.frame +1 -1
  187. data/screen_test/settings/valign/grid_default.rb +1 -1
  188. data/screen_test/settings/valign/grid_middle.frame +1 -1
  189. data/screen_test/settings/valign/grid_middle.rb +1 -1
  190. data/screen_test/settings/valign/grid_top.frame +1 -1
  191. data/screen_test/settings/valign/grid_top.rb +1 -1
  192. data/screen_test/settings/width/box_border_sizing.frame +1 -1
  193. data/screen_test/settings/width/box_border_sizing.rb +1 -1
  194. data/screen_test/settings/width/box_content.frame +1 -1
  195. data/screen_test/settings/width/box_content.rb +1 -1
  196. data/screen_test/settings/width/box_default.frame +1 -1
  197. data/screen_test/settings/width/box_default.rb +1 -1
  198. data/screen_test/settings/width/grid.frame +1 -1
  199. data/screen_test/settings/width/grid.rb +1 -1
  200. data/screen_test/settings/width/overflow_align_center.frame +1 -1
  201. data/screen_test/settings/width/overflow_align_center.rb +1 -1
  202. data/screen_test/settings/width/overflow_align_right.frame +1 -1
  203. data/screen_test/settings/width/overflow_align_right.rb +1 -1
  204. data/screen_test/settings/width/overflow_box.frame +1 -1
  205. data/screen_test/settings/width/overflow_box.rb +1 -1
  206. data/screen_test/settings/width/overflow_box_l2r.frame +1 -1
  207. data/screen_test/settings/width/overflow_box_l2r.rb +1 -1
  208. data/screen_test/settings/width/overflow_box_t2b.frame +1 -1
  209. data/screen_test/settings/width/overflow_box_t2b.rb +1 -1
  210. data/screen_test/settings/width/overflow_grid.frame +1 -1
  211. data/screen_test/settings/width/overflow_grid.rb +1 -1
  212. data/tools/whirled_peas/tools/screen_tester.rb +131 -65
  213. metadata +42 -9
  214. data/lib/whirled_peas/frame.rb +0 -6
  215. data/lib/whirled_peas/frame/consumer.rb +0 -30
  216. data/lib/whirled_peas/frame/debug_consumer.rb +0 -30
  217. data/lib/whirled_peas/frame/event_loop.rb +0 -90
  218. data/lib/whirled_peas/frame/producer.rb +0 -67
  219. data/lib/whirled_peas/graphics/screen.rb +0 -70
  220. data/lib/whirled_peas/graphics/text_dimensions.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46a66b5e575d80b9e99cd263d8158ece7f500aebfc853df72bd340b7b67a0787
4
- data.tar.gz: 6a097ab19829f97957eff088dab8aed0241b0d68a79a43681883a07e2a897790
3
+ metadata.gz: 7c1c4b2f603c535f98d7578741059e0d949ccff4e315fc88c36c13fc2fa58de5
4
+ data.tar.gz: a9c92f62d2dcb7c7c1983bf6e6e8fa66bb5a92abcec0ae689ca4efc342083625
5
5
  SHA512:
6
- metadata.gz: '093f92c928d2dda04cabe54d4bcc627f3083fcc1e1b68ceb413dc2ffcfa3e1f73427a91f9e5d1fee8992fcc1e88f601984e5e04f8b0a58183c5b44ac5e4d2c27'
7
- data.tar.gz: '0300822358c0ceaeba6c998cbff96ac1c2d94198cc639062e77cfe041132630f94f8dd4ef56a6de45838b068480f0a8ebcc40c23c2b1a5e315ce990ead06ca93'
6
+ metadata.gz: 8e746107b95a5176d89792606a76935c84c3686452b2abf99c5383df676263684a096130c18cf07080fbc9ede4dc61b9ae220efe4fd8313e933c230e73d8b1b0
7
+ data.tar.gz: d5dca0db34f358072134a94ae8b5765abd60d45f18de7496dc0c410cd665c2e9ef91ef33989d00317caef1fd472c210e892af13d8a65bc3126ea37b201dc1b43
data/.gitignore CHANGED
@@ -11,4 +11,5 @@ Gemfile.lock
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
14
+ *.wpz
14
15
 
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.10.0 - 2021-01-29
4
+
5
+ - [3063a2b](https://github.com/tcollier/whirled_peas/tree/3063a2becb7680b5e320a1733b3da933e6c65210): Add built-in and user-defined themes
6
+
7
+ ## v0.9.1 - 2021-01-29
8
+
9
+ - [c35b134](https://github.com/tcollier/whirled_peas/tree/c35b134e1340b8b5f1d1fb0e6e56dc2a99b52e94): Improve graph plots
10
+
11
+ ## v0.9.0 - 2021-01-29
12
+
13
+ BREAKING: `Frameset#add_frame` signature changed
14
+
15
+ - [1c28947](https://github.com/tcollier/whirled_peas/tree/1c28947980eedce034d2596732ee4860717904c5): Add graph support
16
+
17
+ ## v0.8.0 - 2021-01-29
18
+
19
+ BREAKING: `Producer` now responds to `#add_frame` instead of `#send_frame`
20
+
21
+ - [67fdc17](https://github.com/tcollier/whirled_peas/tree/67fdc172434cb97f31ca20a674f28aefec6babb3): Add easing functions for frame transitions
22
+ - [b888f2e](https://github.com/tcollier/whirled_peas/tree/b888f2e7a3b7c3341300326b417641cc8cf2e89b): Add record and playback functionality to command line tool
23
+
24
+ ## v0.7.1 - 2021-01-27
25
+
26
+ - [b98781d](https://github.com/tcollier/whirled_peas/tree/b98781de23a24b596955f25cfc48936c0cc1efac): Fix num_cols bug for vertical grid flow
27
+
3
28
  ## v0.7.0 - 2021-01-27
4
29
 
5
30
  BREAKING: the settings for the template now fills the full screen and disallows margin.
data/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝
19
19
  ```
20
20
 
21
- Easily create terminal-based graphics to visual 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.
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 driver (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 driver into terminal graphics
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 Driver
64
+ class Application
66
65
  def start(producer)
67
- producer.send_frame('starting', args: { name: 'World' })
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.driver = Driver.new
72
+ config.application = Application.new
74
73
  config.template_factory = TemplateFactory.new
75
74
  end
76
75
  ```
@@ -78,54 +77,64 @@ end
78
77
  Then the visualizer is started on the command line with
79
78
 
80
79
  ```
81
- $ whirled_peas start visualize.rb
80
+ $ whirled_peas play visualize.rb
82
81
  ```
83
82
 
84
- The optional loading screen can be configured like
83
+ ### Application
85
84
 
86
- ```ruby
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
85
+ The application is code to be visualized that integrates with Whirled Peas by providing the signature below
99
86
 
100
- WhirledPeas.configure do |config|
101
- # ...
102
- config.loading_template_factory = LoadingTemplateFactory.new
87
+ ```ruby
88
+ # Start the application and pass frame events to the producer to be rendered
89
+ # by the UI
90
+ #
91
+ # @param producer [Producer] frame producer that sends events to the UI
92
+ def start(producer)
93
+ # application code here
103
94
  end
104
95
  ```
105
96
 
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.
97
+ The producer provides the following methods
109
98
 
110
99
  ```ruby
111
- # Start the application and pass frame events to the producer to be rendered by the UI
100
+ # Add a frame to be displayed
112
101
  #
113
- # @param producer [Producer] frame producer that sends events to the UI
114
- def start(producer)
115
- # application code here
102
+ # @param name [String] (required) application defined name for the frame. The
103
+ # template factory will be provided this name
104
+ # @param duration [Number] (optional) time in seconds this frame should be
105
+ # displayed for (defaults to 1 frame)
106
+ # @param args [Hash<Symbol, Object>] (optional) key/value pairs to send as
107
+ # arguments to the template factory
108
+ def add_frame(name, duration:, args:)
109
+ end
110
+
111
+ # Create and yield a frameset instance that allows applications to add multiple
112
+ # frames to play over the given duration. Adding frames to the yielded frameset
113
+ # will result in playback that is eased by the given `easing` and `effect`
114
+ # arguments (default is `:linear` easing)
115
+ #
116
+ # @param duration [Number] (required) total duration for which all frames in
117
+ # frameset will be displayed
118
+ # @param easing [Symbol] (optional) easing function to be used to transition
119
+ # through all frames (defaults to `:linear`)
120
+ # @param effect [Symbol] (optional) how to apply the easing function (defaults
121
+ # to `:in_out`, also available are `:in` and `:out`)
122
+ # @yield [Frameset] instance that provides `#add_frame(name, args:)`
123
+ def frameset(duration, easing:, effect:, &block)
116
124
  end
117
125
  ```
118
126
 
119
- The producer provides a single method
127
+ A frameset instance provides one method
120
128
 
121
129
  ```ruby
122
- # Send frame events to the UI
130
+ # Add a frame to be displayed, the duration will be determine by the number of
131
+ # frames in the frameset along with the duration and easing of the frameset
123
132
  #
124
- # @param name [String] application defined name for the frame. The template factory will be provided this name
125
- # @param duration [Number] time in seconds this frame should be displayed for (defaults to 1 frame)
126
- # @param args [Hash<Symbol, Object>] key value pairs to send as arguments to the template factory
127
- def send_frame(name, duration:, args:)
128
- # implementation
133
+ # @param name [String] (required) application defined name for the frame. The
134
+ # template factory will be provided this name
135
+ # @param args [Hash<Symbol, Object>] (optional) key/value pairs to send as
136
+ # arguments to the template factory
137
+ def add_frame(name, args:)
129
138
  end
130
139
  ```
131
140
 
@@ -136,39 +145,35 @@ end
136
145
  Simple application that loads a set of numbers and looks for a pair that adds up to 1,000
137
146
 
138
147
  ```ruby
139
- class Driver
148
+ class Application
140
149
  def start(producer)
141
150
  numbers = File.readlines('/path/to/numbers.txt').map(&:to_i)
142
- producer.send_frame('load-numbers', duration: 3, args: { numbers: numbers })
151
+ producer.add_frame('load-numbers', duration: 3, args: { numbers: numbers })
143
152
  numbers.sort!
144
- producer.send_frame('sort-numbers', duration: 3, args: { numbers: numbers })
153
+ producer.add_frame('sort-numbers', duration: 3, args: { numbers: numbers })
145
154
  low = 0
146
155
  high = numbers.length - 1
147
156
  while low < high
148
157
  sum = numbers[low] + numbers[high]
149
158
  if sum == 1000
150
- producer.send_frame('found-pair', duration: 5, args: { low: low, high: high, sum: sum })
159
+ producer.add_frame('found-pair', duration: 5, args: { low: low, high: high, sum: sum })
151
160
  return
152
161
  elsif sum < 1000
153
- producer.send_frame('too-low', args: { low: low, high: high, sum: sum })
162
+ producer.add_frame('too-low', args: { low: low, high: high, sum: sum })
154
163
  low += 1
155
164
  else
156
- producer.send_frame('too-high', args: { low: low, high: high, sum: sum })
165
+ producer.add_frame('too-high', args: { low: low, high: high, sum: sum })
157
166
  high -= 1
158
167
  end
159
168
  end
160
- producer.send_frame('no-solution', duration: 5)
169
+ producer.add_frame('no-solution', duration: 5)
161
170
  end
162
171
  end
163
172
  ```
164
173
 
165
174
  ### Template Factory
166
175
 
167
- To render the frame events sent by the driver, 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 driver. 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.
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.
176
+ 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
177
 
173
178
  #### Building Blocks
174
179
 
@@ -182,6 +187,7 @@ A template is created with `WhirledPeas.template`, which yields a `Composer` obj
182
187
  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).
183
188
 
184
189
  - `add_box` - yields a `Composer` for a `Box` and a `BoxSettings`, which will be added to the parent's children
190
+ - `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
185
191
  - `add_grid` - yields a `Composer` for a `Grid` and a `GridSettings`, which will be added to the parent's children
186
192
  - `add_text` - yields `nil` and a `TextSettings`, which will be added to the parent's children
187
193
 
@@ -241,28 +247,45 @@ end
241
247
 
242
248
  #### Settings
243
249
 
244
- 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
245
- The available settigs are
246
-
247
- | Setting | Description | Default | Availability | Inherited |
248
- | ------------ | -------------------------------------------------------------------------------- | ---------- | --------------------- | -------------------- |
249
- | `align` | Justifies the content in the horizontal direction | `:left` | `Box`, `Grid` | No |
250
- | `bg_color` | Background color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
251
- | `bold` | `true` makes the font bold | `false` | `Box`, `Grid`, `Text` | Yes |
252
- | `border` | Set the border for the lements | none | `Box`, `Grid`, | Only style and color |
253
- | `color` | Foreground text color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
254
- | `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` | `Box`, `Grid` | No |
255
- | `height` | Override the calculated height of an element's content area | | `Box`, `Grid` | No |
256
- | `margin` | Set the (left, top, right, bottom) margin of the element | `0` | `Box`, `Grid` | No |
257
- | `num_cols` | Number of columns in the grid (must be set!) | | `Grid` | No |
258
- | `padding` | Set the (left, top, right, bottom) padding of the element | `0` | `Box`, `Grid` | No |
259
- | `position` | Set the (left, top) position of the element relative to parent content area | `0` | `Box`, `Grid` | No |
260
- | `scrollbar` | Display a scroll bar for vertical or horizontal scrolling | | `Box` | No |
261
- | `sizing` | Sizing model (`:content` or `:border`) used in conjunction with `width`/`hieght` | `:content` | `Box` | No |
262
- | `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text` | No |
263
- | `underline` | `true` underlines the font | `false` | `Box`, `Grid`, `Text` | Yes |
264
- | `width` | Override the calculated width of an element's content area | | `Box`, `Grid` | No |
265
- | `valign` | Justifies the content in the vertical direction | `:top` | `Box`, `Grid` | No |
250
+ 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. The table below lists all settings along with which element types the settings can be applied to (`Grid` and `Box` are containers)
251
+
252
+ | Setting | Description | Default | Availability | Inherited |
253
+ | ------------ | -------------------------------------------------------------------------------- | ---------- | ------------ | -------------------- |
254
+ | `align` | Justifies the content in the horizontal direction | `:left` | containers | No |
255
+ | `axis_color` | Color used to paint the axes of the graph (see [Colors](#colors)) | | `Graph` | No |
256
+ | `bg_color` | Background color (see [Colors](#colors)) | | all | Yes |
257
+ | `bold` | `true` makes the font bold | `false` | all | Yes |
258
+ | `border` | Set the border for the lements | none | containers, | Only style and color |
259
+ | `color` | Foreground text color (see [Colors](#colors)) | | all | Yes |
260
+ | `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` | containers | No |
261
+ | `height` | Override the calculated height of an element's content area | | all | No |
262
+ | `margin` | Set the (left, top, right, bottom) margin of the element | `0` | containers | No |
263
+ | `num_cols` | Number of columns in the grid (must be set!) | | `Grid` | No |
264
+ | `padding` | Set the (left, top, right, bottom) padding of the element | `0` | containers | No |
265
+ | `position` | Set the (left, top) position of the element relative to parent content area | `0` | containers | No |
266
+ | `scrollbar` | Display a scroll bar for vertical or horizontal scrolling | | `Box` | No |
267
+ | `sizing` | Sizing model (`:content` or `:border`) used in conjunction with `width`/`height` | `:content` | `Box` | No |
268
+ | `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text` | No |
269
+ | `underline` | `true` underlines the font | `false` | all | Yes |
270
+ | `width` | Override the calculated width of an element's content area | | all | No |
271
+ | `valign` | Justifies the content in the vertical direction | `:top` | containers | No |
272
+
273
+ ##### Themes
274
+
275
+ The template builder (`WhirledPeas.template`) takes an optional `theme` argument. You can provide the name of a predefined theme (run `whirled_peas themes` to see a list with samples) or define you own with the following
276
+ You can define your own theme
277
+
278
+ ```ruby
279
+ WhirledPeas.define_theme(:my_theme) do |theme|
280
+ theme.bg_color = :bright_white
281
+ theme.color = :blue
282
+ theme.border_color = :bright_green
283
+ theme.axis_color = :bright_red
284
+ theme.title_font = :default
285
+ end
286
+ ```
287
+
288
+ Theme settings will be used as default settings throughout the template, however theme settings can be overridden on any element.
266
289
 
267
290
  ##### Alignment
268
291
 
@@ -531,6 +554,8 @@ Scroll settings dictate whether the scrollbar will be shown when child content i
531
554
  - `scrollbar.horiz=(flag)` - show/hide the horizontal scrollbar
532
555
  - `scrollbar.vert=(flag)` - show/hide the vertical scrollbar
533
556
 
557
+ Note: there is a know bug with scrollbars and `center`/`right` alignments. Using `left` alignment is the supported workaround
558
+
534
559
  ##### Border
535
560
 
536
561
  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
@@ -543,8 +568,8 @@ The border settings consist of 6 boolean values (border are either width 1 or no
543
568
  - `border.bottom=(flag)` - show/hide bottom border
544
569
  - `border.inner_horiz=(flag)` - show/hide inner horizontal border (dividing grid rows)
545
570
  - `border.inner_vert=(flag)` - show/hide inner vertical border (dividing grid columns)
546
- - `border.color=(flag)` - set the border color
547
- - `border.style=(flag)` - set the border style
571
+ - `border.color=(text_color)` - set the border color
572
+ - `border.style=(style)` - set the border style
548
573
 
549
574
  Available border styles are
550
575
 
@@ -696,7 +721,265 @@ $ whirled_peas title_fonts
696
721
 
697
722
  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.
698
723
 
699
- ### Example
724
+ #### Easing
725
+
726
+ 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
727
+
728
+ - `:in` - apply easing only to the start of the frameset
729
+ - `:out` - apply easing only to the end of the frameset
730
+ - `:in_out` - apply easing to the start and end of the frameset
731
+
732
+ The available easing functions are
733
+
734
+ - `:bezier`
735
+
736
+ ```
737
+ # bezier (in)
738
+ ┃ ▄▀
739
+ ┃ ▄▄▀
740
+ ┃ ▄▀
741
+ ┃ ▄▀▀
742
+ ┃ ▄▄▀
743
+ ┃ ▄▄▀
744
+ ┃ ▄▄▀
745
+ ┃ ▄▀
746
+ ┃ ▄▄▀▀
747
+ ┃ ▄▄▀
748
+ ┃ ▄▀▀
749
+ ┃ ▄▄▀▀
750
+ ┃ ▄▄▀▀▀
751
+ ┃ ▄▄▄▀▀▀
752
+ ┃▄▄▄▄▄▄▄▄▄▄▀▀▀
753
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
754
+ ```
755
+
756
+ ```
757
+ # bezier (out)
758
+ ┃ ▄▄▄▀▀▀▀▀▀▀▀▀
759
+ ┃ ▄▄▄▀▀▀
760
+ ┃ ▄▄▄▀▀
761
+ ┃ ▄▄▀▀
762
+ ┃ ▄▄▀
763
+ ┃ ▄▀▀
764
+ ┃ ▄▄▀▀
765
+ ┃ ▄▀
766
+ ┃ ▄▀▀
767
+ ┃ ▄▀▀
768
+ ┃ ▄▀▀
769
+ ┃ ▄▄▀
770
+ ┃ ▄▀
771
+ ┃ ▄▀▀
772
+ ┃▄▄▀
773
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
774
+ ```
775
+
776
+ ```
777
+ # bezier (in_out)
778
+ ┃ ▄▄▄▀▀▀▀▀▀
779
+ ┃ ▄▄▀▀
780
+ ┃ ▄▀▀
781
+ ┃ ▄▀▀
782
+ ┃ ▄▀▀
783
+ ┃ ▄▀▀
784
+ ┃ ▄▄▀
785
+ ┃ ▄▀
786
+ ┃ ▄▀▀
787
+ ┃ ▄▄▀
788
+ ┃ ▄▄▀
789
+ ┃ ▄▄▀
790
+ ┃ ▄▄▀
791
+ ┃ ▄▄▀▀
792
+ ┃▄▄▄▄▄▄▄▀▀▀
793
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
794
+ ```
795
+
796
+ `:linear`
797
+
798
+ ```
799
+ # linear (in)
800
+ ┃ ▄▄▀
801
+ ┃ ▄▄▀▀
802
+ ┃ ▄▄▀▀
803
+ ┃ ▄▄▀▀
804
+ ┃ ▄▄▀▀
805
+ ┃ ▄▄▀▀
806
+ ┃ ▄▄▀▀
807
+ ┃ ▄▄▀▀
808
+ ┃ ▄▄▀▀
809
+ ┃ ▄▄▀▀
810
+ ┃ ▄▄▀▀
811
+ ┃ ▄▄▀▀
812
+ ┃ ▄▄▀▀
813
+ ┃ ▄▄▀▀
814
+ ┃▄▄▀▀
815
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
816
+ ```
817
+
818
+ ```
819
+ # linear (out)
820
+ ┃ ▄▄▀
821
+ ┃ ▄▄▀▀
822
+ ┃ ▄▄▀▀
823
+ ┃ ▄▄▀▀
824
+ ┃ ▄▄▀▀
825
+ ┃ ▄▄▀▀
826
+ ┃ ▄▄▀▀
827
+ ┃ ▄▄▀▀
828
+ ┃ ▄▄▀▀
829
+ ┃ ▄▄▀▀
830
+ ┃ ▄▄▀▀
831
+ ┃ ▄▄▀▀
832
+ ┃ ▄▄▀▀
833
+ ┃ ▄▄▀▀
834
+ ┃▄▄▀▀
835
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
836
+ ```
837
+
838
+ ```
839
+ # linear (in_out)
840
+ ┃ ▄▄▀
841
+ ┃ ▄▄▀▀
842
+ ┃ ▄▄▀▀
843
+ ┃ ▄▄▀▀
844
+ ┃ ▄▄▀▀
845
+ ┃ ▄▄▀▀
846
+ ┃ ▄▄▀▀
847
+ ┃ ▄▄▀▀
848
+ ┃ ▄▄▀▀
849
+ ┃ ▄▄▀▀
850
+ ┃ ▄▄▀▀
851
+ ┃ ▄▄▀▀
852
+ ┃ ▄▄▀▀
853
+ ┃ ▄▄▀▀
854
+ ┃▄▄▀▀
855
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
856
+ ```
857
+
858
+ `:parametric`
859
+
860
+ ```
861
+ # parametric (in)
862
+ ┃ ▄
863
+ ┃ ▄▀
864
+ ┃ ▄▀
865
+ ┃ ▄▄▀
866
+ ┃ ▄▀
867
+ ┃ ▄▀
868
+ ┃ ▄▀
869
+ ┃ ▄▄▀
870
+ ┃ ▄▀
871
+ ┃ ▄▀▀
872
+ ┃ ▄▀▀
873
+ ┃ ▄▄▀▀
874
+ ┃ ▄▄▄▀▀
875
+ ┃ ▄▄▄▄▀▀
876
+ ┃▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
877
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
878
+ ```
879
+
880
+ ```
881
+ # parametric (out)
882
+ ┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀
883
+ ┃ ▄▄▀▀▀▀
884
+ ┃ ▄▄▀▀▀
885
+ ┃ ▄▄▀▀
886
+ ┃ ▄▄▀
887
+ ┃ ▄▄▀
888
+ ┃ ▄▀
889
+ ┃ ▄▀▀
890
+ ┃ ▄▀
891
+ ┃ ▄▀
892
+ ┃ ▄▀
893
+ ┃ ▄▀▀
894
+ ┃ ▄▀
895
+ ┃ ▄▀
896
+ ┃▄▀
897
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
898
+ ```
899
+
900
+ ```
901
+ # parametric (in_out)
902
+ ┃ ▄▄▄▀▀▀▀▀▀▀▀▀
903
+ ┃ ▄▄▀▀
904
+ ┃ ▄▀▀
905
+ ┃ ▄▄▀
906
+ ┃ ▄▀
907
+ ┃ ▄▀
908
+ ┃ ▄▀
909
+ ┃ ▄▀
910
+ ┃ ▄▀
911
+ ┃ ▄▀
912
+ ┃ ▄▀
913
+ ┃ ▄▀▀
914
+ ┃ ▄▄▀
915
+ ┃ ▄▄▀▀
916
+ ┃▄▄▄▄▄▄▄▄▄▄▀▀▀
917
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
918
+ ```
919
+
920
+ `:quadratic`
921
+
922
+ ```
923
+ # quadratic (in)
924
+ ┃ ▄▄
925
+ ┃ ▄▀
926
+ ┃ ▄▀
927
+ ┃ ▄▀
928
+ ┃ ▄▀
929
+ ┃ ▄▀▀
930
+ ┃ ▄▀
931
+ ┃ ▄▀▀
932
+ ┃ ▄▀▀
933
+ ┃ ▄▀▀
934
+ ┃ ▄▄▀▀
935
+ ┃ ▄▄▀▀
936
+ ┃ ▄▄▄▀▀
937
+ ┃ ▄▄▄▀▀▀
938
+ ┃▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
939
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
940
+ ```
941
+
942
+ ```
943
+ # quadratic (out)
944
+ ┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀
945
+ ┃ ▄▄▄▀▀▀
946
+ ┃ ▄▄▀▀▀
947
+ ┃ ▄▄▀▀
948
+ ┃ ▄▄▀▀
949
+ ┃ ▄▄▀
950
+ ┃ ▄▄▀
951
+ ┃ ▄▄▀
952
+ ┃ ▄▀
953
+ ┃ ▄▄▀
954
+ ┃ ▄▀
955
+ ┃ ▄▀
956
+ ┃ ▄▀
957
+ ┃ ▄▀
958
+ ┃▄▀▀
959
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
960
+ ```
961
+
962
+ ```
963
+ # quadratic (in_out)
964
+ ┃ ▄▄▄▀▀▀▀▀▀▀
965
+ ┃ ▄▄▀▀▀
966
+ ┃ ▄▀▀
967
+ ┃ ▄▀▀
968
+ ┃ ▄▄▀
969
+ ┃ ▄▀
970
+ ┃ ▄▀
971
+ ┃ ▄▀
972
+ ┃ ▄▀
973
+ ┃ ▄▀
974
+ ┃ ▄▀▀
975
+ ┃ ▄▄▀
976
+ ┃ ▄▄▀
977
+ ┃ ▄▄▄▀▀
978
+ ┃▄▄▄▄▄▄▄▄▀▀▀
979
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
980
+ ```
981
+
982
+ ### Full template example
700
983
 
701
984
  ```ruby
702
985
  class TemplateFactory
@@ -744,64 +1027,120 @@ class TemplateFactory
744
1027
  end
745
1028
  ```
746
1029
 
747
- ### Debugging
1030
+ ### Full usage
1031
+
1032
+ ```
1033
+ Usage: whirled_peas <command> [command options]
1034
+
1035
+ Available commands:
748
1036
 
749
- The `whirled_peas` executable provides some commands that are helpful for debugging.
1037
+ debug Print template tree for specified frame
1038
+ fonts List installed title fonts with sample text
1039
+ frames Print out list of frames generated by application
1040
+ help Show detailed help for a command
1041
+ play Play an animation from an application or prerecorded file
1042
+ record Record animation to a file
1043
+ still Show the specified still frame
1044
+ themes List all themes with sample template rendered in the theme
1045
+ ```
750
1046
 
751
- #### list_frames
1047
+ #### `debug`
752
1048
 
753
- List the frames sent by the driver
1049
+ Print the template tree for specified frame.
754
1050
 
755
1051
  ```
756
- $ whirled_peas <config file> list_frames
757
- Frame 'start' displayed for 5 second(s)
758
- Frame 'move' displayed for 1 frame ({:direction=>'N'})
759
- ...
760
- EOF frame detected
1052
+ # Usage: whirled_peas debug <config file> <frame> [args as a JSON string]
1053
+ % whirled_peas debug my_app.rb greeting '{"name":"World"}'
1054
+ * WhirledPeas::Graphics::BoxPainter(TEMPLATE)
1055
+ - Dimensions(outer=140x27, content=120x15, grid=1x1)
1056
+ - Settings
1057
+ WhirledPeas::Settings::BoxSettings
1058
+ padding: Padding(left: 10, top: 6, right: 10, bottom: 6)
1059
+ align: :center
1060
+ width: 120
1061
+ flow: :t2b
1062
+ bold: true
1063
+ bg_color: BgColor(code=107, bright=true)
1064
+ - Children
1065
+ * WhirledPeas::Graphics::BoxPainter(Element-1)
1066
+ - Dimensions(outer=64x6, content=64x6, grid=1x1)
761
1067
  ```
762
1068
 
763
- #### play_frame
1069
+ #### `fonts`
764
1070
 
765
- Displays a single frame for several seconds
1071
+ List all installed title fonts with sample text.
766
1072
 
767
1073
  ```
768
- $ whirled_peas <config file> play_frame move '{"direction":"N"}'
1074
+ # Usage: whirled_peas fonts
769
1075
  ```
770
1076
 
771
- Adding the `--template` flag will result in printing out debug information for the template, e.g.
1077
+ #### `frames`
1078
+
1079
+ Print out list of frames generated by application.
772
1080
 
773
1081
  ```
774
- $ whirled_peas <config file> play_frame move '{"direction":"N"}' --template
775
- + TEMPLATE [WhirledPeas::Graphics::BoxPainter]
776
- - Settings
777
- WhirledPeas::Settings::BoxSettings
778
- <default>
779
- - Children
780
- + TitleContainer [WhirledPeas::Graphics::BoxPainter]
1082
+ # Usage: whirled_peas frames <config file>
1083
+ % whirled_peas frames my_app.rb
1084
+ Frame 'intro' displayed for 3 second(s) '{"title":"Foo"}'
1085
+ Frame 'greet' displayed for 0.3 second(s)
781
1086
  ...
782
1087
  ```
783
1088
 
784
- Note: the `list_frames` command will print out frame names and arguments formatted for this command
1089
+ #### `help`
1090
+
1091
+ Print out command-specific help message
785
1092
 
786
- #### loading
1093
+ ```
1094
+ Usage: whirled_peas help <command>
1095
+ ```
787
1096
 
788
- Displays the configured loading screen for several seconds
1097
+ #### `play`
1098
+
1099
+ Play an animation from an application or prerecorded file
789
1100
 
790
1101
  ```
791
- $ whirled_peas <config file> loading
1102
+ # Usage: whirled_peas play <config/wpz file>
1103
+
1104
+ # Play animation directly from app
1105
+ % whirled_peas play my_app.rb
1106
+ # Animation plays
1107
+
1108
+ # Play animation from previously recorded file
1109
+ % whirled_peas play my_animation.wpz
1110
+ # Animation plays
792
1111
  ```
793
1112
 
794
- Adding the `--template` flag will result in just printing out the loading template's debug information, e.g.
1113
+ #### `record`
1114
+
1115
+ Record animation to a file
795
1116
 
796
1117
  ```
797
- $ whirled_peas <config file> loading --template
798
- + TEMPLATE [WhirledPeas::Graphics::BoxPainter]
799
- - Settings
800
- WhirledPeas::Settings::BoxSettings
801
- <default>
802
- - Children
803
- + TitleContainer [WhirledPeas::Graphics::BoxPainter]
804
- ...
1118
+ # Usage: whirled_peas record <config file> <output file>
1119
+ % whirled_peas record my_app.rb my_animation.wpz
1120
+ # Record animation to my_animation.wpz
1121
+ ```
1122
+
1123
+ #### `still`
1124
+
1125
+ Show the specified still frame
1126
+
1127
+ ```
1128
+ # Usage: whirled_peas still <config file> <frame> [args as a JSON string]
1129
+ % whirled_peas still my_app.rb greeting '{"name":"World"}'
1130
+ # Still frame is displayed
1131
+ ```
1132
+
1133
+ #### `themes`
1134
+
1135
+ List all themes and display a small sample screen in each. Running this with no extra command line arguments will display all the built-in themes. Adding the path to a Whirled Peas configuration file will inlcude any themes defined in that configuration.
1136
+
1137
+ ```
1138
+ # Usage: whirled_peas themes [config file]
1139
+ % whirled_peas themes
1140
+ # Display all system themes
1141
+
1142
+ % whirled_peas themes my_app.rb
1143
+ # Display app-defined themes and all system themes
805
1144
  ```
806
1145
 
807
1146
  ## Development
@@ -812,23 +1151,31 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
812
1151
 
813
1152
  ### Testing
814
1153
 
815
- In addition to standard RSpec tests, WhirledPeas has custom tests for rendered templates. These files live in `screen_test/rendered`. 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.
1154
+ 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.
816
1155
 
817
1156
  Note: viewing `.frame` files with `cat` works better than most other text editors.
818
1157
 
819
- The following rake tasks are provided to interact with the screen tests
1158
+ ```
1159
+
1160
+ Usage: screen_test [file] [options]
1161
+
1162
+ If not file or options are provide, all tests are run
820
1163
 
821
- - `screen_test` runs all screen tests in the `screen_test/rendered` directory
822
- - `screen_test:debug[path/to/file.rb]` render the screen without printing it, this allows for debug print statments in the code to appear in the terminal
823
- - `screen_test:template[path/to/file.rb]` print the rendered template debug tree
824
- - `screen_test:run[path/to/file.rb]` runs a single screen test
825
- - `screen_test:save[path/to/file.rb]` saves the output generated by the template in the `.frame` file, overwriting any existing file
826
- - `screen_test:view[path/to/file.rb]` views the output generated by the template
827
- - `screen_test:update_all[path/to/file.rb]` interactively step through each pending or failed screen test to compare/set the expected output
1164
+ If no file is provided, the supported options are
1165
+ --help print this usage statement and exit
1166
+ --view-pending interactively display and optionally save rendered output for each pending test
1167
+ --view-failed interactively display and optionally save rendered output for each faiing test
1168
+
1169
+ If a screen test file is provided as the first argument, the supported options are
1170
+ --run run screen test for given file
1171
+ --view interactively display and optionally save the file's test output
1172
+ --template print out template tree for the test template
1173
+ --debug render the test template without displying it, printing out debug information
1174
+ ```
828
1175
 
829
1176
  ## Contributing
830
1177
 
831
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/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/[USERNAME]/whirled_peas/blob/master/CODE_OF_CONDUCT.md).
1178
+ 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).
832
1179
 
833
1180
  ## License
834
1181
 
@@ -836,4 +1183,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
836
1183
 
837
1184
  ## Code of Conduct
838
1185
 
839
- 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/[USERNAME]/whirled_peas/blob/master/CODE_OF_CONDUCT.md).
1186
+ 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).