squib 0.13.4 → 0.14.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -4
  3. data/CHANGELOG.md +19 -3
  4. data/README.md +1 -1
  5. data/bin/squib +1 -16
  6. data/lib/squib.rb +1 -1
  7. data/lib/squib/api/data.rb +29 -0
  8. data/lib/squib/api/save.rb +23 -2
  9. data/lib/squib/api/shapes.rb +37 -0
  10. data/lib/squib/api/text.rb +1 -1
  11. data/lib/squib/api/units.rb +5 -0
  12. data/lib/squib/args/arg_loader.rb +1 -1
  13. data/lib/squib/args/coords.rb +3 -1
  14. data/lib/squib/args/dir_validator.rb +1 -1
  15. data/lib/squib/args/sheet.rb +9 -2
  16. data/lib/squib/args/sprue_file.rb +44 -0
  17. data/lib/squib/args/unit_conversion.rb +2 -0
  18. data/lib/squib/{layouts → builtin/layouts}/economy.yml +5 -5
  19. data/lib/squib/{layouts → builtin/layouts}/fantasy.yml +4 -4
  20. data/lib/squib/{layouts → builtin/layouts}/hand.yml +0 -0
  21. data/lib/squib/builtin/layouts/party.yml +94 -0
  22. data/lib/squib/{layouts → builtin/layouts}/playing-card.yml +0 -0
  23. data/lib/squib/{layouts → builtin/layouts}/tuck_box.yml +1 -1
  24. data/lib/squib/{project_template → builtin/projects/advanced}/.gitignore +0 -0
  25. data/lib/squib/{project_template → builtin/projects/advanced}/ABOUT.md +0 -0
  26. data/lib/squib/builtin/projects/advanced/Gemfile +11 -0
  27. data/lib/squib/builtin/projects/advanced/Guardfile +21 -0
  28. data/lib/squib/{project_template → builtin/projects/advanced}/IDEAS.md +0 -0
  29. data/lib/squib/{project_template → builtin/projects/advanced}/PLAYTESTING.md +0 -0
  30. data/lib/squib/builtin/projects/advanced/Rakefile +27 -0
  31. data/lib/squib/{project_template → builtin/projects/advanced}/_output/gitkeep.txt +0 -0
  32. data/lib/squib/builtin/projects/advanced/config.yml +49 -0
  33. data/lib/squib/builtin/projects/advanced/data/game.xlsx +0 -0
  34. data/lib/squib/project_template/PNP NOTES.md b/data/lib/squib/builtin/projects/advanced/docs/PNP → NOTES.md +0 -0
  35. data/lib/squib/{project_template → builtin/projects/advanced/docs}/RULES.md +0 -0
  36. data/lib/squib/builtin/projects/advanced/img/example.svg +60 -0
  37. data/lib/squib/builtin/projects/advanced/layouts/deck.yml +27 -0
  38. data/lib/squib/builtin/projects/advanced/src/deck.rb +34 -0
  39. data/lib/squib/builtin/projects/advanced/src/version.rb +3 -0
  40. data/lib/squib/builtin/projects/basic/.gitignore +4 -0
  41. data/lib/squib/builtin/projects/basic/ABOUT.md +19 -0
  42. data/lib/squib/{project_template → builtin/projects/basic}/Gemfile +0 -0
  43. data/lib/squib/builtin/projects/basic/IDEAS.md +22 -0
  44. data/lib/squib/builtin/projects/basic/PLAYTESTING.md +26 -0
  45. data/lib/squib/builtin/projects/basic/PNP NOTES.md +4 -0
  46. data/lib/squib/builtin/projects/basic/RULES.md +21 -0
  47. data/lib/squib/{project_template → builtin/projects/basic}/Rakefile +0 -0
  48. data/lib/squib/builtin/projects/basic/_output/gitkeep.txt +1 -0
  49. data/lib/squib/{project_template → builtin/projects/basic}/config.yml +0 -0
  50. data/lib/squib/{project_template → builtin/projects/basic}/deck.rb +0 -0
  51. data/lib/squib/{project_template → builtin/projects/basic}/layout.yml +0 -0
  52. data/lib/squib/builtin/sprues/a4_euro_card.yml +42 -0
  53. data/lib/squib/builtin/sprues/a4_poker_card_8up.yml +40 -0
  54. data/lib/squib/builtin/sprues/a4_poker_card_9up.yml +42 -0
  55. data/lib/squib/builtin/sprues/a4_usa_card.yml +42 -0
  56. data/lib/squib/builtin/sprues/letter_poker_card_9up.yml +25 -0
  57. data/lib/squib/builtin/sprues/letter_poker_foldable_8up.yml +52 -0
  58. data/lib/squib/card.rb +1 -1
  59. data/lib/squib/commands/cli.rb +39 -0
  60. data/lib/squib/commands/data/template_option.rb +109 -0
  61. data/lib/squib/commands/make_sprue.rb +275 -0
  62. data/lib/squib/commands/new.rb +37 -4
  63. data/lib/squib/constants.rb +6 -1
  64. data/lib/squib/graphics/cairo_context_wrapper.rb +1 -1
  65. data/lib/squib/graphics/image.rb +6 -1
  66. data/lib/squib/graphics/save_doc.rb +6 -4
  67. data/lib/squib/graphics/save_pdf.rb +13 -8
  68. data/lib/squib/graphics/save_sprue.rb +228 -0
  69. data/lib/squib/graphics/shapes.rb +8 -2
  70. data/lib/squib/graphics/text.rb +4 -3
  71. data/lib/squib/layout_parser.rb +17 -1
  72. data/lib/squib/sample_helpers.rb +1 -1
  73. data/lib/squib/sprues/crop_line.rb +28 -0
  74. data/lib/squib/sprues/crop_line_dash.rb +35 -0
  75. data/lib/squib/sprues/invalid_sprue_definition.rb +9 -0
  76. data/lib/squib/sprues/sprue.rb +203 -0
  77. data/lib/squib/sprues/sprue_schema.rb +48 -0
  78. data/lib/squib/version.rb +1 -1
  79. data/samples/autoscale_font/_autoscale_font.rb +3 -3
  80. data/samples/backend/_backend.rb +1 -1
  81. data/samples/basic.rb +2 -2
  82. data/samples/colors/_colors.rb +1 -1
  83. data/samples/colors/_gradients.rb +1 -1
  84. data/samples/config/config_text_markup.rb +3 -3
  85. data/samples/config/custom_config.rb +1 -1
  86. data/samples/data/_csv.rb +3 -3
  87. data/samples/data/_excel.rb +4 -4
  88. data/samples/data/_yaml.rb +12 -0
  89. data/samples/images/_images.rb +2 -2
  90. data/samples/images/_more_load_images.rb +3 -0
  91. data/samples/images/_unicode.rb +2 -2
  92. data/samples/intro/02_options.rb +2 -2
  93. data/samples/layouts/builtin_layouts.rb +27 -4
  94. data/samples/layouts/layouts.rb +2 -2
  95. data/samples/proofs/_tgc_proofs.rb +2 -2
  96. data/samples/ranges/_ranges.rb +3 -3
  97. data/samples/saves/_hand.rb +1 -1
  98. data/samples/saves/_save_pdf.rb +4 -0
  99. data/samples/saves/_saves.rb +7 -1
  100. data/samples/saves/_showcase.rb +1 -1
  101. data/samples/shapes/_draw_shapes.rb +5 -1
  102. data/samples/shapes/_proofs.rb +22 -0
  103. data/samples/sprues/_builtin_sprues.rb +19 -0
  104. data/samples/sprues/_fold_sheet.rb +27 -0
  105. data/samples/sprues/_hex_tiles.rb +15 -0
  106. data/samples/sprues/_mints.rb +11 -0
  107. data/samples/sprues/_sprue_example.rb +11 -0
  108. data/samples/text/_embed_text.rb +14 -14
  109. data/samples/text/_text.rb +8 -8
  110. data/samples/text/_text_options.rb +17 -17
  111. data/squib.gemspec +18 -17
  112. metadata +126 -44
@@ -0,0 +1,94 @@
1
+ #This layout inspired by popular games like Fluxx and Apples to Apples
2
+ title_box:
3
+ x: 75
4
+ y: 75
5
+ width: 125
6
+ height: 975
7
+
8
+ title:
9
+ x: 75
10
+ y: 1050
11
+ angle: 4.71238898 # 3 π / 2
12
+ width: 850
13
+ height: 125
14
+ align: right
15
+ valign: middle
16
+ font: Sans 22
17
+
18
+ title_middle:
19
+ x: 225
20
+ y: 550
21
+ font: Sans 18
22
+ width: 525
23
+ height: 150
24
+ valign: bottom
25
+
26
+ middle_rect:
27
+ x: 225
28
+ y: 715
29
+ width: 525
30
+ height: 25
31
+
32
+ rule_top:
33
+ x: 225
34
+ y: 200
35
+ width: 525
36
+ height: 300
37
+ font: Times New Roman, Serif 10
38
+
39
+ rule_bottom:
40
+ x: 225
41
+ y: 750
42
+ width: 525
43
+ height: 300
44
+ font: Times New Roman, Serif 10
45
+
46
+ type_icon:
47
+ x: 75
48
+ y: 75
49
+ width: 125
50
+ height: 125
51
+ align: center
52
+ valign: middle
53
+ font: 'Sans 24'
54
+
55
+ type:
56
+ x: 225
57
+ y: 75
58
+ width: 525
59
+ height: 125
60
+ align: left
61
+ valign: top
62
+ font: 'Sans 30'
63
+
64
+ copyright:
65
+ x: 75
66
+ y: 1025
67
+ width: 675
68
+ height: 25
69
+ font_size: 5
70
+ align: right
71
+ valign: bottom
72
+ #aliases for copyright
73
+ copy:
74
+ extends: copyright
75
+ credit:
76
+ extends: copyright
77
+ credits:
78
+ extends: copyright
79
+
80
+ # The "cut line", without rounded corners
81
+ cut:
82
+ x: 37.5
83
+ y: 37.5
84
+ radius: 16
85
+ width: 750
86
+ height: 1050
87
+
88
+ # The "safe zone" as defined by TheGameCrafter poker cards
89
+ safe:
90
+ x: 75
91
+ y: 75
92
+ width: 675
93
+ height: 975
94
+ dash: 3 3
@@ -43,4 +43,4 @@ front_curve:
43
43
  cx1: 1575
44
44
  cy1: 565
45
45
  cx2: 1740
46
- cy2: 565
46
+ cy2: 565
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'squib'
4
+ gem 'guard'
5
+ gem 'guard-rake'
6
+
7
+ # If you do any simulation or anything fancy, you might want this
8
+ # gem 'rspec' # Unit testing with behavior-driven development
9
+
10
+ # If you want to generate PDFs manually (e.g. rules) this is good
11
+ # gem 'prawn'
@@ -0,0 +1,21 @@
1
+ group :default do
2
+ guard 'rake', :task => 'default' do
3
+ watch %r{data/.*\.xlsx$}
4
+ watch %r{data/.*\.csv$}
5
+ watch %r{src/.*\.rb$}
6
+ watch %r{.*\.yml}
7
+ watch %r{img/.*\.svg$}
8
+ watch %r{img/.*\.png$}
9
+ end
10
+ end
11
+
12
+ group :deck do
13
+ guard 'rake', :task => 'default' do
14
+ watch %r{data/.*\.xlsx$}
15
+ watch %r{data/.*\.csv$}
16
+ watch %r{src/.*\.rb$}
17
+ watch %r{.*\.yml}
18
+ watch %r{img/.*\.svg$}
19
+ watch %r{img/.*\.png$}
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ require 'squib'
2
+ require 'irb'
3
+ require 'rake/clean'
4
+
5
+ # Add Rake's clean & clobber tasks
6
+ CLEAN.include('_output/*').exclude('_output/gitkeep.txt')
7
+
8
+ desc 'By default, just build the deck without extra options'
9
+ task default: [:deck]
10
+
11
+ desc 'Build everything, with all the options'
12
+ task all: [:with_pnp, :with_proofs, :deck]
13
+
14
+ desc 'Build the deck'
15
+ task(:deck) { load 'src/deck.rb' }
16
+
17
+ desc 'Enable proof lines'
18
+ task(:with_proofs) do
19
+ puts "Enabling proofing lines."
20
+ Squib.enable_build_globally :proofs
21
+ end
22
+
23
+ desc 'Enable print-and-play builds'
24
+ task(:with_pnp) do
25
+ puts "Enabling print-and-play builds."
26
+ Squib.enable_build_globally :pnp
27
+ end
@@ -0,0 +1,49 @@
1
+ # Settings in the config.yml are overriding Squib's defaults. Anything in the main script will override this.
2
+
3
+ # DPI is used in making PDFs and in unit conversions
4
+ # Default: 300
5
+ #dpi: 72
6
+
7
+ #antialias: best #recommended. Only about 10% slower than fast
8
+ #antialias: default # set the anti-aliasing algorithm. default defers to the underlying graphics device. See http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t
9
+
10
+ # Text hints are used to show the boundaries of text boxes.
11
+ # Can be enabled/disabled at the command-level, or set globally with `set`
12
+ #text_hint: '#F00'
13
+
14
+ # Show progress bars on the command line for potentially long-running operations
15
+ progress_bars: true
16
+
17
+ #Enable some custom colors that can be used in any color
18
+ #custom_colors:
19
+ # foo: '#abc'
20
+
21
+ #For reading image file command (e.g. png and svg), read from this directory instead
22
+ img_dir: img
23
+ #img_dir: img-bw
24
+
25
+ # Use a SVG cairo back end, instead of an in-memory buffer
26
+ # backend: :memory # default
27
+ # backend: :svg # can create scalable pdfs, but rendering done at the printer level is not as good as Cairo.
28
+
29
+ # Configure what text markup uses replace characters
30
+ # Below are the defaults
31
+ # lsquote: "\u2018" #note that Yaml wants double quotes here to use escape chars
32
+ # rsquote: "\u2019"
33
+ # ldquote: "\u201C"
34
+ # rdquote: "\u201D"
35
+ # em_dash: "\u2014"
36
+ # en_dash: "\u2013"
37
+ # ellipsis: "\u2026"
38
+
39
+ # We can also disallow smart quotes and only allow explicit replacements with ``LaTeX-style'' quotes.
40
+ # smart_quotes: false
41
+
42
+ # By default, Squib warns when a text box is ellipsized. This can get verbose
43
+ # and can be turned off here
44
+ warn_ellipsize: true # default
45
+ # warn_ellipsize: false # turn off entirely
46
+
47
+ # By default, Squib will warn if a PNG is being up-scaled.
48
+ warn_png_scale: true # default
49
+ # warn_png_scale: false # turn off entirely
@@ -0,0 +1,60 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ id="svg8"
11
+ version="1.1"
12
+ viewBox="0 0 210 297"
13
+ height="297mm"
14
+ width="210mm"
15
+ sodipodi:docname="example.svg"
16
+ inkscape:version="0.92.0 r15299">
17
+ <sodipodi:namedview
18
+ pagecolor="#ffffff"
19
+ bordercolor="#666666"
20
+ borderopacity="1"
21
+ objecttolerance="10"
22
+ gridtolerance="10"
23
+ guidetolerance="10"
24
+ inkscape:pageopacity="0"
25
+ inkscape:pageshadow="2"
26
+ inkscape:window-width="1680"
27
+ inkscape:window-height="987"
28
+ id="namedview7"
29
+ showgrid="false"
30
+ inkscape:zoom="0.5946522"
31
+ inkscape:cx="407.78854"
32
+ inkscape:cy="201.53619"
33
+ inkscape:window-x="-8"
34
+ inkscape:window-y="162"
35
+ inkscape:window-maximized="1"
36
+ inkscape:current-layer="svg8" />
37
+ <defs
38
+ id="defs2" />
39
+ <metadata
40
+ id="metadata5">
41
+ <rdf:RDF>
42
+ <cc:Work
43
+ rdf:about="">
44
+ <dc:format>image/svg+xml</dc:format>
45
+ <dc:type
46
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
47
+ <dc:title />
48
+ </cc:Work>
49
+ </rdf:RDF>
50
+ </metadata>
51
+ <g
52
+ id="layer1"
53
+ transform="translate(3.5595036,70.300197)">
54
+ <path
55
+ id="path4485"
56
+ d="m 176.52631,170.79195 -68.8031,39.72348 -68.80309,-39.72348 1e-6,-79.446968 68.803089,-39.723484 68.8031,39.723484 z"
57
+ style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ed00ff;stroke-width:0.70555556;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99954044"
58
+ inkscape:connector-curvature="0" />
59
+ </g>
60
+ </svg>
@@ -0,0 +1,27 @@
1
+ name:
2
+ x: 90
3
+ y: 90
4
+ width: 500
5
+ height: 50
6
+ font: Arial 18
7
+ valign: middle
8
+ align: left
9
+ ellipsize: false
10
+
11
+ ATK:
12
+ x: 90
13
+ y: 190
14
+ width: 200
15
+ height: 50
16
+ font: Arial 12
17
+ valign: middle
18
+ align: left
19
+ ellipsize: false
20
+ DEF:
21
+ extends: ATK
22
+ y: += 75
23
+
24
+ version:
25
+ font: Arial 6
26
+ x: 725
27
+ y: 45
@@ -0,0 +1,34 @@
1
+ require 'squib'
2
+ require_relative 'version'
3
+
4
+ # Note: run this code by running "rake" at the command line
5
+ # To see full list of options, run "rake -T"
6
+
7
+ data = Squib.xlsx file: 'data/game.xlsx', sheet: 0
8
+
9
+ Squib::Deck.new(cards: data.nrows) do
10
+ background color: :white
11
+ use_layout file: 'layouts/deck.yml'
12
+
13
+ text str: data.name, layout: :name
14
+
15
+ text str: data.atk.map { |s| "#{s} ATK" }, layout: :ATK
16
+ text str: data.def.map { |s| "#{s} DEF" }, layout: :DEF
17
+
18
+ svg file: 'example.svg'
19
+
20
+ text str: MySquibGame::VERSION, layout: :version
21
+
22
+ build(:proofs) do
23
+ safe_zone
24
+ cut_zone
25
+ end
26
+
27
+ save format: :png
28
+
29
+ build(:pnp) do
30
+ save_sheet prefix: 'pnp_sheet_',
31
+ trim: '0.125in',
32
+ rows: 3, columns: 3
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module MySquibGame
2
+ VERSION = '1.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ _output/*.png
2
+ _output/*.pdf
3
+ ~$*
4
+ .DS_Store
@@ -0,0 +1,19 @@
1
+ My Awesome Game
2
+ ===============
3
+
4
+ Check out my awesome game!
5
+
6
+
7
+ Objective
8
+ ---------
9
+
10
+
11
+
12
+ Gameplay
13
+ --------
14
+
15
+
16
+
17
+ Ending the Game
18
+ ---------------
19
+
@@ -0,0 +1,22 @@
1
+ # Title Ideas
2
+
3
+ * First idea
4
+ * Second idea
5
+
6
+
7
+ # Things to Try
8
+
9
+ * Idea
10
+ * Idea
11
+
12
+ # Feedback Ideas
13
+
14
+ * Feedback
15
+ * Feedback
16
+
17
+ # Problems To Work On
18
+
19
+ * Problem
20
+ * Problem
21
+
22
+
@@ -0,0 +1,26 @@
1
+ # Playtesting Log
2
+
3
+ # Playtest Report Survey
4
+
5
+ ## Basic Info
6
+ * Num. Players:
7
+ * How many sessions of this game have you played before?
8
+ * How long did you play?
9
+ * How did you prepare for teaching the rules? Read the sheet with everyone there, or did someone read it ahead of time?
10
+ * What types of players played with you? What are their favorite games?
11
+ * What version were you testing?
12
+ * What date did you play?
13
+
14
+ ## Did it work?
15
+ * Was there a moment that you felt the game was "broken"? Describe what happened.
16
+ * How close were the scores? Did everyone feel like they had a fair chance at winning?
17
+ * Were there any moments that you had to go back to the rules for clarification? What resulted of that - are you still unclear, or was it just a misunderstanding?
18
+ * Any ideas for clearer rules?
19
+ * Any ideas for clearer icons, artwork, in-game helps, etc?
20
+
21
+ ## Was it fun?
22
+ * Based on the description, artwork, branding, etc. was this game what you expected?
23
+ * Were the theme, artwork, and icons engaging?
24
+ * Did this game have the depth of strategy that you were expecting?
25
+ * What were the moments that people felt like they were having the most fun? The least fun?
26
+ * Assuming trivial issues are fixed, would you recommend this to someone else?