squib 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +5 -3
- data/CHANGELOG.md +24 -2
- data/README.md +2 -4
- data/RELEASE TODO.md +1 -0
- data/Rakefile +1 -1
- data/docs/arrays.rst +5 -2
- data/docs/build_groups.rst +15 -17
- data/docs/colors.rst +29 -3
- data/docs/conf.py +3 -3
- data/docs/config.rst +14 -1
- data/docs/data.rst +8 -4
- data/docs/dsl/configure.rst +18 -0
- data/docs/dsl/csv.rst +19 -0
- data/docs/dsl/data_frame.rst +85 -0
- data/docs/dsl/disable_build.rst +1 -4
- data/docs/dsl/disable_build_globally.rst +46 -0
- data/docs/dsl/enable_build.rst +1 -1
- data/docs/dsl/enable_build_globally.rst +44 -0
- data/docs/dsl/save_pdf.rst +44 -3
- data/docs/dsl/showcase.rst +11 -0
- data/docs/dsl/text.rst +3 -5
- data/docs/dsl/xlsx.rst +6 -0
- data/docs/guides/game_icons.rst +124 -4
- data/docs/guides/getting-started/part_1_zero_to_game.rst +4 -3
- data/docs/guides/getting-started/part_2_iconography.rst +92 -16
- data/docs/guides/getting-started/part_3_workflows.rst +43 -1
- data/docs/guides/getting-started/part_4_ruby_power.rst +18 -0
- data/docs/guides/git.rst +2 -1
- data/docs/guides/guard.rst +84 -0
- data/docs/guides/hello_world.rst +63 -4
- data/docs/guides/projects.rst +35 -0
- data/docs/install.rst +3 -1
- data/docs/layouts.rst +3 -3
- data/docs/learning.rst +3 -1
- data/docs/parameters.rst +14 -6
- data/docs/text_feature.rst +42 -13
- data/docs/units.rst +9 -1
- data/lib/squib/api/data.rb +6 -5
- data/lib/squib/api/groups.rb +14 -7
- data/lib/squib/api/save.rb +2 -1
- data/lib/squib/args/sheet.rb +57 -2
- data/lib/squib/card.rb +8 -0
- data/lib/squib/conf.rb +9 -1
- data/lib/squib/deck.rb +2 -1
- data/lib/squib/graphics/save_doc.rb +0 -45
- data/lib/squib/graphics/save_pdf.rb +85 -0
- data/lib/squib/graphics/showcase.rb +1 -1
- data/lib/squib/import/data_frame.rb +108 -0
- data/lib/squib/version.rb +1 -1
- data/samples/autoscale_font/.gitignore +2 -0
- data/samples/autoscale_font/card_00_expected.png +0 -0
- data/samples/backend/.gitignore +1 -0
- data/samples/backend/_backend-config.yml +5 -0
- data/samples/backend/_backend.rb +2 -9
- data/samples/backend/backend_00_expected.png +0 -0
- data/samples/backend/backend_01_expected.png +0 -0
- data/samples/backend/backend_vectorized_expected.pdf +0 -0
- data/samples/backend/backend_vectors_00_expected.svg +84 -0
- data/samples/backend/backend_vectors_01_expected.svg +84 -0
- data/samples/backend/shiny-purse.png +0 -0
- data/samples/backend/showcase_expected.png +0 -0
- data/samples/backend/spanner.svg +91 -0
- data/samples/build_groups/.gitignore +1 -0
- data/samples/build_groups/Rakefile +25 -0
- data/samples/colors/.gitignore +1 -0
- data/samples/colors/color_constants_00_expected.png +0 -0
- data/samples/colors/colors_00_expected.png +0 -0
- data/samples/colors/gradient_00_expected.png +0 -0
- data/samples/data/.gitignore +1 -0
- data/samples/data/explode_quantities.xlsx +0 -0
- data/samples/data/quantity_explosion.csv +3 -0
- data/samples/data/sample.csv +3 -0
- data/samples/data/sample.xlsx +0 -0
- data/samples/data/sample_csv_00_expected.png +0 -0
- data/samples/data/sample_csv_01_expected.png +0 -0
- data/samples/data/sample_csv_qty_00_expected.png +0 -0
- data/samples/data/sample_excel_00_expected.png +0 -0
- data/samples/data/sample_excel_01_expected.png +0 -0
- data/samples/data/sample_excel_02_expected.png +0 -0
- data/samples/data/sample_excel_resources_00_expected.png +0 -0
- data/samples/data/sample_excel_resources_01_expected.png +0 -0
- data/samples/data/sample_xlsx_qty_00_expected.png +0 -0
- data/samples/images/.gitignore +8 -0
- data/samples/images/_images_00_expected.png +0 -0
- data/samples/images/angler-fish.png +0 -0
- data/samples/images/ball.png +0 -0
- data/samples/images/glass-heart.svg +52 -0
- data/samples/images/grit.png +0 -0
- data/samples/images/offset.svg +85 -0
- data/samples/images/robot-golem.svg +1 -0
- data/samples/images/shiny-purse.png +0 -0
- data/samples/images/spanner.svg +91 -0
- data/samples/images/sprites.png +0 -0
- data/samples/images/with-alpha.png +0 -0
- data/samples/intro/.gitignore +2 -0
- data/samples/intro/auto-repair.svg +1 -0
- data/samples/intro/crawling.svg +1 -0
- data/samples/intro/data.xlsx +0 -0
- data/samples/intro/humans.svg +1 -0
- data/samples/intro/ninja-mask.svg +1 -0
- data/samples/intro/part1_00_expected.png +0 -0
- data/samples/intro/part2_00_expected.png +0 -0
- data/samples/intro/part3_00_expected.png +0 -0
- data/samples/intro/part3_layout.yml +34 -0
- data/samples/intro/part4_00_expected.png +0 -0
- data/samples/intro/part4_01_expected.png +0 -0
- data/samples/intro/part5_00_expected.png +0 -0
- data/samples/intro/part5_01_expected.png +0 -0
- data/samples/intro/part5_02_expected.png +0 -0
- data/samples/intro/part5_03_expected.png +0 -0
- data/samples/intro/part5_hand_expected.png +0 -0
- data/samples/intro/part5_showcase_expected.png +0 -0
- data/samples/intro/pirate-skull.svg +1 -0
- data/samples/intro/robot-golem.svg +1 -0
- data/samples/project/Gemfile +6 -0
- data/samples/project/Guardfile +18 -0
- data/samples/project/Rakefile +25 -0
- data/samples/project/bw/robot-golem.svg +53 -0
- data/samples/project/color/robot-golem.svg +1 -0
- data/samples/project/config.yml +2 -0
- data/samples/project/layouts/characters.yml +3 -0
- data/samples/project/layouts/skills.yml +3 -0
- data/samples/project/src/characters.rb +8 -0
- data/samples/project/src/skills.rb +7 -0
- data/samples/{ranges.rb → ranges/_ranges.rb} +0 -0
- data/samples/ranges/glass-heart.svg +52 -0
- data/samples/ranges/ranges_00_expected.png +0 -0
- data/samples/saves/.gitignore +1 -0
- data/samples/saves/_save_pdf.rb +18 -0
- data/samples/saves/hand_expected.png +0 -0
- data/samples/saves/hand_pretty_expected.png +0 -0
- data/samples/saves/save-pdf-small_expected.pdf +0 -0
- data/samples/saves/save-pdf_expected.pdf +0 -0
- data/samples/saves/save_png_00_expected.png +0 -0
- data/samples/saves/save_png_trimmed_00_expected.png +0 -0
- data/samples/saves/save_sheet_00_expected.png +0 -0
- data/samples/saves/save_sheet_01_expected.png +0 -0
- data/samples/saves/save_sheet_range_00_expected.png +0 -0
- data/samples/saves/save_sheet_range_01_expected.png +0 -0
- data/samples/saves/save_single_sheet_00_expected.png +0 -0
- data/samples/saves/saves_notrim_01_expected.png +0 -0
- data/samples/saves/showcase2_expected.png +0 -0
- data/samples/saves/showcase_expected.png +0 -0
- data/samples/saves/showcase_individual_00_expected.png +0 -0
- data/samples/saves/showcase_individual_01_expected.png +0 -0
- data/samples/saves/showcase_individual_02_expected.png +0 -0
- data/samples/saves/showcase_individual_03_expected.png +0 -0
- data/samples/saves/spanner.svg +91 -0
- data/samples/shapes/.gitignore +1 -0
- data/samples/shapes/shape_00_expected.png +0 -0
- data/samples/text/.gitignore +2 -0
- data/samples/text/README.md +1 -0
- data/samples/text/_text_00_expected.png +0 -0
- data/samples/text/config.yml +2 -0
- data/samples/units/_units.rb +32 -0
- data/samples/units/units_00_expected.png +0 -0
- data/samples/units/using_units.yml +10 -0
- data/spec/api/api_data_spec.rb +18 -18
- data/spec/api/api_groups_spec.rb +49 -0
- data/spec/args/sheet_spec.rb +24 -2
- data/spec/conf_spec.rb +8 -0
- data/spec/data/conf/basic.yml +1 -0
- data/spec/data/samples/autoscale_font/_autoscale_font.rb.txt +3 -0
- data/spec/data/samples/basic.rb.txt +3 -0
- data/spec/data/samples/cairo_access.rb.txt +2 -0
- data/spec/data/samples/colors/_gradients.rb.txt +1 -0
- data/spec/data/samples/config_text_markup.rb.txt +2 -0
- data/spec/data/samples/custom_config.rb.txt +1 -0
- data/spec/data/samples/data/_csv.rb.txt +6 -0
- data/spec/data/samples/data/_excel.rb.txt +13 -0
- data/spec/data/samples/embed_text.rb.txt +4 -0
- data/spec/data/samples/hello_world.rb.txt +2 -0
- data/spec/data/samples/images/_more_load_images.rb.txt +1 -0
- data/spec/data/samples/{ranges.rb.txt → ranges/_ranges.rb.txt} +3 -0
- data/spec/data/samples/saves/_hand.rb.txt +8 -0
- data/spec/data/samples/saves/_portrait_landscape.rb.txt +2 -0
- data/spec/data/samples/saves/_save_pdf.rb.txt +1505 -449
- data/spec/data/samples/saves/_saves.rb.txt +16 -0
- data/spec/data/samples/saves/_showcase.rb.txt +4 -0
- data/spec/data/samples/shapes/_draw_shapes.rb.txt +1 -0
- data/spec/data/samples/text_options.rb.txt +3 -0
- data/spec/data/samples/tgc_proofs.rb.txt +1 -0
- data/spec/data/samples/{units.rb.txt → units/_units.rb.txt} +20 -15
- data/spec/deck_spec.rb +7 -0
- data/spec/graphics/graphics_save_doc_spec.rb +2 -1
- data/spec/import/data_frame_spec.rb +251 -0
- data/spec/samples/run_samples_spec.rb +1 -1
- data/spec/samples/samples_regression_spec.rb +3 -2
- data/squib.gemspec +6 -6
- metadata +144 -24
- data/.gitmodules +0 -36
- data/samples/units.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0608aabb4ced2bce20fa90269f10747796ec296e
|
4
|
+
data.tar.gz: cd08eebeaf494d3f116d045be57a04120aff27e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/.travis.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
dist: trusty
|
2
2
|
language: ruby
|
3
|
-
sudo:
|
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.
|
14
|
+
- 2.3.3
|
15
|
+
- 2.4.0-preview3
|
14
16
|
matrix:
|
15
17
|
allow_failures:
|
16
|
-
- rvm: 2.
|
18
|
+
- rvm: 2.4.0-preview3
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,29 @@
|
|
1
1
|
# Squib CHANGELOG
|
2
2
|
Squib follows [semantic versioning](http://semver.org).
|
3
3
|
|
4
|
-
## v0.
|
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
|
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) [![
|
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
|
-
[
|
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
|
data/RELEASE TODO.md
CHANGED
@@ -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
data/docs/arrays.rst
CHANGED
@@ -66,10 +66,13 @@ Examples
|
|
66
66
|
|
67
67
|
Here are a few recipes for using arrays and ranges in practice:
|
68
68
|
|
69
|
-
..
|
69
|
+
.. literalinclude:: ../samples/ranges/_ranges.rb
|
70
|
+
:language: ruby
|
71
|
+
:linenos:
|
70
72
|
|
71
|
-
|
73
|
+
.. raw:: html
|
72
74
|
|
75
|
+
<img src="ranges/ranges_00_expected.png">
|
73
76
|
|
74
77
|
Contribute Recipes!
|
75
78
|
-------------------
|
data/docs/build_groups.rst
CHANGED
@@ -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
|
-
..
|
12
|
+
.. literalinclude:: ../samples/build_groups/build_groups.rb
|
13
|
+
:language: ruby
|
14
|
+
:linenos:
|
13
15
|
|
14
|
-
|
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/
|
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
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
39
|
+
.. code-block:: none
|
42
40
|
|
43
41
|
$ rake
|
44
42
|
$ rake pnp
|
data/docs/colors.rst
CHANGED
@@ -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
|
-
|
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">
|
data/docs/conf.py
CHANGED
@@ -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.
|
58
|
+
version = u'v0.12'
|
59
59
|
# The full version, including alpha/beta/rc tags.
|
60
|
-
release = u'v0.
|
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.
|
data/docs/config.rst
CHANGED
@@ -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
|
--------------------
|
data/docs/data.rst
CHANGED
@@ -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
|
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:
|
data/docs/dsl/csv.rst
CHANGED
@@ -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
|
+
╰------------------------------------╯
|
data/docs/dsl/disable_build.rst
CHANGED
@@ -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/
|
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
|
--------
|