squib 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.travis.yml +5 -3
  4. data/CHANGELOG.md +24 -2
  5. data/README.md +2 -4
  6. data/RELEASE TODO.md +1 -0
  7. data/Rakefile +1 -1
  8. data/docs/arrays.rst +5 -2
  9. data/docs/build_groups.rst +15 -17
  10. data/docs/colors.rst +29 -3
  11. data/docs/conf.py +3 -3
  12. data/docs/config.rst +14 -1
  13. data/docs/data.rst +8 -4
  14. data/docs/dsl/configure.rst +18 -0
  15. data/docs/dsl/csv.rst +19 -0
  16. data/docs/dsl/data_frame.rst +85 -0
  17. data/docs/dsl/disable_build.rst +1 -4
  18. data/docs/dsl/disable_build_globally.rst +46 -0
  19. data/docs/dsl/enable_build.rst +1 -1
  20. data/docs/dsl/enable_build_globally.rst +44 -0
  21. data/docs/dsl/save_pdf.rst +44 -3
  22. data/docs/dsl/showcase.rst +11 -0
  23. data/docs/dsl/text.rst +3 -5
  24. data/docs/dsl/xlsx.rst +6 -0
  25. data/docs/guides/game_icons.rst +124 -4
  26. data/docs/guides/getting-started/part_1_zero_to_game.rst +4 -3
  27. data/docs/guides/getting-started/part_2_iconography.rst +92 -16
  28. data/docs/guides/getting-started/part_3_workflows.rst +43 -1
  29. data/docs/guides/getting-started/part_4_ruby_power.rst +18 -0
  30. data/docs/guides/git.rst +2 -1
  31. data/docs/guides/guard.rst +84 -0
  32. data/docs/guides/hello_world.rst +63 -4
  33. data/docs/guides/projects.rst +35 -0
  34. data/docs/install.rst +3 -1
  35. data/docs/layouts.rst +3 -3
  36. data/docs/learning.rst +3 -1
  37. data/docs/parameters.rst +14 -6
  38. data/docs/text_feature.rst +42 -13
  39. data/docs/units.rst +9 -1
  40. data/lib/squib/api/data.rb +6 -5
  41. data/lib/squib/api/groups.rb +14 -7
  42. data/lib/squib/api/save.rb +2 -1
  43. data/lib/squib/args/sheet.rb +57 -2
  44. data/lib/squib/card.rb +8 -0
  45. data/lib/squib/conf.rb +9 -1
  46. data/lib/squib/deck.rb +2 -1
  47. data/lib/squib/graphics/save_doc.rb +0 -45
  48. data/lib/squib/graphics/save_pdf.rb +85 -0
  49. data/lib/squib/graphics/showcase.rb +1 -1
  50. data/lib/squib/import/data_frame.rb +108 -0
  51. data/lib/squib/version.rb +1 -1
  52. data/samples/autoscale_font/.gitignore +2 -0
  53. data/samples/autoscale_font/card_00_expected.png +0 -0
  54. data/samples/backend/.gitignore +1 -0
  55. data/samples/backend/_backend-config.yml +5 -0
  56. data/samples/backend/_backend.rb +2 -9
  57. data/samples/backend/backend_00_expected.png +0 -0
  58. data/samples/backend/backend_01_expected.png +0 -0
  59. data/samples/backend/backend_vectorized_expected.pdf +0 -0
  60. data/samples/backend/backend_vectors_00_expected.svg +84 -0
  61. data/samples/backend/backend_vectors_01_expected.svg +84 -0
  62. data/samples/backend/shiny-purse.png +0 -0
  63. data/samples/backend/showcase_expected.png +0 -0
  64. data/samples/backend/spanner.svg +91 -0
  65. data/samples/build_groups/.gitignore +1 -0
  66. data/samples/build_groups/Rakefile +25 -0
  67. data/samples/colors/.gitignore +1 -0
  68. data/samples/colors/color_constants_00_expected.png +0 -0
  69. data/samples/colors/colors_00_expected.png +0 -0
  70. data/samples/colors/gradient_00_expected.png +0 -0
  71. data/samples/data/.gitignore +1 -0
  72. data/samples/data/explode_quantities.xlsx +0 -0
  73. data/samples/data/quantity_explosion.csv +3 -0
  74. data/samples/data/sample.csv +3 -0
  75. data/samples/data/sample.xlsx +0 -0
  76. data/samples/data/sample_csv_00_expected.png +0 -0
  77. data/samples/data/sample_csv_01_expected.png +0 -0
  78. data/samples/data/sample_csv_qty_00_expected.png +0 -0
  79. data/samples/data/sample_excel_00_expected.png +0 -0
  80. data/samples/data/sample_excel_01_expected.png +0 -0
  81. data/samples/data/sample_excel_02_expected.png +0 -0
  82. data/samples/data/sample_excel_resources_00_expected.png +0 -0
  83. data/samples/data/sample_excel_resources_01_expected.png +0 -0
  84. data/samples/data/sample_xlsx_qty_00_expected.png +0 -0
  85. data/samples/images/.gitignore +8 -0
  86. data/samples/images/_images_00_expected.png +0 -0
  87. data/samples/images/angler-fish.png +0 -0
  88. data/samples/images/ball.png +0 -0
  89. data/samples/images/glass-heart.svg +52 -0
  90. data/samples/images/grit.png +0 -0
  91. data/samples/images/offset.svg +85 -0
  92. data/samples/images/robot-golem.svg +1 -0
  93. data/samples/images/shiny-purse.png +0 -0
  94. data/samples/images/spanner.svg +91 -0
  95. data/samples/images/sprites.png +0 -0
  96. data/samples/images/with-alpha.png +0 -0
  97. data/samples/intro/.gitignore +2 -0
  98. data/samples/intro/auto-repair.svg +1 -0
  99. data/samples/intro/crawling.svg +1 -0
  100. data/samples/intro/data.xlsx +0 -0
  101. data/samples/intro/humans.svg +1 -0
  102. data/samples/intro/ninja-mask.svg +1 -0
  103. data/samples/intro/part1_00_expected.png +0 -0
  104. data/samples/intro/part2_00_expected.png +0 -0
  105. data/samples/intro/part3_00_expected.png +0 -0
  106. data/samples/intro/part3_layout.yml +34 -0
  107. data/samples/intro/part4_00_expected.png +0 -0
  108. data/samples/intro/part4_01_expected.png +0 -0
  109. data/samples/intro/part5_00_expected.png +0 -0
  110. data/samples/intro/part5_01_expected.png +0 -0
  111. data/samples/intro/part5_02_expected.png +0 -0
  112. data/samples/intro/part5_03_expected.png +0 -0
  113. data/samples/intro/part5_hand_expected.png +0 -0
  114. data/samples/intro/part5_showcase_expected.png +0 -0
  115. data/samples/intro/pirate-skull.svg +1 -0
  116. data/samples/intro/robot-golem.svg +1 -0
  117. data/samples/project/Gemfile +6 -0
  118. data/samples/project/Guardfile +18 -0
  119. data/samples/project/Rakefile +25 -0
  120. data/samples/project/bw/robot-golem.svg +53 -0
  121. data/samples/project/color/robot-golem.svg +1 -0
  122. data/samples/project/config.yml +2 -0
  123. data/samples/project/layouts/characters.yml +3 -0
  124. data/samples/project/layouts/skills.yml +3 -0
  125. data/samples/project/src/characters.rb +8 -0
  126. data/samples/project/src/skills.rb +7 -0
  127. data/samples/{ranges.rb → ranges/_ranges.rb} +0 -0
  128. data/samples/ranges/glass-heart.svg +52 -0
  129. data/samples/ranges/ranges_00_expected.png +0 -0
  130. data/samples/saves/.gitignore +1 -0
  131. data/samples/saves/_save_pdf.rb +18 -0
  132. data/samples/saves/hand_expected.png +0 -0
  133. data/samples/saves/hand_pretty_expected.png +0 -0
  134. data/samples/saves/save-pdf-small_expected.pdf +0 -0
  135. data/samples/saves/save-pdf_expected.pdf +0 -0
  136. data/samples/saves/save_png_00_expected.png +0 -0
  137. data/samples/saves/save_png_trimmed_00_expected.png +0 -0
  138. data/samples/saves/save_sheet_00_expected.png +0 -0
  139. data/samples/saves/save_sheet_01_expected.png +0 -0
  140. data/samples/saves/save_sheet_range_00_expected.png +0 -0
  141. data/samples/saves/save_sheet_range_01_expected.png +0 -0
  142. data/samples/saves/save_single_sheet_00_expected.png +0 -0
  143. data/samples/saves/saves_notrim_01_expected.png +0 -0
  144. data/samples/saves/showcase2_expected.png +0 -0
  145. data/samples/saves/showcase_expected.png +0 -0
  146. data/samples/saves/showcase_individual_00_expected.png +0 -0
  147. data/samples/saves/showcase_individual_01_expected.png +0 -0
  148. data/samples/saves/showcase_individual_02_expected.png +0 -0
  149. data/samples/saves/showcase_individual_03_expected.png +0 -0
  150. data/samples/saves/spanner.svg +91 -0
  151. data/samples/shapes/.gitignore +1 -0
  152. data/samples/shapes/shape_00_expected.png +0 -0
  153. data/samples/text/.gitignore +2 -0
  154. data/samples/text/README.md +1 -0
  155. data/samples/text/_text_00_expected.png +0 -0
  156. data/samples/text/config.yml +2 -0
  157. data/samples/units/_units.rb +32 -0
  158. data/samples/units/units_00_expected.png +0 -0
  159. data/samples/units/using_units.yml +10 -0
  160. data/spec/api/api_data_spec.rb +18 -18
  161. data/spec/api/api_groups_spec.rb +49 -0
  162. data/spec/args/sheet_spec.rb +24 -2
  163. data/spec/conf_spec.rb +8 -0
  164. data/spec/data/conf/basic.yml +1 -0
  165. data/spec/data/samples/autoscale_font/_autoscale_font.rb.txt +3 -0
  166. data/spec/data/samples/basic.rb.txt +3 -0
  167. data/spec/data/samples/cairo_access.rb.txt +2 -0
  168. data/spec/data/samples/colors/_gradients.rb.txt +1 -0
  169. data/spec/data/samples/config_text_markup.rb.txt +2 -0
  170. data/spec/data/samples/custom_config.rb.txt +1 -0
  171. data/spec/data/samples/data/_csv.rb.txt +6 -0
  172. data/spec/data/samples/data/_excel.rb.txt +13 -0
  173. data/spec/data/samples/embed_text.rb.txt +4 -0
  174. data/spec/data/samples/hello_world.rb.txt +2 -0
  175. data/spec/data/samples/images/_more_load_images.rb.txt +1 -0
  176. data/spec/data/samples/{ranges.rb.txt → ranges/_ranges.rb.txt} +3 -0
  177. data/spec/data/samples/saves/_hand.rb.txt +8 -0
  178. data/spec/data/samples/saves/_portrait_landscape.rb.txt +2 -0
  179. data/spec/data/samples/saves/_save_pdf.rb.txt +1505 -449
  180. data/spec/data/samples/saves/_saves.rb.txt +16 -0
  181. data/spec/data/samples/saves/_showcase.rb.txt +4 -0
  182. data/spec/data/samples/shapes/_draw_shapes.rb.txt +1 -0
  183. data/spec/data/samples/text_options.rb.txt +3 -0
  184. data/spec/data/samples/tgc_proofs.rb.txt +1 -0
  185. data/spec/data/samples/{units.rb.txt → units/_units.rb.txt} +20 -15
  186. data/spec/deck_spec.rb +7 -0
  187. data/spec/graphics/graphics_save_doc_spec.rb +2 -1
  188. data/spec/import/data_frame_spec.rb +251 -0
  189. data/spec/samples/run_samples_spec.rb +1 -1
  190. data/spec/samples/samples_regression_spec.rb +3 -2
  191. data/squib.gemspec +6 -6
  192. metadata +144 -24
  193. data/.gitmodules +0 -36
  194. data/samples/units.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc3e963811aff757de4bb9fdbe27a512e108ea3f
4
- data.tar.gz: 94098850ead4d37cae33a5040aa47f6fdf284c24
3
+ metadata.gz: 0608aabb4ced2bce20fa90269f10747796ec296e
4
+ data.tar.gz: cd08eebeaf494d3f116d045be57a04120aff27e2
5
5
  SHA512:
6
- metadata.gz: 768da6ac1f30e27a6f50de8acc7e38ab82b466ed78b4fab69375c62de5deaae03bf3387bea76d6a0a778c2f76736335794bd7e4f28c37224a2e78d0ba4241e65
7
- data.tar.gz: 153722e40cc1a4c3fe04ce30672d6489133d9ef5b692deac675b0705f92a6f04f90358c93a196120bb4a5e8d2e73c244cd77cfea88c10e4d986e6fb9aef77d24
6
+ metadata.gz: 6129e710a9b678f0c17ec360030f206ce30a7315eeaf133ddcfe662544240b8e67e68ee79c81400934434f0f8f49a62a6f619b52b74fde6e25e9053195243866
7
+ data.tar.gz: 1b8c6fe2cb4d580daec68d5cfcec00cf2f7b79eafe03b06d957eab8d3c7c0861204dd6d44d8ff4779a17d44d5554ca4a6cc50779d9258fc16de576a6b93b7757
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ _yardoc
11
11
  coverage
12
12
  docs/_build*
13
13
  doc/
14
+ docs/_build
14
15
  lib/bundler/man
15
16
  pkg
16
17
  rdoc
@@ -28,6 +29,7 @@ samples/_img
28
29
  samples/_output/*.png
29
30
  samples/_output/*.pdf
30
31
  samples/_output/foo
32
+ samples/**/_output/*
31
33
  rubocop.txt
32
34
  benchmarks/_output/*.png
33
35
  benchmarks/_output/*.pdf
@@ -36,3 +38,4 @@ samples/_output/*.svg
36
38
  *.sublime-workspace
37
39
  spec/samples/sanity.html
38
40
  spec/samples/_diffs/*.png
41
+ .byebug_history
@@ -1,6 +1,7 @@
1
1
  dist: trusty
2
2
  language: ruby
3
- sudo: false # taking advantage of container-based infrastructure
3
+ sudo: true # need this for libgirepository1.0-dev
4
+ # sudo: false # taking advantage of container-based infrastructure
4
5
  cache: bundler # cache bundled gems from build to build
5
6
 
6
7
  addons:
@@ -10,7 +11,8 @@ addons:
10
11
 
11
12
  rvm:
12
13
  - 2.2
13
- - 2.3.0
14
+ - 2.3.3
15
+ - 2.4.0-preview3
14
16
  matrix:
15
17
  allow_failures:
16
- - rvm: 2.3.0
18
+ - rvm: 2.4.0-preview3
@@ -1,7 +1,29 @@
1
1
  # Squib CHANGELOG
2
2
  Squib follows [semantic versioning](http://semver.org).
3
3
 
4
- ## v0.11.0 / Unreleased
4
+ ## v0.12.0 / Unreleased
5
+
6
+ Features:
7
+ * `save_pdf` now supports crop marks! These are lines drawn in the margins of a PDF file to help you cut. These can be enabled by setting `crop_marks: true` in your `save_pdf` call. Can be further customized with `crop_margin_bottom`, `crop_margin_left`, `crop_margin_right`, `crop_margin_top`, `crop_marks`, `crop_stroke_color`, `crop_stroke_dash`, and `crop_stroke_width` (#123)
8
+ * `Squib.configure` allows you to set options programmatically, overriding your config.yml. This is useful for Rakefiles, and will be documented in my upcoming tutorial on workflows.
9
+ * `Squib.enable_build_globally` and `Squib.disable_build_globally` are new convenience methods for working with the `SQUIB_BUILD` environment variable. Handy for Rakefiles and Guard sessions for turning certain builds on an off. Also will be documented in upcoming workflow tutorial.
10
+ * The import methods `csv` and `xlsx` now return `Squib::DataFrame`, which behaves exactly as before - but has more cool features like being able to do `data.name` instead of `data['name']`. Also: check out `data.to_pretty_text`. Check out the docs. (#156)
11
+
12
+ Bugs:
13
+ * `showcase` works as expected when using `backend: svg` (#179)
14
+ * Graphics will get flushed upon exit, so working under Guard with `backend: svg` is more reliable (#180)
15
+
16
+ Docs:
17
+ * Wrote out documentation for [Squib and GameIcons](http://squib.readthedocs.io/en/latest/guides/game_icons.html)
18
+ * Wrote out documentation for Hello World! Dissected
19
+ * Un-submoduled our samples and simply embedded them into the docs (e.g. [Squib Thinks in Arrays](http://squib.readthedocs.io/en/latest/arrays.html)). Lots of cleanup there
20
+ * Wrote up [Squib in Action](http://squib.readthedocs.io/en/latest/guides/projects.html), which documents other Squib projects. Ask for yours to be put there!!
21
+
22
+ Chores:
23
+ * Bumped dependency roo to 2.5.1. Nothing that affects Squib users (probably).
24
+ * Bumped graphics and text dependencies (cairo to 1.15.3, pango+rsvg et al. to 3.1.0). No new features for us, but some stability improvements.
25
+
26
+ ## v0.11.0 / 2016-09-05
5
27
 
6
28
  Features:
7
29
  * Unit conversion supports mm (#161)
@@ -18,7 +40,7 @@ Bugs:
18
40
  * Unit conversion is supported when using `extends` in layouts, as promised in the docs (#173)
19
41
 
20
42
  Compatibility:
21
- * I reworked the way icons are embedded, and that was a big change internally (#177). We're now using Pango's API in the expected way and not dealing with "undefined behavior" situations with zero-sized fonts and obscure UTF-8 characters as we were before. But, as a result, Pango handles custom shapes a little differently than before. Wrapping doesn't render exactly the same way as before, although it's acceptable in most cases. If you still find problems, please file a bug.
43
+ * I reworked the way icons are embedded, and that was a big change internally (#177). We're now using Pango's API in the expected way and not dealing with "undefined behavior" situations with zero-sized fonts and obscure UTF-8 characters as we were before. But, as a result, Pango handles custom shapes acd little differently than before. Wrapping doesn't render exactly the same way as before, although it's acceptable in most cases. If you still find problems, please file a bug.
22
44
 
23
45
  Special thanks to everyone who tested, reported, suggested, and helped for this release! bcompter, rhyok, temetherian, rpond-pa, Nibodhika, briant-spindance, lcarlsen, spilth
24
46
 
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Squib [![Gem Version](https://badge.fury.io/rb/squib.svg)](https://rubygems.org/gems/squib) [![Build Status](https://secure.travis-ci.org/andymeneely/squib.svg?branch=master)](https://travis-ci.org/andymeneely/squib) [![Vey][vey]][vey_url] [![Dependency Status](https://gemnasium.com/andymeneely/squib.svg)](https://gemnasium.com/andymeneely/squib) [![Coverage Status](https://img.shields.io/coveralls/andymeneely/squib.svg)](https://coveralls.io/r/andymeneely/squib) [![ReadTheDocs](https://readthedocs.org/projects/squib/badge/?version=latest)](http://squib.readthedocs.io/en/latest/?badge=latest) [![BoardGameGeek](https://cdn.rawgit.com/andymeneely/squib/gh-pages/images/microbadge.png)](https://boardgamegeek.com/guild/2601)
2
- Squib is a Ruby [DSL](http://en.wikipedia.org/wiki/Domain-specific_language) for prototyping card and board games. Write a little bit of Ruby, define your deck's stats, then compile your game into a series of images ready for print-and-play or even print-on-demand. Squib is very data-driven and built on the principle of Don't Repeat Yourself. Think of it like [nanDeck](http://www.nand.it/nandeck/) done "the Ruby way". Squib supports:
1
+ # Squib [![Gem Version](https://badge.fury.io/rb/squib.svg)](https://rubygems.org/gems/squib) [![Build Status](https://secure.travis-ci.org/andymeneely/squib.svg?branch=master)](https://travis-ci.org/andymeneely/squib) [![Build status](https://ci.appveyor.com/api/projects/status/ptjw6fvjh73anlau/branch/master?svg=true)](https://ci.appveyor.com/project/andymeneely/squib/branch/master) [![Dependency Status](https://gemnasium.com/andymeneely/squib.svg)](https://gemnasium.com/andymeneely/squib) [![Coverage Status](https://img.shields.io/coveralls/andymeneely/squib.svg)](https://coveralls.io/r/andymeneely/squib) [![ReadTheDocs](https://readthedocs.org/projects/squib/badge/?version=latest)](http://squib.readthedocs.io/en/latest/?badge=latest) [![BoardGameGeek](https://cdn.rawgit.com/andymeneely/squib/gh-pages/images/microbadge.png)](https://boardgamegeek.com/guild/2601)
3
2
 
4
- [vey]: https://ci.appveyor.com/api/projects/status/github/andymeneely/squib?svg=true
5
- [vey_url]: https://ci.appveyor.com/project/andymeneely/squib
3
+ Squib is a Ruby [DSL](http://en.wikipedia.org/wiki/Domain-specific_language) for prototyping card and board games. Write a little bit of Ruby, define your deck's stats, then compile your game into a series of images ready for print-and-play or even print-on-demand. Squib is very data-driven and built on the principle of Don't Repeat Yourself. Think of it like [nanDeck](http://www.nand.it/nandeck/) done "the Ruby way". Squib supports:
6
4
 
7
5
  * A concise set of rules for laying out your cards
8
6
  * Loading PNGs and SVGs
@@ -3,6 +3,7 @@ Be sure to remember to do the following for releases. (Copy into a GitHub issue)
3
3
  - [ ] CHANGELOG is written for all new changes
4
4
  - [ ] README is updated
5
5
  - [ ] Samples are updated
6
+ - [ ] Are all the dependencies up to date?
6
7
  - [ ] Check `sample_regression_spec.rb` regression tests are all enabled (i.e. `overwrite_sample` is commented out)
7
8
  - [ ] Bump version.rb
8
9
  - [ ] Bump docs/conf.py versions
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'benchmark'
4
4
  # require 'byebug'
5
5
 
6
6
  desc 'install + spec'
7
- task default: [:install, :spec]
7
+ task default: ['install:local', :spec]
8
8
 
9
9
  # Useful for hooking up with SublimeText.
10
10
  # e.g. rake sample[basic.rb]
@@ -66,10 +66,13 @@ Examples
66
66
 
67
67
  Here are a few recipes for using arrays and ranges in practice:
68
68
 
69
- .. raw:: HTML
69
+ .. literalinclude:: ../samples/ranges/_ranges.rb
70
+ :language: ruby
71
+ :linenos:
70
72
 
71
- <script src="https://gist.github.com/andymeneely/25b0da2a84ab906bd44b.js"></script>
73
+ .. raw:: html
72
74
 
75
+ <img src="ranges/ranges_00_expected.png">
73
76
 
74
77
  Contribute Recipes!
75
78
  -------------------
@@ -9,36 +9,34 @@ Squib's Build Groups help you with these situations. By grouping your Squib code
9
9
 
10
10
  Here's a basic example:
11
11
 
12
- .. raw:: html
12
+ .. literalinclude:: ../samples/build_groups/build_groups.rb
13
+ :language: ruby
14
+ :linenos:
13
15
 
14
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
15
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js"></script>
16
- <code data-gist-id="bda48487e3b8c9d15edb" data-gist-file="build_groups.rb"></code>
17
-
18
- Only one group is enabled by default: ``:all``. All other groups are disabled by default. To see which groups are enabled currently, the :doc:`/dsl/groups` returns the set.
16
+ Only one group is enabled by default: ``:all``. All other groups are disabled by default. To see which groups are enabled currently, the :doc:`/dsl/build_groups` returns the set.
19
17
 
20
18
  Groups can be enabled and disabled in several ways:
21
19
 
22
- * The :doc:`/dsl/enable_group` and :doc:`/dsl/disable_group` DSL methods can explicitly enable/disable a group. Again, you're back to commenting out the *enable_group* call, but that's easier than remembering what lines to comment out each time.
23
- * When a ``Squib::Deck`` is initialized, the `environment variable <https://en.wikipedia.org/wiki/Environment_variable>`_ ``SQUIB_BUILD`` is consulted for a comma-separated string. These are converted to Ruby symbols and the corresponding groups are enabled.
20
+ * The :doc:`/dsl/enable_build` and :doc:`/dsl/disable_build` DSL methods within a given ``Squib::Deck`` can explicitly enable/disable a group. Again, you're back to commenting out the *enable_group* call, but that's easier than remembering what lines to comment out each time.
21
+ * When a ``Squib::Deck`` is initialized, the `environment variable <https://en.wikipedia.org/wiki/Environment_variable>`_ ``SQUIB_BUILD`` is consulted for a comma-separated string. These are converted to Ruby symbols and the corresponding groups are enabled. This is handy for enabling builds on the command line (e.g. turn on color, work in that for a while, then turn it off)
22
+ * Furthermore, you can use :doc:`Squib.enable_build_globally </dsl/enable_build_globally>` and :doc:`Squib.disable_build_globally </dsl/disable_build_globally>` to manipulate ``SQUIB_BUILD`` environment variable programmatically (e.g. from a Rakefile, inside a `Guard <https://github.com/guard/guard>`_ session, or other build script).
24
23
 
25
- Note that the environment variables are intended to change from run to run, from the command line (see above gist for examples in various OS's).
24
+ The :doc:`/guides/getting-started/part_3_workflows` tutorial covers how to work these features into your workflow.
26
25
 
27
26
  .. note::
28
27
 
29
- There should be no need to set the SQUIB_BUILD variable globally on your system.
30
-
31
- Don't like how Windows specifies environment variables? One adaptation of this is to do the environment setting in a ``Rakefile``. Rake is the build utility that comes with Ruby, and it allows us to set different tasks exactly in this way. This Rakefile works nicely with our above code example:
28
+ There should be no need to set the SQUIB_BUILD variable globally on your system (e.g. at boot). The intent is to set SQUIB_BUILD as part of your session.
32
29
 
30
+ One adaptation of this is to do the environment setting in a ``Rakefile``. `Rake <https://ruby.github.io/rake/>`_ is the build utility that comes with Ruby, and it allows us to set different tasks exactly in this way. This Rakefile works nicely with our above code example:
33
31
 
34
- .. raw:: html
35
32
 
36
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
37
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js"></script>
38
- <code data-gist-id="bda48487e3b8c9d15edb" data-gist-file="Rakefile"></code>
33
+ .. literalinclude:: ../samples/build_groups/Rakefile
34
+ :language: ruby
35
+ :linenos:
39
36
 
37
+ Thus, you can just run this code on the command line like these:
40
38
 
41
- Thus, you can just run this code with commands like these::
39
+ .. code-block:: none
42
40
 
43
41
  $ rake
44
42
  $ rake pnp
@@ -40,7 +40,7 @@ by custom name
40
40
  In your ``config.yml``, as described in :doc:`/config`, you can specify custom names of colors. For example, ``'foreground'``.
41
41
 
42
42
  Gradients
43
- --------
43
+ ---------
44
44
 
45
45
  In most places where colors are allowed, you may also supply a string that defines a gradient. Squib supports two flavors of gradients: linear and radial. Gradients are specified by supplying some xy coordinates, which are relative to the card (not the command). Each stop must be between ``0.0`` and ``1.0``, and you can supply as many as you like. Colors can be specified as above (in any of the hex notations or built-in constant). If you add two or more colors at the same stop, then the gradient keeps the colors in the in order specified and treats it like sharp transition.
46
46
 
@@ -60,5 +60,31 @@ In both of these formats, whitespace is ignored between tokens so as to make com
60
60
 
61
61
  If you need something more powerful than these two types of gradients (e.g. mesh gradients), then we suggest encapsulating your logic within an SVG and using the :doc:`/dsl/svg` method to render it.
62
62
 
63
- Examples
64
- --------
63
+ Samples
64
+ -------
65
+
66
+ Code is maintained in the `repository here <https://github.com/andymeneely/squib/tree/master/samples>`_ in case you need some of the assets referenced.
67
+
68
+ Sample: colors and color constants
69
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70
+
71
+ .. literalinclude:: ../samples/colors/_colors.rb
72
+ :language: ruby
73
+ :linenos:
74
+
75
+ .. raw:: html
76
+
77
+ <img src="colors/colors_00_expected.png" width=600 class="figure">
78
+
79
+ <img src="colors/color_constants_00_expected.png" width=600 class="figure">
80
+
81
+ Sample: gradients
82
+ ^^^^^^^^^^^^^^^^^
83
+
84
+ .. literalinclude:: ../samples/colors/_gradients.rb
85
+ :language: ruby
86
+ :linenos:
87
+
88
+ .. raw:: html
89
+
90
+ <img src="colors/gradient_00_expected.png" width=600 class="figure">
@@ -55,9 +55,9 @@ author = u'Andy Meneely'
55
55
  # built documents.
56
56
  #
57
57
  # The short X.Y version.
58
- version = u'v0.11'
58
+ version = u'v0.12'
59
59
  # The full version, including alpha/beta/rc tags.
60
- release = u'v0.11.0'
60
+ release = u'v0.12.0'
61
61
 
62
62
  # The language for content autogenerated by Sphinx. Refer to documentation
63
63
  # for a list of supported languages.
@@ -74,7 +74,7 @@ language = None
74
74
 
75
75
  # List of patterns, relative to source directory, that match files and
76
76
  # directories to ignore when looking for source files.
77
- exclude_patterns = ['_build']
77
+ exclude_patterns = ['_build', 'args/*.rst']
78
78
 
79
79
  # The reST default role (used for this markup: `text`) to use for all
80
80
  # documents.
@@ -47,7 +47,7 @@ prefix
47
47
 
48
48
  img_dir
49
49
  default: ``'.'``
50
-
50
+
51
51
  For reading image file command (e.g. png and svg), read from this directory instead
52
52
 
53
53
  warn_ellipsize
@@ -111,6 +111,19 @@ For debugging/sanity purposes, if you want to make sure your configuration optio
111
111
  puts backend # prints 'memory' by default
112
112
  end
113
113
 
114
+ These are read-only - you will not be able to change these.
115
+
116
+ Squib.configure sets options programmatically
117
+ ---------------------------------------------
118
+
119
+ You can also use :doc:`/dsl/configure` to override anything in the config file. Use it like this:
120
+
121
+ .. literalinclude:: ../samples/project/Rakefile
122
+ :language: ruby
123
+ :linenos:
124
+
125
+
126
+ See :doc:`/guides/getting-started/part_3_workflows` for how we put this to good use.
114
127
 
115
128
  Making Squib Verbose
116
129
  --------------------
@@ -3,10 +3,12 @@ Be Data-Driven with XLSX and CSV
3
3
 
4
4
  Squib supports importing data from ExcelX (.xlsx) files and Comma-Separated Values (.csv) files. Because :doc:`/arrays`, these methods are column-based, which means that they assume you have a header row in your table, and that header row will define the name of the column.
5
5
 
6
- Hash of Arrays
7
- --------------
6
+ Squib::DataFrame, or a Hash of Arrays
7
+ -------------------------------------
8
8
 
9
- In both DSL methods, Squib will return a ``Hash`` of ``Arrays`` correspoding to each row. Thus, be sure to structure your data like this:
9
+ In both DSL methods, Squib will return a "data frame" (literally of type ``Squib::DataFrame``). The best way to think of this is a ``Hash`` of ``Arrays``, where each column is a key in the hash, and every element of each Array represents a data point on a card.
10
+
11
+ The data import methods expect you to structure your Excel sheet or CSV like this:
10
12
 
11
13
  * First row should be a header - preferably with concise naming since you'll reference it in Ruby code
12
14
  * Rows should represent cards in the deck
@@ -14,7 +16,9 @@ In both DSL methods, Squib will return a ``Hash`` of ``Arrays`` correspoding to
14
16
 
15
17
  Of course, you can always import your game data other ways using just Ruby (e.g. from a REST API, a JSON file, or your own custom format). There's nothing special about Squib's methods in how they relate to ``Squib::Deck`` other than their convenience.
16
18
 
17
- See :doc:`/dsl/xlsx` and :doc:`/dsl/csv` for more details and examples.
19
+ See :doc:`/dsl/xlsx` and :doc:`/dsl/csv` for more details and examples on how the data can be imported.
20
+
21
+ The ``Squib::DataFrame`` class provides much more than what a ``Hash`` provides, however. The :doc:`/dsl/data_frame`
18
22
 
19
23
  Quantity Explosion
20
24
  ------------------
@@ -0,0 +1,18 @@
1
+ Squib.configure
2
+ ---------------
3
+
4
+ Prior to the construction of a Squib::Deck, set a global default that overrides what is specified `config.yml`.
5
+
6
+ This is intended to be done prior to Squib::Deck.new, and is intended to be used inside of a Rakefile
7
+
8
+ Options
9
+ ^^^^^^^
10
+
11
+ All options that are specified in :doc:`/config`
12
+
13
+ Exmaples
14
+ ^^^^^^^^
15
+
16
+ .. literalinclude:: ../../samples/project/Rakefile
17
+ :language: ruby
18
+ :linenos:
@@ -60,3 +60,22 @@ The ``xlsx`` method also takes in a block that will be executed for each cell in
60
60
 
61
61
  Examples
62
62
  --------
63
+
64
+
65
+ To get the sample Excel files, go to `its source <https://github.com/andymeneely/squib/tree/dev/samples/data>`_
66
+
67
+ .. literalinclude:: ../../samples/data/_csv.rb
68
+ :language: ruby
69
+ :linenos:
70
+
71
+ Here's the sample.csv
72
+
73
+ .. literalinclude:: ../../samples/data/sample.csv
74
+ :language: text
75
+ :linenos:
76
+
77
+ Here's the quantity_explosion.csv
78
+
79
+ .. literalinclude:: ../../samples/data/quantity_explosion.csv
80
+ :language: text
81
+ :linenos:
@@ -0,0 +1,85 @@
1
+ Squib::DataFrame
2
+ ================
3
+
4
+ As described in :doc:`/data`, the ``Squib::DataFrame`` is what is returned by Squib's data import methods (:doc:`/dsl/csv` and :doc:`/dsl/xlsx`).
5
+
6
+ It behaves like a ``Hash`` of ``Arrays``, so acessing an individual column can be done via the square brackets, e.g. ``data['title']``.
7
+
8
+ Here are some other convenience methods in ``Squib::DataFrame``
9
+
10
+ columns become methods
11
+ ----------------------
12
+
13
+ Through magic of Ruby metaprogramming, every column also becomes a method on the data frame. So these two are equivalent:
14
+
15
+ .. code-block:: irb
16
+
17
+ irb(main):002:0> data = Squib.csv file: 'basic.csv'
18
+ => #<Squib::DataFrame:0x00000003764550 @hash={"h1"=>[1, 3], "h2"=>[2, 4]}>
19
+ irb(main):003:0> data.h1
20
+ => [1, 3]
21
+ irb(main):004:0> data['h1']
22
+ => [1, 3]
23
+
24
+ #columns
25
+ --------
26
+
27
+ Returns an array of the column names in the data frame
28
+
29
+ #ncolumns
30
+ ---------
31
+
32
+ Returns the number of columns in the data frame
33
+
34
+ #col?(name)
35
+ -----------
36
+
37
+ Returns ``true`` if there is column ``name``.
38
+
39
+ #row(i)
40
+ -------
41
+
42
+ Returns a hash of values across all columns in the ``i``th row of the dataframe. Represents a single card.
43
+
44
+ #nrows
45
+ ------
46
+
47
+ Returns the number of rows the data frame has, computed by the maximum length of any column array.
48
+
49
+ #to_json
50
+ --------
51
+
52
+ Returns a ``json`` representation of the entire data frame.
53
+
54
+ #to_pretty_json
55
+ ---------------
56
+
57
+ Returns a ``json`` representation of the entire data frame, formatted with indentation for human viewing.
58
+
59
+ #to_pretty_text
60
+ ---------------
61
+
62
+ Returns a textual representation of the dataframe that emulates what the information looks like on an individual card. Here's an example:
63
+
64
+ .. code-block:: text
65
+
66
+ ╭------------------------------------╮
67
+ Name | Mage |
68
+ Cost | 1 |
69
+ Description | You may cast 1 spell per turn |
70
+ Snark | Magic, dude. |
71
+ ╰------------------------------------╯
72
+ ╭------------------------------------╮
73
+ Name | Rogue |
74
+ Cost | 2 |
75
+ Description | You always take the first turn. |
76
+ Snark | I like to be sneaky |
77
+ ╰------------------------------------╯
78
+ ╭------------------------------------╮
79
+ Name | Warrior |
80
+ Cost | 3 |
81
+ Description |
82
+ Snark | I have a long story to tell to tes |
83
+ | t the word-wrapping ability of pre |
84
+ | tty text formatting. |
85
+ ╰------------------------------------╯
@@ -1,7 +1,7 @@
1
1
  disable_build
2
2
  =============
3
3
 
4
- Disable the given build group for the rest of the build. Thus, code within the corresponding :doc:`/dsl/group` block will not be executed. See :doc:`/build_groups` for ways to use this effectively.
4
+ Disable the given build group for the rest of the build. Thus, code within the corresponding :doc:`/dsl/build` block will not be executed. See :doc:`/build_groups` for ways to use this effectively.
5
5
 
6
6
 
7
7
  Required Arguments
@@ -11,9 +11,6 @@ build_group_name
11
11
  default: ``:all``
12
12
  the name of the group to disable. Convention is to use a Ruby symbol.
13
13
 
14
- .. note::
15
-
16
-
17
14
 
18
15
  Examples
19
16
  --------