squib 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/CHANGELOG.md +24 -3
- data/README.md +4 -3
- data/RELEASE TODO.md +3 -1
- data/docs/_static/css/squibdocs.css +5 -0
- data/docs/conf.py +2 -2
- data/docs/config.rst +5 -0
- data/docs/dsl/ellipse.rst +6 -0
- data/docs/dsl/mm.rst +19 -0
- data/docs/dsl/rect.rst +4 -0
- data/docs/dsl/text.rst +2 -2
- data/docs/dsl/triangle.rst +20 -8
- data/docs/guides/game_icons.rst +4 -0
- data/docs/layouts.rst +55 -0
- data/docs/units.rst +1 -1
- data/lib/squib/api/background.rb +1 -1
- data/lib/squib/api/data.rb +4 -4
- data/lib/squib/api/groups.rb +4 -4
- data/lib/squib/api/image.rb +2 -2
- data/lib/squib/api/save.rb +6 -6
- data/lib/squib/api/settings.rb +4 -4
- data/lib/squib/api/shapes.rb +13 -11
- data/lib/squib/api/text.rb +1 -1
- data/lib/squib/api/text_embed.rb +4 -29
- data/lib/squib/api/units.rb +7 -2
- data/lib/squib/args/arg_loader.rb +2 -14
- data/lib/squib/args/draw.rb +1 -1
- data/lib/squib/args/hand_special.rb +37 -37
- data/lib/squib/args/unit_conversion.rb +2 -0
- data/lib/squib/deck.rb +1 -1
- data/lib/squib/graphics/embedding_utils.rb +28 -0
- data/lib/squib/graphics/shapes.rb +6 -3
- data/lib/squib/graphics/text.rb +49 -52
- data/lib/squib/layout_parser.rb +28 -9
- data/lib/squib/layouts/economy.yml +85 -85
- data/lib/squib/layouts/fantasy.yml +101 -101
- data/lib/squib/layouts/hand.yml +62 -62
- data/lib/squib/layouts/playing-card.yml +35 -35
- data/lib/squib/layouts/tuck_box.yml +45 -45
- data/lib/squib/version.rb +1 -1
- data/samples/custom-config.yml +5 -5
- data/samples/custom_config.rb +18 -18
- data/samples/embed_text.rb +27 -9
- data/samples/layouts/_output/.gitignore +2 -0
- data/samples/{layouts_builtin.rb → layouts/builtin_layouts.rb} +74 -51
- data/samples/{custom-layout.yml → layouts/custom-layout.yml} +0 -0
- data/samples/{custom-layout2.yml → layouts/custom-layout2.yml} +0 -0
- data/samples/layouts/expected_layouts_builtin_economy_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_fantasy_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_hand_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_playing_card_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_tuck_box_00.png +0 -0
- data/samples/{layouts.rb → layouts/layouts.rb} +0 -1
- data/samples/layouts/shiny-purse.png +0 -0
- data/samples/layouts/spanner.svg +91 -0
- data/samples/offset.svg +71 -71
- data/samples/shapes/_draw_shapes.rb +8 -2
- data/spec/api/api_units_spec.rb +37 -0
- data/spec/args/embed_key_spec.rb +13 -13
- data/spec/args/showcase_special_spec.rb +15 -15
- data/spec/args/unit_conversion_spec.rb +8 -1
- data/spec/data/csv/qty.csv +2 -2
- data/spec/data/csv/qty_named.csv +2 -2
- data/spec/data/csv/with_spaces.csv +2 -2
- data/spec/data/layouts/extends-units-mixed.yml +8 -0
- data/spec/data/layouts/extends-units.yml +8 -0
- data/spec/data/samples/autoscale_font/_autoscale_font.rb.txt +9 -0
- data/spec/data/samples/basic.rb.txt +18 -0
- data/spec/data/samples/cairo_access.rb.txt +6 -0
- data/spec/data/samples/colors/_gradients.rb.txt +6 -0
- data/spec/data/samples/config_text_markup.rb.txt +72 -72
- data/spec/data/samples/data/_csv.rb.txt +12 -0
- data/spec/data/samples/data/_excel.rb.txt +30 -0
- data/spec/data/samples/embed_text.rb.txt +70 -5
- data/spec/data/samples/hello_world.rb.txt +36 -36
- data/spec/data/samples/images/_more_load_images.rb.txt +3 -0
- data/spec/data/samples/ranges.rb.txt +9 -0
- data/spec/data/samples/saves/_hand.rb.txt +48 -0
- data/spec/data/samples/saves/_saves.rb.txt +48 -0
- data/spec/data/samples/saves/_showcase.rb.txt +12 -0
- data/spec/data/samples/shapes/_draw_shapes.rb.txt +41 -0
- data/spec/data/samples/text_options.rb.txt +1155 -1125
- data/spec/data/samples/tgc_proofs.rb.txt +6 -0
- data/spec/data/samples/units.rb.txt +9 -0
- data/spec/graphics/embedding_utils_spec.rb +73 -0
- data/spec/layout_parser_spec.rb +42 -17
- data/spec/spec_helper.rb +5 -1
- data/squib.gemspec +5 -3
- metadata +61 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc3e963811aff757de4bb9fdbe27a512e108ea3f
|
4
|
+
data.tar.gz: 94098850ead4d37cae33a5040aa47f6fdf284c24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 768da6ac1f30e27a6f50de8acc7e38ab82b466ed78b4fab69375c62de5deaae03bf3387bea76d6a0a778c2f76736335794bd7e4f28c37224a2e78d0ba4241e65
|
7
|
+
data.tar.gz: 153722e40cc1a4c3fe04ce30672d6489133d9ef5b692deac675b0705f92a6f04f90358c93a196120bb4a5e8d2e73c244cd77cfea88c10e4d986e6fb9aef77d24
|
data/.travis.yml
CHANGED
@@ -2,6 +2,12 @@ dist: trusty
|
|
2
2
|
language: ruby
|
3
3
|
sudo: false # taking advantage of container-based infrastructure
|
4
4
|
cache: bundler # cache bundled gems from build to build
|
5
|
+
|
6
|
+
addons:
|
7
|
+
apt:
|
8
|
+
packages:
|
9
|
+
- libgirepository1.0-dev # for gobject-introspection
|
10
|
+
|
5
11
|
rvm:
|
6
12
|
- 2.2
|
7
13
|
- 2.3.0
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,36 @@
|
|
1
1
|
# Squib CHANGELOG
|
2
2
|
Squib follows [semantic versioning](http://semver.org).
|
3
3
|
|
4
|
-
## v0.
|
4
|
+
## v0.11.0 / Unreleased
|
5
5
|
|
6
6
|
Features:
|
7
|
-
*
|
7
|
+
* Unit conversion supports mm (#161)
|
8
|
+
* `rect` and `ellipse` support the `angle` option (#162)
|
9
|
+
|
10
|
+
Docs:
|
11
|
+
* Provide previews of each built-in template on the docs (#163)
|
12
|
+
* Documented lack of `:scale` behavior on text embedding. (#160)
|
13
|
+
|
14
|
+
Bugs:
|
15
|
+
* Fresh installs of Squib were broken due to two hidden dependencies, gio2 and gobject-introspection. (#172)
|
16
|
+
* Embedding icons in text show unicode placeholders on some OSs. Actually, all of icon embedding was one giant bug waiting to be squashed. I finally implemented this functionality using the proper API calls. See #177 for the feature, and then the bugs were #170, #171, #158, and #176. For that matter, see #103, #153, and #30 if you really want the whole story.
|
17
|
+
* With #177, the `:native` option for image width and height text embedding should work ().
|
18
|
+
* Unit conversion is supported when using `extends` in layouts, as promised in the docs (#173)
|
19
|
+
|
20
|
+
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.
|
22
|
+
|
23
|
+
Special thanks to everyone who tested, reported, suggested, and helped for this release! bcompter, rhyok, temetherian, rpond-pa, Nibodhika, briant-spindance, lcarlsen, spilth
|
24
|
+
|
25
|
+
## v0.10.0 / 2016-05-06
|
26
|
+
|
27
|
+
Features:
|
28
|
+
* Build groups! Simplify the process of building your deck different ways (e.g. one for color, one for PNP). Can be enabled explicitly or via command line. [See our shiny new docs for how these work](http://squib.readthedocs.io/en/latest/build_groups.html).
|
8
29
|
* New `use_layout` method will allow you to load a layout file as a DSL method instead of in the constructor. Useful in conjunction with build groups! (#141)
|
9
30
|
* The `csv` method now supports a `data` option to read CSV data directly. When set, it overrides the `file` option.
|
10
31
|
* The `csv` method now supports all of the Ruby CSV options (e.g. `col_sep`, `quote_char`). These options simply get passed through to Ruby, so as they change in Ruby, so the support changes in Squib (#149). Special thanks to Qgel's initial pull request (#146).
|
11
32
|
* The `csv` method now supports a block that it yields to for each element for pre-processing data (#145). Oh and `xlsx` has had that functionality for a while now, and now it's actually documented (#151).
|
12
|
-
* Rewrote the entire API doc and placed it on [squib.readthedocs.
|
33
|
+
* Rewrote the entire API doc and placed it on [squib.readthedocs.io](http://squib.readthedocs.io). :tada:
|
13
34
|
|
14
35
|
Bugs:
|
15
36
|
* The `save_pdf` method will flush to file upon exit so that the PDF is available immediately. (#150, thanks for the bug report Qgel!)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
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.
|
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
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:
|
3
3
|
|
4
4
|
[vey]: https://ci.appveyor.com/api/projects/status/github/andymeneely/squib?svg=true
|
@@ -87,8 +87,9 @@ Go [read the docs!](http://squib.readthedocs.org/)
|
|
87
87
|
|
88
88
|
Also:
|
89
89
|
* The `samples` directory in the [source repository](https://github.com/andymeneely/squib) has lots of examples.
|
90
|
-
* [
|
91
|
-
* [
|
90
|
+
* [Your Last Heist](http://yourlastheist.com) is my own creation, and it was made with Squib. Go through the repository and watch how it evolved!
|
91
|
+
* [Junk Land](https://github.com/andymeneely/junk-land) is my own creation that's uses Squib for full-color rendering, and makes use of Ruby in a lot of interesting ways. The port is still in process.
|
92
|
+
* [Project Spider Monkey](https://github.com/andymeneely/project-spider-monkey) is another of my own creations. This one was started from scratch with Squib, but it's still in its early stages.
|
92
93
|
|
93
94
|
|
94
95
|
## Staying DRY
|
data/RELEASE TODO.md
CHANGED
@@ -5,11 +5,13 @@ Be sure to remember to do the following for releases. (Copy into a GitHub issue)
|
|
5
5
|
- [ ] Samples are updated
|
6
6
|
- [ ] Check `sample_regression_spec.rb` regression tests are all enabled (i.e. `overwrite_sample` is commented out)
|
7
7
|
- [ ] Bump version.rb
|
8
|
+
- [ ] Bump docs/conf.py versions
|
8
9
|
- [ ] Do a full rake locally
|
9
10
|
- [ ] `rake sanity`, and check visually
|
10
11
|
- [ ] Travis is passing on dev branch
|
11
12
|
- [ ] Merge master branch
|
12
|
-
- [ ]
|
13
|
+
- [ ] Merge release branch
|
14
|
+
- [ ] Push master and release branches
|
13
15
|
- [ ] Create GitHub release tag
|
14
16
|
- [ ] `gem push pkg/squib-x.y.z.gem`
|
15
17
|
- [ ] Github milestone closed
|
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'
|
58
|
+
version = u'v0.11'
|
59
59
|
# The full version, including alpha/beta/rc tags.
|
60
|
-
release = u'
|
60
|
+
release = u'v0.11.0'
|
61
61
|
|
62
62
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
63
63
|
# for a list of supported languages.
|
data/docs/config.rst
CHANGED
@@ -45,6 +45,11 @@ prefix
|
|
45
45
|
|
46
46
|
When using an SVG backend, cards are auto-saved with this prefix and ``'%02d'`` numbering format.
|
47
47
|
|
48
|
+
img_dir
|
49
|
+
default: ``'.'``
|
50
|
+
|
51
|
+
For reading image file command (e.g. png and svg), read from this directory instead
|
52
|
+
|
48
53
|
warn_ellipsize
|
49
54
|
default: true
|
50
55
|
|
data/docs/dsl/ellipse.rst
CHANGED
@@ -10,6 +10,12 @@ Options
|
|
10
10
|
.. include:: /args/xy.rst
|
11
11
|
.. include:: /args/wh.rst
|
12
12
|
.. include:: /args/draw.rst
|
13
|
+
|
14
|
+
angle
|
15
|
+
default: 0
|
16
|
+
|
17
|
+
the angle at which to rotate the ellipse about it's upper-left corner
|
18
|
+
|
13
19
|
.. include:: /args/range.rst
|
14
20
|
.. include:: /args/layout.rst
|
15
21
|
|
data/docs/dsl/mm.rst
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
mm
|
2
|
+
------
|
3
|
+
|
4
|
+
Given millimeters, returns the number of pixels according to the deck's DPI.
|
5
|
+
|
6
|
+
Parameters
|
7
|
+
^^^^^^^^^^
|
8
|
+
|
9
|
+
n
|
10
|
+
the number of mm
|
11
|
+
|
12
|
+
|
13
|
+
Examples
|
14
|
+
^^^^^^^^
|
15
|
+
|
16
|
+
.. code-block:: ruby
|
17
|
+
|
18
|
+
mm(1) # 11.811px (for default Deck::dpi of 300)
|
19
|
+
mm(2) + mm(1) # 35.433ox (for default Deck::dpi of 300)
|
data/docs/dsl/rect.rst
CHANGED
data/docs/dsl/text.rst
CHANGED
@@ -175,12 +175,12 @@ layout
|
|
175
175
|
width
|
176
176
|
default: ``:native``
|
177
177
|
|
178
|
-
the width of the image rendered.
|
178
|
+
the width of the image rendered. Does not support ``:scale`` (`yet <https://github.com/andymeneely/squib/issues/160>`_)
|
179
179
|
|
180
180
|
height
|
181
181
|
default: ``:native``
|
182
182
|
|
183
|
-
the height the height of the image rendered.
|
183
|
+
the height the height of the image rendered. Does not support ``:scale`` (`yet <https://github.com/andymeneely/squib/issues/160>`_)
|
184
184
|
|
185
185
|
dx
|
186
186
|
default: ``0``
|
data/docs/dsl/triangle.rst
CHANGED
@@ -8,27 +8,39 @@ Options
|
|
8
8
|
.. include:: /args/expansion.rst
|
9
9
|
|
10
10
|
x1
|
11
|
-
default: ``
|
11
|
+
default: ``100``
|
12
12
|
|
13
|
-
the x-coordinate to place. Supports :doc:`/units/`
|
13
|
+
the first x-coordinate to place. Supports :doc:`/units/`
|
14
14
|
|
15
15
|
|
16
16
|
y1
|
17
|
-
default: ``
|
17
|
+
default: ``100``
|
18
18
|
|
19
|
-
the y-coordinate to place. Supports :doc:`/units/`
|
19
|
+
the first y-coordinate to place. Supports :doc:`/units/`
|
20
20
|
|
21
21
|
|
22
22
|
x2
|
23
|
-
default: ``
|
23
|
+
default: ``150``
|
24
24
|
|
25
|
-
the x-coordinate to place. Supports :doc:`/units/`
|
25
|
+
the second x-coordinate to place. Supports :doc:`/units/`
|
26
26
|
|
27
27
|
|
28
28
|
y2
|
29
|
-
default: ``
|
29
|
+
default: ``150``
|
30
|
+
|
31
|
+
the second y-coordinate to place. Supports :doc:`/units/`
|
32
|
+
|
33
|
+
x3
|
34
|
+
default: ``100``
|
35
|
+
|
36
|
+
the third x-coordinate to place. Supports :doc:`/units/`
|
37
|
+
|
38
|
+
|
39
|
+
y3
|
40
|
+
default: ``150``
|
41
|
+
|
42
|
+
the third y-coordinate to place. Supports :doc:`/units/`
|
30
43
|
|
31
|
-
the y-coordinate to place. Supports :doc:`/units/`
|
32
44
|
|
33
45
|
.. include:: /args/draw.rst
|
34
46
|
.. include:: /args/range.rst
|
data/docs/guides/game_icons.rst
CHANGED
data/docs/layouts.rst
CHANGED
@@ -227,6 +227,61 @@ If your layout file is not found in the current directory, Squib will search for
|
|
227
227
|
|
228
228
|
Contributions in this area are particularly welcome!!
|
229
229
|
|
230
|
+
The following depictions of the layouts are generated with `this script <https://github.com/andymeneely/squib/tree/master/samples/layouts/builtin_layouts.rb>`_
|
231
|
+
|
232
|
+
fantasy.yml
|
233
|
+
~~~~~~~~~~~
|
234
|
+
|
235
|
+
.. raw:: html
|
236
|
+
|
237
|
+
<img src="layouts/expected_layouts_builtin_fantasy_00.png"
|
238
|
+
class="figure" width=350>
|
239
|
+
|
240
|
+
https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/fantasy.yml
|
241
|
+
|
242
|
+
economy.yml
|
243
|
+
~~~~~~~~~~~
|
244
|
+
|
245
|
+
.. raw:: html
|
246
|
+
|
247
|
+
<img src="layouts/expected_layouts_builtin_economy_00.png"
|
248
|
+
class="figure" width=350>
|
249
|
+
|
250
|
+
https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/economy.yml
|
251
|
+
|
252
|
+
tuck_box.yml
|
253
|
+
~~~~~~~~~~~
|
254
|
+
|
255
|
+
Based on TheGameCrafter's template.
|
256
|
+
|
257
|
+
.. raw:: html
|
258
|
+
|
259
|
+
<img src="layouts/expected_layouts_builtin_tuck_box_00.png"
|
260
|
+
class="figure" width=450>
|
261
|
+
|
262
|
+
https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/tuck_box.yml
|
263
|
+
|
264
|
+
|
265
|
+
hand.yml
|
266
|
+
~~~~~~~~~~~
|
267
|
+
|
268
|
+
.. raw:: html
|
269
|
+
|
270
|
+
<img src="layouts/expected_layouts_builtin_hand_00.png"
|
271
|
+
class="figure" width=350>
|
272
|
+
|
273
|
+
https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/hand.yml
|
274
|
+
|
275
|
+
playing_card.yml
|
276
|
+
~~~~~~~~~~~
|
277
|
+
|
278
|
+
.. raw:: html
|
279
|
+
|
280
|
+
<img src="layouts/expected_layouts_builtin_playing_card_00.png"
|
281
|
+
class="figure" width=350>
|
282
|
+
|
283
|
+
https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/playing_card.yml
|
284
|
+
|
230
285
|
See Layouts in Action
|
231
286
|
---------------------
|
232
287
|
|
data/docs/units.rst
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Unit Conversion
|
2
2
|
===============
|
3
3
|
|
4
|
-
By default, Squib thinks in pixels. This decision was made so that we can have pixel-perfect layouts without automatically scaling everything, even though working in units is sometimes easier. We provide some conversion methods, including looking for strings that end in "in"
|
4
|
+
By default, Squib thinks in pixels. This decision was made so that we can have pixel-perfect layouts without automatically scaling everything, even though working in units is sometimes easier. We provide some conversion methods, including looking for strings that end in "in", "cm", or "mm" and computing based on the current DPI. The dpi is set on `Squib::Deck.new` (not `config.yml`).
|
5
5
|
|
6
6
|
Example is in `samples/units.rb` found [here](https://github.com/andymeneely/squib/tree/master/samples/units.rb)
|
data/lib/squib/api/background.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative '../args/draw'
|
|
4
4
|
module Squib
|
5
5
|
class Deck
|
6
6
|
|
7
|
-
# DSL method. See http://squib.readthedocs.
|
7
|
+
# DSL method. See http://squib.readthedocs.io
|
8
8
|
def background(opts = {})
|
9
9
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
10
10
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
data/lib/squib/api/data.rb
CHANGED
@@ -6,7 +6,7 @@ require_relative '../args/csv_opts'
|
|
6
6
|
|
7
7
|
module Squib
|
8
8
|
|
9
|
-
# DSL method. See http://squib.readthedocs.
|
9
|
+
# DSL method. See http://squib.readthedocs.io
|
10
10
|
def xlsx(opts = {})
|
11
11
|
input = Args::InputFile.new(file: 'deck.xlsx').load!(opts)
|
12
12
|
import = Args::Import.new.load!(opts)
|
@@ -30,7 +30,7 @@ module Squib
|
|
30
30
|
end# xlsx
|
31
31
|
module_function :xlsx
|
32
32
|
|
33
|
-
# DSL method. See http://squib.readthedocs.
|
33
|
+
# DSL method. See http://squib.readthedocs.io
|
34
34
|
def csv(opts = {})
|
35
35
|
# TODO refactor all this out to separate methods, and its own class
|
36
36
|
import = Args::Import.new.load!(opts)
|
@@ -93,12 +93,12 @@ module Squib
|
|
93
93
|
|
94
94
|
class Deck
|
95
95
|
|
96
|
-
# DSL method. See http://squib.readthedocs.
|
96
|
+
# DSL method. See http://squib.readthedocs.io
|
97
97
|
def xlsx(opts = {})
|
98
98
|
Squib.xlsx(opts)
|
99
99
|
end
|
100
100
|
|
101
|
-
# DSL method. See http://squib.readthedocs.
|
101
|
+
# DSL method. See http://squib.readthedocs.io
|
102
102
|
def csv(opts = {})
|
103
103
|
Squib.csv(opts)
|
104
104
|
end
|
data/lib/squib/api/groups.rb
CHANGED
@@ -12,25 +12,25 @@ module Squib
|
|
12
12
|
|
13
13
|
class Deck
|
14
14
|
|
15
|
-
# DSL method. See http://squib.readthedocs.
|
15
|
+
# DSL method. See http://squib.readthedocs.io
|
16
16
|
def build grp = :all, &block
|
17
17
|
raise 'Please provide a block' unless block_given?
|
18
18
|
block.yield if build_groups.include? grp
|
19
19
|
end
|
20
20
|
|
21
|
-
# DSL method. See http://squib.readthedocs.
|
21
|
+
# DSL method. See http://squib.readthedocs.io
|
22
22
|
def enable_build grp
|
23
23
|
build_groups # make sure it's initialized
|
24
24
|
@build_groups << grp
|
25
25
|
end
|
26
26
|
|
27
|
-
# DSL method. See http://squib.readthedocs.
|
27
|
+
# DSL method. See http://squib.readthedocs.io
|
28
28
|
def disable_build grp
|
29
29
|
build_groups # make sure it's initialized
|
30
30
|
@build_groups.delete grp
|
31
31
|
end
|
32
32
|
|
33
|
-
# DSL method. See http://squib.readthedocs.
|
33
|
+
# DSL method. See http://squib.readthedocs.io
|
34
34
|
def build_groups
|
35
35
|
@build_groups ||= Set.new.add(:all)
|
36
36
|
end
|
data/lib/squib/api/image.rb
CHANGED
@@ -8,7 +8,7 @@ require_relative '../args/svg_special'
|
|
8
8
|
module Squib
|
9
9
|
class Deck
|
10
10
|
|
11
|
-
# DSL method. See http://squib.readthedocs.
|
11
|
+
# DSL method. See http://squib.readthedocs.io
|
12
12
|
def png(opts = {})
|
13
13
|
Dir.chdir(img_dir) do
|
14
14
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
@@ -25,7 +25,7 @@ module Squib
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
# DSL method. See http://squib.readthedocs.
|
28
|
+
# DSL method. See http://squib.readthedocs.io
|
29
29
|
def svg(opts = {})
|
30
30
|
Dir.chdir(img_dir) do
|
31
31
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
data/lib/squib/api/save.rb
CHANGED
@@ -7,21 +7,21 @@ require_relative '../args/showcase_special'
|
|
7
7
|
module Squib
|
8
8
|
class Deck
|
9
9
|
|
10
|
-
# DSL method. See http://squib.readthedocs.
|
10
|
+
# DSL method. See http://squib.readthedocs.io
|
11
11
|
def save(opts = {})
|
12
12
|
save_png(opts) if Array(opts[:format]).include? :png
|
13
13
|
save_pdf(opts) if Array(opts[:format]).include? :pdf
|
14
14
|
self
|
15
15
|
end
|
16
16
|
|
17
|
-
# DSL method. See http://squib.readthedocs.
|
17
|
+
# DSL method. See http://squib.readthedocs.io
|
18
18
|
def save_pdf(opts = {})
|
19
19
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
20
20
|
sheet = Args::Sheet.new(custom_colors, { file: 'output.pdf' }).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
21
21
|
render_pdf(range, sheet)
|
22
22
|
end
|
23
23
|
|
24
|
-
# DSL method. See http://squib.readthedocs.
|
24
|
+
# DSL method. See http://squib.readthedocs.io
|
25
25
|
def save_png(opts = {})
|
26
26
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
27
27
|
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
@@ -33,7 +33,7 @@ module Squib
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
# DSL method. See http://squib.readthedocs.
|
36
|
+
# DSL method. See http://squib.readthedocs.io
|
37
37
|
def save_sheet(opts = {})
|
38
38
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
39
39
|
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
@@ -41,7 +41,7 @@ module Squib
|
|
41
41
|
render_sheet(range, batch, sheet)
|
42
42
|
end
|
43
43
|
|
44
|
-
# DSL method. See http://squib.readthedocs.
|
44
|
+
# DSL method. See http://squib.readthedocs.io
|
45
45
|
def showcase(opts = {})
|
46
46
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
47
47
|
showcase = Args::ShowcaseSpecial.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
@@ -49,7 +49,7 @@ module Squib
|
|
49
49
|
render_showcase(range, sheet, showcase)
|
50
50
|
end
|
51
51
|
|
52
|
-
# DSL method. See http://squib.readthedocs.
|
52
|
+
# DSL method. See http://squib.readthedocs.io
|
53
53
|
def hand(opts = {})
|
54
54
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
55
55
|
hand = Args::HandSpecial.new(height).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|