whirled_peas 0.5.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +31 -0
  5. data/README.md +748 -137
  6. data/Rakefile +4 -32
  7. data/bin/easing +33 -0
  8. data/bin/reset_cursor +11 -0
  9. data/bin/screen_test +68 -0
  10. data/examples/graph.rb +54 -0
  11. data/examples/intro.rb +52 -0
  12. data/examples/scrolling.rb +54 -0
  13. data/lib/whirled_peas.rb +4 -12
  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 +44 -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 +108 -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_line.rb +22 -220
  33. data/lib/whirled_peas/config.rb +56 -6
  34. data/lib/whirled_peas/device.rb +5 -0
  35. data/lib/whirled_peas/device/null_device.rb +8 -0
  36. data/lib/whirled_peas/device/output_file.rb +19 -0
  37. data/lib/whirled_peas/device/screen.rb +26 -0
  38. data/lib/whirled_peas/graphics.rb +14 -0
  39. data/lib/whirled_peas/graphics/box_painter.rb +48 -47
  40. data/lib/whirled_peas/graphics/canvas.rb +22 -11
  41. data/lib/whirled_peas/graphics/composer.rb +98 -0
  42. data/lib/whirled_peas/graphics/container_coords.rb +24 -13
  43. data/lib/whirled_peas/graphics/container_dimensions.rb +37 -9
  44. data/lib/whirled_peas/graphics/container_painter.rb +283 -36
  45. data/lib/whirled_peas/graphics/content_dimensions.rb +19 -0
  46. data/lib/whirled_peas/graphics/content_painter.rb +20 -0
  47. data/lib/whirled_peas/graphics/debugger.rb +10 -1
  48. data/lib/whirled_peas/graphics/graph_dimensions.rb +12 -0
  49. data/lib/whirled_peas/graphics/graph_painter.rb +95 -0
  50. data/lib/whirled_peas/graphics/grid_painter.rb +25 -15
  51. data/lib/whirled_peas/graphics/mock_screen.rb +1 -1
  52. data/lib/whirled_peas/graphics/painter.rb +15 -6
  53. data/lib/whirled_peas/graphics/renderer.rb +13 -30
  54. data/lib/whirled_peas/graphics/text_painter.rb +11 -13
  55. data/lib/whirled_peas/settings/alignment.rb +24 -0
  56. data/lib/whirled_peas/settings/bg_color.rb +2 -0
  57. data/lib/whirled_peas/settings/border.rb +16 -16
  58. data/lib/whirled_peas/settings/color.rb +13 -14
  59. data/lib/whirled_peas/settings/container_settings.rb +133 -40
  60. data/lib/whirled_peas/settings/debugger.rb +9 -0
  61. data/lib/whirled_peas/settings/display_flow.rb +13 -11
  62. data/lib/whirled_peas/settings/element_settings.rb +8 -3
  63. data/lib/whirled_peas/settings/graph_settings.rb +21 -0
  64. data/lib/whirled_peas/settings/grid_settings.rb +15 -0
  65. data/lib/whirled_peas/settings/scrollbar.rb +15 -0
  66. data/lib/whirled_peas/settings/sizing.rb +19 -0
  67. data/lib/whirled_peas/settings/spacing.rb +34 -0
  68. data/lib/whirled_peas/settings/text_color.rb +2 -0
  69. data/lib/whirled_peas/settings/vert_alignment.rb +24 -0
  70. data/lib/whirled_peas/utils/ansi.rb +13 -0
  71. data/lib/whirled_peas/utils/file_handler.rb +57 -0
  72. data/lib/whirled_peas/utils/title_font.rb +1 -1
  73. data/lib/whirled_peas/version.rb +1 -1
  74. data/screen_test/{rendered/elements → elements}/box.frame +1 -1
  75. data/screen_test/{rendered/elements → elements}/box.rb +0 -0
  76. data/screen_test/elements/graph.frame +1 -0
  77. data/screen_test/elements/graph.rb +12 -0
  78. data/screen_test/elements/grid.frame +1 -0
  79. data/screen_test/{rendered/elements → elements}/grid.rb +0 -0
  80. data/screen_test/elements/screen_overflow_x.frame +1 -0
  81. data/screen_test/{rendered/elements/screen_overflow.rb → elements/screen_overflow_x.rb} +0 -0
  82. data/screen_test/elements/screen_overflow_y.frame +1 -0
  83. data/screen_test/elements/screen_overflow_y.rb +9 -0
  84. data/screen_test/elements/text.frame +1 -0
  85. data/screen_test/{rendered/elements → elements}/text.rb +0 -0
  86. data/screen_test/elements/text_multiline.frame +1 -0
  87. data/screen_test/{rendered/elements → elements}/text_multiline.rb +0 -0
  88. data/screen_test/settings/align/box_around.frame +1 -0
  89. data/screen_test/settings/align/box_around.rb +16 -0
  90. data/screen_test/settings/align/box_between.frame +1 -0
  91. data/screen_test/settings/align/box_between.rb +16 -0
  92. data/screen_test/settings/align/box_center.frame +1 -0
  93. data/screen_test/{rendered/settings/align/box.rb → settings/align/box_center.rb} +5 -4
  94. data/screen_test/settings/align/box_default.frame +1 -0
  95. data/screen_test/{rendered/settings/align/grid.rb → settings/align/box_default.rb} +6 -6
  96. data/screen_test/settings/align/box_evenly.frame +1 -0
  97. data/screen_test/settings/align/box_evenly.rb +16 -0
  98. data/screen_test/settings/align/box_left.frame +1 -0
  99. data/screen_test/settings/align/box_left.rb +21 -0
  100. data/screen_test/settings/align/box_right.frame +1 -0
  101. data/screen_test/settings/align/box_right.rb +21 -0
  102. data/screen_test/settings/align/children_center.frame +1 -0
  103. data/screen_test/settings/align/children_center.rb +15 -0
  104. data/screen_test/settings/align/children_left.frame +1 -0
  105. data/screen_test/settings/align/children_left.rb +15 -0
  106. data/screen_test/settings/align/children_right.frame +1 -0
  107. data/screen_test/settings/align/children_right.rb +15 -0
  108. data/screen_test/settings/align/grid_center.frame +1 -0
  109. data/screen_test/settings/align/grid_center.rb +18 -0
  110. data/screen_test/settings/align/grid_default.frame +1 -0
  111. data/screen_test/settings/align/grid_default.rb +17 -0
  112. data/screen_test/settings/align/grid_left.frame +1 -0
  113. data/screen_test/settings/align/grid_left.rb +18 -0
  114. data/screen_test/settings/align/grid_right.frame +1 -0
  115. data/screen_test/settings/align/grid_right.rb +18 -0
  116. data/screen_test/settings/ansi/bold.frame +1 -0
  117. data/screen_test/{rendered/settings/width/overflow_box_t2b.rb → settings/ansi/bold.rb} +4 -5
  118. data/screen_test/{rendered/settings → settings}/ansi/color.frame +1 -1
  119. data/screen_test/{rendered/settings → settings}/ansi/color.rb +0 -0
  120. data/screen_test/settings/ansi/underline.frame +1 -0
  121. data/screen_test/{rendered/settings → settings}/ansi/underline.rb +4 -5
  122. data/screen_test/{rendered/settings → settings}/border.frame +1 -1
  123. data/screen_test/{rendered/settings → settings}/border.rb +1 -1
  124. data/screen_test/settings/flow/box_b2t.frame +1 -0
  125. data/screen_test/settings/flow/box_b2t.rb +26 -0
  126. data/screen_test/settings/flow/box_l2r.frame +1 -0
  127. data/screen_test/settings/flow/box_l2r.rb +26 -0
  128. data/screen_test/settings/flow/box_r2l.frame +1 -0
  129. data/screen_test/settings/flow/box_r2l.rb +26 -0
  130. data/screen_test/settings/flow/box_t2b.frame +1 -0
  131. data/screen_test/settings/flow/box_t2b.rb +26 -0
  132. data/screen_test/settings/flow/grid_b2t.frame +1 -0
  133. data/screen_test/settings/flow/grid_b2t.rb +14 -0
  134. data/screen_test/settings/flow/grid_l2r.frame +1 -0
  135. data/screen_test/{rendered/settings/margin.rb → settings/flow/grid_l2r.rb} +4 -4
  136. data/screen_test/settings/flow/grid_r2l.frame +1 -0
  137. data/screen_test/settings/flow/grid_r2l.rb +14 -0
  138. data/screen_test/settings/flow/grid_t2b.frame +1 -0
  139. data/screen_test/settings/flow/grid_t2b.rb +14 -0
  140. data/screen_test/settings/height/box.frame +1 -0
  141. data/screen_test/{rendered/settings → settings}/height/box.rb +0 -0
  142. data/screen_test/settings/height/box_border_sizing.frame +1 -0
  143. data/screen_test/settings/height/box_border_sizing.rb +15 -0
  144. data/screen_test/settings/height/grid.frame +1 -0
  145. data/screen_test/{rendered/settings → settings}/height/grid.rb +0 -0
  146. data/screen_test/settings/height/overflow_box.frame +1 -0
  147. data/screen_test/settings/height/overflow_box.rb +13 -0
  148. data/screen_test/settings/height/overflow_box_l2r.frame +1 -0
  149. data/screen_test/settings/height/overflow_box_l2r.rb +17 -0
  150. data/screen_test/settings/height/overflow_box_t2b.frame +1 -0
  151. data/screen_test/settings/height/overflow_box_t2b.rb +16 -0
  152. data/screen_test/settings/height/overflow_grid.frame +1 -0
  153. data/screen_test/{rendered/settings → settings}/height/overflow_grid.rb +0 -0
  154. data/screen_test/settings/margin.frame +1 -0
  155. data/screen_test/settings/margin.rb +16 -0
  156. data/screen_test/settings/padding.frame +1 -0
  157. data/screen_test/settings/padding.rb +13 -0
  158. data/screen_test/settings/position/box_left.frame +1 -0
  159. data/screen_test/{rendered/settings → settings}/position/box_left.rb +2 -2
  160. data/screen_test/settings/position/box_left_negative.frame +1 -0
  161. data/screen_test/{rendered/settings → settings}/position/box_left_negative.rb +2 -2
  162. data/screen_test/settings/position/box_top.frame +1 -0
  163. data/screen_test/{rendered/settings → settings}/position/box_top.rb +1 -1
  164. data/screen_test/settings/position/box_top_negative.frame +1 -0
  165. data/screen_test/{rendered/settings → settings}/position/box_top_negative.rb +2 -2
  166. data/screen_test/settings/position/grid_left.frame +1 -0
  167. data/screen_test/{rendered/settings → settings}/position/grid_left.rb +1 -1
  168. data/screen_test/settings/position/grid_left_negative.frame +1 -0
  169. data/screen_test/{rendered/settings → settings}/position/grid_left_negative.rb +1 -1
  170. data/screen_test/settings/position/grid_top.frame +1 -0
  171. data/screen_test/{rendered/settings → settings}/position/grid_top.rb +1 -1
  172. data/screen_test/settings/position/grid_top_negative.frame +1 -0
  173. data/screen_test/{rendered/settings → settings}/position/grid_top_negative.rb +1 -1
  174. data/screen_test/settings/scroll/horiz_box.frame +1 -0
  175. data/screen_test/settings/scroll/horiz_box.rb +17 -0
  176. data/screen_test/settings/scroll/horiz_box_align_center.rb +18 -0
  177. data/screen_test/settings/scroll/horiz_box_align_right.rb +18 -0
  178. data/screen_test/settings/scroll/vert_box.frame +1 -0
  179. data/screen_test/settings/scroll/vert_box.rb +20 -0
  180. data/screen_test/settings/title_font.frame +1 -0
  181. data/screen_test/{rendered/settings → settings}/title_font.rb +1 -1
  182. data/screen_test/settings/valign/box_around.frame +1 -0
  183. data/screen_test/settings/valign/box_around.rb +17 -0
  184. data/screen_test/settings/valign/box_between.frame +1 -0
  185. data/screen_test/settings/valign/box_between.rb +17 -0
  186. data/screen_test/settings/valign/box_bottom.frame +1 -0
  187. data/screen_test/settings/valign/box_bottom.rb +17 -0
  188. data/screen_test/settings/valign/box_default.frame +1 -0
  189. data/screen_test/settings/valign/box_default.rb +16 -0
  190. data/screen_test/settings/valign/box_evenly.frame +1 -0
  191. data/screen_test/settings/valign/box_evenly.rb +17 -0
  192. data/screen_test/settings/valign/box_middle.frame +1 -0
  193. data/screen_test/settings/valign/box_middle.rb +17 -0
  194. data/screen_test/settings/valign/box_top.frame +1 -0
  195. data/screen_test/settings/valign/box_top.rb +17 -0
  196. data/screen_test/settings/valign/grid_bottom.frame +1 -0
  197. data/screen_test/settings/valign/grid_bottom.rb +15 -0
  198. data/screen_test/settings/valign/grid_default.frame +1 -0
  199. data/screen_test/settings/valign/grid_default.rb +14 -0
  200. data/screen_test/settings/valign/grid_middle.frame +1 -0
  201. data/screen_test/settings/valign/grid_middle.rb +15 -0
  202. data/screen_test/settings/valign/grid_top.frame +1 -0
  203. data/screen_test/settings/valign/grid_top.rb +15 -0
  204. data/screen_test/settings/width/box_border_sizing.frame +1 -0
  205. data/screen_test/settings/width/box_border_sizing.rb +15 -0
  206. data/screen_test/settings/width/box_content.frame +1 -0
  207. data/screen_test/settings/width/box_content.rb +15 -0
  208. data/screen_test/settings/width/box_default.frame +1 -0
  209. data/screen_test/{rendered/settings/width/box.rb → settings/width/box_default.rb} +3 -2
  210. data/screen_test/settings/width/grid.frame +1 -0
  211. data/screen_test/{rendered/settings → settings}/width/grid.rb +2 -2
  212. data/screen_test/settings/width/overflow_align_center.frame +1 -0
  213. data/screen_test/settings/width/overflow_align_center.rb +14 -0
  214. data/screen_test/settings/width/overflow_align_right.frame +1 -0
  215. data/screen_test/settings/width/overflow_align_right.rb +14 -0
  216. data/screen_test/settings/width/overflow_box.frame +1 -0
  217. data/screen_test/settings/width/overflow_box.rb +13 -0
  218. data/screen_test/settings/width/overflow_box_l2r.frame +1 -0
  219. data/screen_test/settings/width/overflow_box_l2r.rb +16 -0
  220. data/screen_test/settings/width/overflow_box_t2b.frame +1 -0
  221. data/screen_test/settings/width/overflow_box_t2b.rb +17 -0
  222. data/screen_test/settings/width/overflow_grid.frame +1 -0
  223. data/screen_test/{rendered/settings → settings}/width/overflow_grid.rb +0 -0
  224. data/tools/whirled_peas/tools/screen_tester.rb +285 -0
  225. metadata +192 -98
  226. data/bin/debug +0 -35
  227. data/lib/whirled_peas/debugger.rb +0 -80
  228. data/lib/whirled_peas/frame.rb +0 -6
  229. data/lib/whirled_peas/frame/consumer.rb +0 -30
  230. data/lib/whirled_peas/frame/debug_consumer.rb +0 -30
  231. data/lib/whirled_peas/frame/event_loop.rb +0 -90
  232. data/lib/whirled_peas/frame/producer.rb +0 -67
  233. data/lib/whirled_peas/graphics/screen.rb +0 -65
  234. data/lib/whirled_peas/graphics/text_dimensions.rb +0 -15
  235. data/lib/whirled_peas/settings/text_align.rb +0 -19
  236. data/lib/whirled_peas/template.rb +0 -5
  237. data/lib/whirled_peas/template/box_element.rb +0 -8
  238. data/lib/whirled_peas/template/composer.rb +0 -68
  239. data/lib/whirled_peas/template/container.rb +0 -28
  240. data/lib/whirled_peas/template/debugger.rb +0 -34
  241. data/lib/whirled_peas/template/element.rb +0 -13
  242. data/lib/whirled_peas/template/grid_element.rb +0 -8
  243. data/lib/whirled_peas/template/text_element.rb +0 -24
  244. data/screen_test/rendered/elements/grid.frame +0 -1
  245. data/screen_test/rendered/elements/text.frame +0 -1
  246. data/screen_test/rendered/elements/text_multiline.frame +0 -1
  247. data/screen_test/rendered/settings/align/box.frame +0 -1
  248. data/screen_test/rendered/settings/align/children_center.frame +0 -1
  249. data/screen_test/rendered/settings/align/children_center.rb +0 -13
  250. data/screen_test/rendered/settings/align/children_left.frame +0 -1
  251. data/screen_test/rendered/settings/align/children_left.rb +0 -13
  252. data/screen_test/rendered/settings/align/children_right.frame +0 -1
  253. data/screen_test/rendered/settings/align/children_right.rb +0 -13
  254. data/screen_test/rendered/settings/align/grid.frame +0 -1
  255. data/screen_test/rendered/settings/ansi/bold.frame +0 -1
  256. data/screen_test/rendered/settings/ansi/bold.rb +0 -15
  257. data/screen_test/rendered/settings/ansi/underline.frame +0 -1
  258. data/screen_test/rendered/settings/flow/l2r.frame +0 -1
  259. data/screen_test/rendered/settings/flow/l2r.rb +0 -24
  260. data/screen_test/rendered/settings/flow/t2b.frame +0 -1
  261. data/screen_test/rendered/settings/flow/t2b.rb +0 -24
  262. data/screen_test/rendered/settings/height/box.frame +0 -1
  263. data/screen_test/rendered/settings/height/grid.frame +0 -1
  264. data/screen_test/rendered/settings/height/overflow_box.frame +0 -1
  265. data/screen_test/rendered/settings/height/overflow_box.rb +0 -13
  266. data/screen_test/rendered/settings/height/overflow_box_l2r.frame +0 -1
  267. data/screen_test/rendered/settings/height/overflow_box_l2r.rb +0 -15
  268. data/screen_test/rendered/settings/height/overflow_box_t2b.frame +0 -1
  269. data/screen_test/rendered/settings/height/overflow_box_t2b.rb +0 -14
  270. data/screen_test/rendered/settings/height/overflow_grid.frame +0 -1
  271. data/screen_test/rendered/settings/margin.frame +0 -1
  272. data/screen_test/rendered/settings/padding.frame +0 -1
  273. data/screen_test/rendered/settings/padding.rb +0 -11
  274. data/screen_test/rendered/settings/position/box_left.frame +0 -1
  275. data/screen_test/rendered/settings/position/box_left_negative.frame +0 -1
  276. data/screen_test/rendered/settings/position/box_top.frame +0 -1
  277. data/screen_test/rendered/settings/position/box_top_negative.frame +0 -1
  278. data/screen_test/rendered/settings/position/grid_left.frame +0 -1
  279. data/screen_test/rendered/settings/position/grid_left_negative.frame +0 -1
  280. data/screen_test/rendered/settings/position/grid_top.frame +0 -1
  281. data/screen_test/rendered/settings/position/grid_top_negative.frame +0 -1
  282. data/screen_test/rendered/settings/title_font.frame +0 -1
  283. data/screen_test/rendered/settings/width/box.frame +0 -1
  284. data/screen_test/rendered/settings/width/grid.frame +0 -1
  285. data/screen_test/rendered/settings/width/overflow_box.frame +0 -1
  286. data/screen_test/rendered/settings/width/overflow_box.rb +0 -11
  287. data/screen_test/rendered/settings/width/overflow_box_l2r.frame +0 -1
  288. data/screen_test/rendered/settings/width/overflow_box_l2r.rb +0 -14
  289. data/screen_test/rendered/settings/width/overflow_box_t2b.frame +0 -1
  290. data/screen_test/rendered/settings/width/overflow_grid.frame +0 -1
  291. data/screen_test/screen_tester.rb +0 -191
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b374c9d4250b281d3f87284f446e82c01ece7ff2fe196687be50502b2e42960
4
- data.tar.gz: 0ebd7b96a154277121767eb8c33d63b831db37770ff0172b76f28fcf89c5dec9
3
+ metadata.gz: 7553fd2ea78bf560098d8be8cd3987f1e8a686cb000cf6ea082a922512764069
4
+ data.tar.gz: 8fa1e64c35b311ae9346badc0198f556528c53dad9bfa0b99b2805c901369b8f
5
5
  SHA512:
6
- metadata.gz: f6dcc7dc00852a343f55056646db886903bc5735a21bd9af71a885e28ff70aa85bb3f26ff4f97c23dc4292fa401c1c624284c347b17fb957fb8e0069301b7ef9
7
- data.tar.gz: 1f0ae0e07baf45703dff90396be7b6c705f17f8c9cb4fcd4e0b4b433513efc94dd8c3a056f50f1d3f47f7e3179c308d36264ef4e4be0c179815e650a6136a11a
6
+ metadata.gz: 531b93061429918f99dc5aa7de09a53a7fda218c97bac57b47d5a450ad22510207f71ba5a095f5a1939e4cce9d1f13d70a981e15b4e3209d0786ba12be048bd6
7
+ data.tar.gz: ea7daec0ccd65894bec99bfff75219d55dfc2cd9fc7b80d1e593b60e7a15a3e8eb7cbfa49e8ef20e8da5acbce2738d054cf56a9b0231661e46a5c399c83b8906
data/.gitignore CHANGED
@@ -11,4 +11,5 @@ Gemfile.lock
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
14
+ *.wpz
14
15
 
@@ -6,3 +6,4 @@ rvm:
6
6
  - 2.7.2
7
7
  - 3.0.0
8
8
  before_install: gem install bundler -v 2.1.4
9
+ script: bundle exec rake ci
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.9.0 - 2021-01-29
4
+
5
+ BREAKING: `Frameset#add_frame` signature changed
6
+
7
+ - [1c28947](https://github.com/tcollier/whirled_peas/tree/1c28947980eedce034d2596732ee4860717904c5): Add graph support
8
+
9
+ ## v0.8.0 - 2021-01-29
10
+
11
+ BREAKING: `Producer` now responds to `#add_frame` instead of `#send_frame`
12
+
13
+ - [67fdc17](https://github.com/tcollier/whirled_peas/tree/67fdc172434cb97f31ca20a674f28aefec6babb3): Add easing functions for frame transitions
14
+ - [b888f2e](https://github.com/tcollier/whirled_peas/tree/b888f2e7a3b7c3341300326b417641cc8cf2e89b): Add record and playback functionality to command line tool
15
+
16
+ ## v0.7.1 - 2021-01-27
17
+
18
+ - [b98781d](https://github.com/tcollier/whirled_peas/tree/b98781de23a24b596955f25cfc48936c0cc1efac): Fix num_cols bug for vertical grid flow
19
+
20
+ ## v0.7.0 - 2021-01-27
21
+
22
+ BREAKING: the settings for the template now fills the full screen and disallows margin.
23
+
24
+ - [b7c12c2](https://github.com/tcollier/whirled_peas/tree/b7c12c2c34d7077b9c2496d05ddd0c6d1eb90699): Update template to fill full screen with border sizing
25
+ - [963b819](https://github.com/tcollier/whirled_peas/tree/963b8196f0d046ba03c893f07e5578bf8c88b7a3): Implement vertical alignment
26
+ - [4bddd54](https://github.com/tcollier/whirled_peas/tree/4bddd54bec5c8f93d145c285379c1816f313f35e): Add `between`, `around`, and `evenly` alignments
27
+
28
+ ## v0.6.0 - 2021-01-25
29
+
30
+ - [73df2af](https://github.com/tcollier/whirled_peas/tree/73df2af1f1eac37fe94f720dce16da1ed568dade): Add support for scroll bars along both axes
31
+ - [f4f44e1](https://github.com/tcollier/whirled_peas/tree/f4f44e1ff6c75ed03cd682e3fa9921401dcd2d00): Implement remaining 3 flow directions for grids
32
+ - [c01d083](https://github.com/tcollier/whirled_peas/tree/c01d083e10bf70983109a8def836bb181099f59c): Implement reverse flow directions for grids
33
+
3
34
  ## v0.5.0 - 2021-01-25
4
35
 
5
36
  BREAKING: there was a significant amount of structural refactoring in this release. While that aspect did not add or remove any features, it fixed several layout bugs (some known and some unknown), so most template with moderate complexity will now be laid out slightly differently.
data/README.md CHANGED
@@ -1,8 +1,24 @@
1
1
  [![Build Status](https://travis-ci.com/tcollier/whirled_peas.svg?branch=main)](https://travis-ci.com/tcollier/whirled_peas)
2
2
 
3
- # WhirledPeas
3
+ ```
4
+ ██╗ ██╗██╗███████╗██╗ ██╗ █████╗ ██╗ ██╗███████╗███████╗
5
+ ██║ ██║██║██╔════╝██║ ██║██╔══██╗██║ ██║╚══███╔╝██╔════╝
6
+ ██║ ██║██║███████╗██║ ██║███████║██║ ██║ ███╔╝ █████╗
7
+ ╚██╗ ██╔╝██║╚════██║██║ ██║██╔══██║██║ ██║ ███╔╝ ██╔══╝
8
+ ╚████╔╝ ██║███████║╚██████╔╝██║ ██║███████╗██║███████╗███████╗
9
+ ╚═══╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚══════╝
10
+
11
+ your code's execution with
12
+
13
+ ██╗ ██╗██╗ ██╗██╗██████╗ ██╗ ███████╗██████╗ ██████╗ ███████╗ █████╗ ███████╗
14
+ ██║ ██║██║ ██║██║██╔══██╗██║ ██╔════╝██╔══██╗ ██╔══██╗██╔════╝██╔══██╗██╔════╝
15
+ ██║ █╗ ██║███████║██║██████╔╝██║ █████╗ ██║ ██║ ██████╔╝█████╗ ███████║███████╗
16
+ ██║███╗██║██╔══██║██║██╔══██╗██║ ██╔══╝ ██║ ██║ ██╔═══╝ ██╔══╝ ██╔══██║╚════██║
17
+ ╚███╔███╔╝██║ ██║██║██║ ██║███████╗███████╗██████╔╝ ██║ ███████╗██║ ██║███████║
18
+ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝
19
+ ```
4
20
 
5
- Visualize your code's execution with Whirled Peas!
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.
6
22
 
7
23
  ## Installation
8
24
 
@@ -24,9 +40,8 @@ Or install it yourself as:
24
40
 
25
41
  A Whirled Peas application consists of the following pieces
26
42
 
27
- - The driver (required) - the code that is to be visualized, it emits lightweight frame events through a producer
28
- - The main template factory (required) - builds templates to convert frame events from the driver into terminal graphics
29
- - 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
30
45
 
31
46
  These pieces are configured as following
32
47
 
@@ -46,15 +61,15 @@ class TemplateFactory
46
61
  end
47
62
  end
48
63
 
49
- class Driver
64
+ class Application
50
65
  def start(producer)
51
- producer.send_frame('starting', args: { name: 'World' })
66
+ producer.add_frame('starting', args: { name: 'World' })
52
67
  # ...
53
68
  end
54
69
  end
55
70
 
56
71
  WhirledPeas.configure do |config|
57
- config.driver = Driver.new
72
+ config.application = Application.new
58
73
  config.template_factory = TemplateFactory.new
59
74
  end
60
75
  ```
@@ -62,34 +77,12 @@ end
62
77
  Then the visualizer is started on the command line with
63
78
 
64
79
  ```
65
- $ whirled_peas start visualize.rb
66
- ```
67
-
68
- The optional loading screen can be configured like
69
-
70
- ```ruby
71
- class LoadingTemplateFactory
72
- def build
73
- WhirledPeas.template do |composer|
74
- composer.add_box('Loading') do |_, settings|
75
- settings.set_margin(top: 15)
76
- settings.align = :center
77
- settings.full_border(color: :blue, style: :double)
78
- "Loading..."
79
- end
80
- end
81
- end
82
- end
83
-
84
- WhirledPeas.configure do |config|
85
- # ...
86
- config.loading_template_factory = LoadingTemplateFactory.new
87
- end
80
+ $ whirled_peas play visualize.rb
88
81
  ```
89
82
 
90
- ### Driver
83
+ ### Application
91
84
 
92
- 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
93
86
 
94
87
  ```ruby
95
88
  # Start the application and pass frame events to the producer to be rendered by the UI
@@ -100,16 +93,33 @@ def start(producer)
100
93
  end
101
94
  ```
102
95
 
103
- The producer provides a single method
96
+ The producer provides the following methods
104
97
 
105
98
  ```ruby
106
- # Send frame events to the UI
99
+ # Add a frame to be displayed
107
100
  #
108
101
  # @param name [String] application defined name for the frame. The template factory will be provided this name
109
102
  # @param duration [Number] time in seconds this frame should be displayed for (defaults to 1 frame)
110
103
  # @param args [Hash<Symbol, Object>] key value pairs to send as arguments to the template factory
111
- def send_frame(name, duration:, args:)
112
- # implementation
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:)
113
123
  end
114
124
  ```
115
125
 
@@ -120,48 +130,50 @@ end
120
130
  Simple application that loads a set of numbers and looks for a pair that adds up to 1,000
121
131
 
122
132
  ```ruby
123
- class Driver
133
+ class Application
124
134
  def start(producer)
125
135
  numbers = File.readlines('/path/to/numbers.txt').map(&:to_i)
126
- producer.send_frame('load-numbers', duration: 3, args: { numbers: numbers })
136
+ producer.add_frame('load-numbers', duration: 3, args: { numbers: numbers })
127
137
  numbers.sort!
128
- producer.send_frame('sort-numbers', duration: 3, args: { numbers: numbers })
138
+ producer.add_frame('sort-numbers', duration: 3, args: { numbers: numbers })
129
139
  low = 0
130
140
  high = numbers.length - 1
131
141
  while low < high
132
142
  sum = numbers[low] + numbers[high]
133
143
  if sum == 1000
134
- producer.send_frame('found-pair', duration: 5, args: { low: low, high: high, sum: sum })
144
+ producer.add_frame('found-pair', duration: 5, args: { low: low, high: high, sum: sum })
135
145
  return
136
146
  elsif sum < 1000
137
- producer.send_frame('too-low', args: { low: low, high: high, sum: sum })
147
+ producer.add_frame('too-low', args: { low: low, high: high, sum: sum })
138
148
  low += 1
139
149
  else
140
- producer.send_frame('too-high', args: { low: low, high: high, sum: sum })
150
+ producer.add_frame('too-high', args: { low: low, high: high, sum: sum })
141
151
  high -= 1
142
152
  end
143
153
  end
144
- producer.send_frame('no-solution', duration: 5)
154
+ producer.add_frame('no-solution', duration: 5)
145
155
  end
146
156
  end
147
157
  ```
148
158
 
149
159
  ### Template Factory
150
160
 
151
- 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.
152
-
153
- #### Loading Template Factory
154
-
155
- `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.
156
162
 
157
163
  #### Building Blocks
158
164
 
159
- A template is created with `WhirledPeas.template`, which yields a `Composer` object for a `BoxElement` 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.
160
171
 
161
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).
162
173
 
163
- - `add_box` - yields a `Composer` and a `BoxSettings`, which will be added to the parent's children
164
- - `add_grid` - yields a `Composer` and a `GridSettings`, which will be added to the parent's children
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
176
+ - `add_grid` - yields a `Composer` for a `Grid` and a `GridSettings`, which will be added to the parent's children
165
177
  - `add_text` - yields `nil` and a `TextSettings`, which will be added to the parent's children
166
178
 
167
179
  E.g.
@@ -192,7 +204,7 @@ WhirledPeas.template do |composer, settings|
192
204
  end
193
205
  ```
194
206
 
195
- Additionally, if no child element is explicitly added to a `GridElement`, but the block returns an array of strings or numbers, those will be converted to `TextElements` and added as children to the `GridElement`. For example, these are identical ways to create a grid of strings
207
+ Additionally, if no child element is explicitly added to a `Grid`, but the block returns an array of strings or numbers, those will be converted to `Text` elements and added as children to the `Grid`. For example, these are identical ways to create a grid of strings
196
208
 
197
209
  ```ruby
198
210
  template.add_grid do |composer|
@@ -206,7 +218,7 @@ template.add_grid do
206
218
  end
207
219
  ```
208
220
 
209
- Similarly, if no child element is explicilty added to a `BoxElement`, but the block returns a string or number, that value will be converted to a `TextElement` and added as a child. For example, these are identical ways to create a box with string content
221
+ Similarly, if no child element is explicilty added to a `Box`, but the block returns a string or number, that value will be converted to a `Text` and added as a child. For example, these are identical ways to create a box with string content
210
222
 
211
223
  ```ruby
212
224
  template.add_box do |composer|
@@ -223,22 +235,212 @@ end
223
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
224
236
  The available settigs are
225
237
 
226
- | Setting | Description | Default | Availability | Inherited |
227
- | ------------ | ------------------------------------------------------------------------------- | ------- | --------------------- | -------------------- |
228
- | `align` | Justifies the content (allowed values: `:left`, `:center`, `:right`) | `:left` | `Box`, `Grid` | Yes |
229
- | `bg_color` | Background color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
230
- | `bold` | `true` makes the font bold | `false` | `Box`, `Grid`, `Text` | Yes |
231
- | `border` | Set the border for the lements | none | `Box`, `Grid`, | Only style and color |
232
- | `color` | Foreground text color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
233
- | `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` | `Box`, `Grid` | Yes |
234
- | `height` | Override the calculated height of an element's content area | | `Box`, `Grid` | No |
235
- | `margin` | Set the (left, top, right, bottom) margin of the element | `0` | `Box`, `Grid` | No |
236
- | `num_cols` | Number of columns in the grid (must be set!) | | `Grid` | No |
237
- | `padding` | Set the (left, top, right, bottom) padding of the element | `0` | `Box`, `Grid` | No |
238
- | `position` | Set the (left, top) position of the element relative to parent content area | `0` | `Box`, `Grid` | No |
239
- | `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text` | No |
240
- | `underline` | `true` underlines the font | `false` | `Box`, `Grid`, `Text` | Yes |
241
- | `width` | Override the calculated width of an element's content area | | `Box`, `Grid` | No |
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
+ ```
242
444
 
243
445
  ##### Position
244
446
 
@@ -246,11 +448,56 @@ Position settings dictate the relative position from where the painter would hav
246
448
 
247
449
  - `set_position(left:, top:)`
248
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
+
249
490
  ##### Margin
250
491
 
251
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
252
493
 
253
- - `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
254
501
 
255
502
  Note: values cannot be negative
256
503
 
@@ -258,16 +505,40 @@ Note: values cannot be negative
258
505
 
259
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
260
507
 
261
- - `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
262
515
 
263
516
  Note: values cannot be negative
264
517
 
518
+ ##### Scrollbar
519
+
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)
521
+
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
527
+
265
528
  ##### Border
266
529
 
267
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
268
531
 
269
- - `set_border(left:, top:, right:, bottom:, inner_horiz:, inner_vert:, color:, style:)`
270
- - `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
271
542
 
272
543
  Available border styles are
273
544
 
@@ -308,31 +579,71 @@ Child elements can flow in one of 4 directions
308
579
  - `:l2r` left-to-right
309
580
 
310
581
  ```
311
- [child 1] [child 2] ... [child N]
582
+ # In a Box
583
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
584
+ ┃[child 1] [child 2] ... [child N]┃
585
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
586
+
587
+ # In a Grid
588
+ ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
589
+ ┃[child 1]┃[child 2]┃[child 3]┃
590
+ ┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
591
+ ┃[chiid 4]┃[child 5]┃ ┃
592
+ ┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
312
593
  ```
313
594
 
314
595
  - `:r2l` right-to-left
315
596
 
316
597
  ```
317
- [child N] [child N - 1] ... [child 1]
598
+ # In a Box
599
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
600
+ ┃[child N] [child N - 1] ... [child 1]┃
601
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
602
+
603
+ # In a Grid
604
+ ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
605
+ ┃[child 3]┃[child 2]┃[child 1]┃
606
+ ┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
607
+ ┃ ┃[chiid 5]┃[child 4]┃
608
+ ┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
318
609
  ```
319
610
 
320
611
  - `:t2b` top-to-bottom
321
612
 
322
613
  ```
323
- [child 1]
324
- [child 2]
325
- ...
326
- [child N]
614
+ # In a Box
615
+ ┏━━━━━━━━━┓
616
+ ┃[child 1]┃
617
+ [child 2]
618
+ ┃ ... ┃
619
+ ┃[child N]┃
620
+ ┗━━━━━━━━━┛
621
+
622
+ # In a Grid
623
+ ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
624
+ ┃[child 1]┃[child 3]┃[child 5]┃
625
+ ┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
626
+ ┃[child 2]┃[child 4]┃ ┃
627
+ ┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
327
628
  ```
328
629
 
329
630
  - `:b2t` bottom-to-top
330
631
 
331
632
  ```
332
- [child N]
333
- [child N - 1]
334
- ...
335
- [child 1]
633
+ # In a Box
634
+ ┏━━━━━━━━━━━━━┓
635
+ ┃[child N] ┃
636
+ [child N - 1]
637
+ ┃ ... ┃
638
+ ┃[child 1] ┃
639
+ ┗━━━━━━━━━━━━━┛
640
+
641
+ # In a Grid
642
+ ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
643
+ ┃[child 2]┃[child 4]┃ ┃
644
+ ┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
645
+ ┃[child 1]┃[child 3]┃[child 5]┃
646
+ ┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
336
647
  ```
337
648
 
338
649
  ##### Colors
@@ -360,7 +671,7 @@ Many of these also have a "bright" option:
360
671
 
361
672
  ##### Large Text
362
673
 
363
- The `title_font` setting for `TextElement`s converts the standard terminal font into a large block font. The available fonts vary from system to system. Every system will have a `:default` font available, this font could look like
674
+ The `title_font` setting for `Text`s converts the standard terminal font into a large block font. The available fonts vary from system to system. Every system will have a `:default` font available, this font could look like
364
675
 
365
676
  ```
366
677
  ██████╗ ███████╗███████╗ █████╗ ██╗ ██╗██╗ ████████╗
@@ -379,7 +690,265 @@ $ whirled_peas title_fonts
379
690
 
380
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.
381
692
 
382
- ### Example
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
383
952
 
384
953
  ```ruby
385
954
  class TemplateFactory
@@ -427,77 +996,106 @@ class TemplateFactory
427
996
  end
428
997
  ```
429
998
 
430
- ### Debugging
999
+ ### Full usage
431
1000
 
432
- The `whirled_peas` executable provides some commands that are helpful for debugging.
1001
+ ```
1002
+ Usage: whirled_peas <command> [command options]
1003
+
1004
+ Available commands:
433
1005
 
434
- #### list_frames
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
+ ```
435
1014
 
436
- List the frames sent by the driver
1015
+ #### `debug`
1016
+
1017
+ Print the template tree for specified frame.
437
1018
 
438
1019
  ```
439
- $ whirled_peas <config file> list_frames
440
- Frame 'start' displayed for 5 second(s)
441
- Frame 'move' displayed for 1 frame ({:direction=>'N'})
442
- ...
443
- EOF frame detected
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)
444
1035
  ```
445
1036
 
446
- #### play_frame
1037
+ #### `fonts`
447
1038
 
448
- Displays a single frame for several seconds
1039
+ List all installed title fonts with sample text.
449
1040
 
450
1041
  ```
451
- $ whirled_peas <config file> play_frame move '{"direction":"N"}'
1042
+ # Usage: whirled_peas fonts
452
1043
  ```
453
1044
 
454
- Adding the `--template` flag will result in printing out debug information for the template, e.g.
1045
+ #### `frames`
1046
+
1047
+ Print out list of frames generated by application.
455
1048
 
456
1049
  ```
457
- $ whirled_peas <config file> play_frame move '{"direction":"N"}' --template
458
- + TEMPLATE [WhirledPeas::Template::BoxElement]
459
- - Settings
460
- WhirledPeas::Settings::BoxSettings
461
- <default>
462
- - Children
463
- + TitleContainer [WhirledPeas::Template::BoxElement]
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)
464
1054
  ...
465
1055
  ```
466
1056
 
467
- Adding the `--painter` flag will result in printing out debug information the painter (the rendered template), e.g.
1057
+ #### `help`
1058
+
1059
+ Print out command-specific help message
468
1060
 
469
1061
  ```
470
- $ whirled_peas <config file> play_frame move '{"direction":"N"}' --painter
471
- + TEMPLATE [WhirledPeas::Graphics::BoxPainter]
472
- - Settings
473
- WhirledPeas::Settings::BoxSettings
474
- <default>
475
- - Dimensions
476
- - Canvas:
477
- - Children
478
- + TitleContainer [WhirledPeas::Graphics::BoxPainter]
479
- ...
1062
+ Usage: whirled_peas help <command>
480
1063
  ```
481
1064
 
482
- #### loading
1065
+ #### `play`
483
1066
 
484
- Displays the configured loading screen for several seconds
1067
+ Play an animation from an application or prerecorded file
485
1068
 
486
1069
  ```
487
- $ whirled_peas <config file> loading
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
488
1079
  ```
489
1080
 
490
- Adding the `--debug` flag will result in just printing out the loading template's debug information, e.g.
1081
+ #### `record`
1082
+
1083
+ Record animation to a file
491
1084
 
492
1085
  ```
493
- $ whirled_peas <config file> loading --debug
494
- + TEMPLATE [WhirledPeas::UI::Template]
495
- - Settings
496
- WhirledPeas::UI::TemplateSettings
497
- <default>
498
- - Children
499
- + TitleContainer [WhirledPeas::UI::BoxElement]
500
- ...
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
1089
+ ```
1090
+
1091
+ #### `still`
1092
+
1093
+ Show the specified still frame
1094
+
1095
+ ```
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
501
1099
  ```
502
1100
 
503
1101
  ## Development
@@ -508,18 +1106,27 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
508
1106
 
509
1107
  ### Testing
510
1108
 
511
- 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.
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.
512
1110
 
513
1111
  Note: viewing `.frame` files with `cat` works better than most other text editors.
514
1112
 
515
- The following rake tasks are provided to interact with the screen tests
1113
+ ```
1114
+
1115
+ Usage: screen_test [file] [options]
1116
+
1117
+ If not file or options are provide, all tests are run
1118
+
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
516
1123
 
517
- - `screen_test` runs all screen tests in the `screen_test/rendered` directory
518
- - `screen_test:debug[path/to/file.rb]` print the rendered template debug tree
519
- - `screen_test:run[path/to/file.rb]` runs a single screen test
520
- - `screen_test:save[path/to/file.rb]` saves the output generated by the template in the `.frame` file, overwriting any existing file
521
- - `screen_test:view[path/to/file.rb]` views the output generated by the template
522
- - `screen_test:update_all[path/to/file.rb]` interactively step through each pending or failed screen test to compare/set the expected output
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
+ ```
523
1130
 
524
1131
  ## Contributing
525
1132
 
@@ -532,3 +1139,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
532
1139
  ## Code of Conduct
533
1140
 
534
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/[USERNAME]/whirled_peas/blob/master/CODE_OF_CONDUCT.md).
1142
+
1143
+ ```
1144
+
1145
+ ```