squib 0.15.2 → 0.15.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +41 -41
  3. data/.travis.yml +17 -17
  4. data/CHANGELOG.md +400 -395
  5. data/CONTRIBUTING.md +40 -40
  6. data/Dockerfile +25 -25
  7. data/Gemfile +2 -2
  8. data/LICENSE.txt +22 -22
  9. data/README.md +145 -145
  10. data/RELEASE TODO.md +21 -21
  11. data/Rakefile +48 -48
  12. data/appveyor.yml +25 -25
  13. data/bin/squib +4 -4
  14. data/lib/squib.rb +32 -32
  15. data/lib/squib/api/background.rb +15 -15
  16. data/lib/squib/api/data.rb +137 -137
  17. data/lib/squib/api/groups.rb +54 -54
  18. data/lib/squib/api/image.rb +49 -49
  19. data/lib/squib/api/save.rb +83 -83
  20. data/lib/squib/api/settings.rb +21 -21
  21. data/lib/squib/api/shapes.rb +124 -124
  22. data/lib/squib/api/text.rb +25 -25
  23. data/lib/squib/api/text_embed.rb +71 -71
  24. data/lib/squib/api/units.rb +27 -27
  25. data/lib/squib/args/arg_loader.rb +126 -126
  26. data/lib/squib/args/box.rb +55 -55
  27. data/lib/squib/args/card_range.rb +32 -32
  28. data/lib/squib/args/color_validator.rb +12 -12
  29. data/lib/squib/args/coords.rb +35 -35
  30. data/lib/squib/args/csv_opts.rb +25 -25
  31. data/lib/squib/args/dir_validator.rb +16 -16
  32. data/lib/squib/args/draw.rb +92 -92
  33. data/lib/squib/args/embed_adjust.rb +25 -25
  34. data/lib/squib/args/embed_key.rb +17 -17
  35. data/lib/squib/args/hand_special.rb +37 -37
  36. data/lib/squib/args/import.rb +40 -40
  37. data/lib/squib/args/input_file.rb +37 -37
  38. data/lib/squib/args/paint.rb +44 -44
  39. data/lib/squib/args/paragraph.rb +116 -116
  40. data/lib/squib/args/save_batch.rb +63 -63
  41. data/lib/squib/args/scale_box.rb +53 -53
  42. data/lib/squib/args/sheet.rb +172 -172
  43. data/lib/squib/args/showcase_special.rb +41 -41
  44. data/lib/squib/args/sprue_file.rb +44 -44
  45. data/lib/squib/args/svg_special.rb +37 -37
  46. data/lib/squib/args/transform.rb +61 -61
  47. data/lib/squib/args/typographer.rb +119 -119
  48. data/lib/squib/args/unit_conversion.rb +29 -29
  49. data/lib/squib/builtin/layouts/economy.yml +85 -85
  50. data/lib/squib/builtin/layouts/fantasy.yml +101 -101
  51. data/lib/squib/builtin/layouts/hand.yml +62 -62
  52. data/lib/squib/builtin/layouts/party.yml +94 -94
  53. data/lib/squib/builtin/layouts/playing-card.yml +35 -35
  54. data/lib/squib/builtin/layouts/tuck_box.yml +46 -46
  55. data/lib/squib/builtin/projects/advanced/.gitignore +4 -4
  56. data/lib/squib/builtin/projects/advanced/ABOUT.md +19 -19
  57. data/lib/squib/builtin/projects/advanced/Gemfile +11 -11
  58. data/lib/squib/builtin/projects/advanced/Guardfile +21 -21
  59. data/lib/squib/builtin/projects/advanced/IDEAS.md +22 -22
  60. data/lib/squib/builtin/projects/advanced/PLAYTESTING.md +26 -26
  61. data/lib/squib/builtin/projects/advanced/Rakefile +27 -27
  62. data/lib/squib/builtin/projects/advanced/config.yml +49 -49
  63. data/lib/squib/builtin/projects/advanced/docs/PNP NOTES.md +3 -3
  64. data/lib/squib/builtin/projects/advanced/docs/RULES.md +21 -21
  65. data/lib/squib/builtin/projects/advanced/img/example.svg +60 -60
  66. data/lib/squib/builtin/projects/advanced/layouts/deck.yml +27 -27
  67. data/lib/squib/builtin/projects/advanced/src/deck.rb +34 -34
  68. data/lib/squib/builtin/projects/advanced/src/version.rb +3 -3
  69. data/lib/squib/builtin/projects/basic/.gitignore +4 -4
  70. data/lib/squib/builtin/projects/basic/ABOUT.md +19 -19
  71. data/lib/squib/builtin/projects/basic/Gemfile +3 -3
  72. data/lib/squib/builtin/projects/basic/IDEAS.md +22 -22
  73. data/lib/squib/builtin/projects/basic/PLAYTESTING.md +26 -26
  74. data/lib/squib/builtin/projects/basic/PNP NOTES.md +3 -3
  75. data/lib/squib/builtin/projects/basic/RULES.md +21 -21
  76. data/lib/squib/builtin/projects/basic/Rakefile +7 -7
  77. data/lib/squib/builtin/projects/basic/config.yml +49 -49
  78. data/lib/squib/builtin/projects/basic/deck.rb +6 -6
  79. data/lib/squib/builtin/sprues/a4_euro_card.yml +42 -42
  80. data/lib/squib/builtin/sprues/a4_poker_card_8up.yml +40 -40
  81. data/lib/squib/builtin/sprues/a4_poker_card_9up.yml +42 -42
  82. data/lib/squib/builtin/sprues/a4_usa_card.yml +42 -42
  83. data/lib/squib/builtin/sprues/drivethrucards_1up.yml +10 -10
  84. data/lib/squib/builtin/sprues/letter_poker_card_9up.yml +25 -25
  85. data/lib/squib/builtin/sprues/letter_poker_foldable_8up.yml +52 -52
  86. data/lib/squib/builtin/sprues/printplaygames_18up.yml +68 -68
  87. data/lib/squib/card.rb +75 -75
  88. data/lib/squib/commands/cli.rb +39 -39
  89. data/lib/squib/commands/data/template_option.rb +109 -109
  90. data/lib/squib/commands/make_sprue.rb +277 -277
  91. data/lib/squib/commands/new.rb +77 -77
  92. data/lib/squib/conf.rb +139 -139
  93. data/lib/squib/constants.rb +17 -17
  94. data/lib/squib/deck.rb +116 -116
  95. data/lib/squib/graphics/background.rb +14 -14
  96. data/lib/squib/graphics/cairo_context_wrapper.rb +113 -113
  97. data/lib/squib/graphics/embedding_utils.rb +28 -28
  98. data/lib/squib/graphics/gradient_regex.rb +47 -47
  99. data/lib/squib/graphics/hand.rb +42 -42
  100. data/lib/squib/graphics/image.rb +123 -123
  101. data/lib/squib/graphics/save_doc.rb +61 -61
  102. data/lib/squib/graphics/save_images.rb +52 -52
  103. data/lib/squib/graphics/save_pdf.rb +90 -90
  104. data/lib/squib/graphics/save_sprue.rb +219 -219
  105. data/lib/squib/graphics/shapes.rb +143 -143
  106. data/lib/squib/graphics/showcase.rb +85 -85
  107. data/lib/squib/graphics/text.rb +174 -174
  108. data/lib/squib/import/data_frame.rb +108 -108
  109. data/lib/squib/layout_parser.rb +138 -138
  110. data/lib/squib/progress.rb +38 -38
  111. data/lib/squib/sample_helpers.rb +34 -34
  112. data/lib/squib/sprues/crop_line.rb +28 -28
  113. data/lib/squib/sprues/crop_line_dash.rb +35 -35
  114. data/lib/squib/sprues/invalid_sprue_definition.rb +9 -9
  115. data/lib/squib/sprues/sprue.rb +206 -206
  116. data/lib/squib/sprues/sprue_schema.rb +50 -50
  117. data/lib/squib/version.rb +10 -10
  118. data/samples/autoscale_font/_autoscale_font.rb +29 -29
  119. data/samples/backend/_backend.rb +26 -26
  120. data/samples/basic.rb +19 -19
  121. data/samples/build_groups/build_groups.rb +36 -36
  122. data/samples/colors/_colors.rb +44 -44
  123. data/samples/colors/_gradients.rb +34 -34
  124. data/samples/colors/_switch_color.rb +33 -33
  125. data/samples/config/config_text_markup.rb +20 -20
  126. data/samples/config/custom_config.rb +18 -18
  127. data/samples/data/_csv.rb +33 -33
  128. data/samples/data/_excel.rb +55 -55
  129. data/samples/data/_yaml.rb +12 -12
  130. data/samples/hello_world.rb +6 -6
  131. data/samples/images/_cairo_access.rb +39 -39
  132. data/samples/images/_images.rb +104 -104
  133. data/samples/images/_more_load_images.rb +102 -102
  134. data/samples/intro/01_hello.rb +8 -8
  135. data/samples/intro/02_options.rb +14 -14
  136. data/samples/intro/03_layout.rb +11 -11
  137. data/samples/intro/04_arrays.rb +15 -15
  138. data/samples/intro/05_excel.rb +14 -14
  139. data/samples/layouts/builtin_layouts.rb +97 -97
  140. data/samples/layouts/layouts.rb +71 -71
  141. data/samples/project/src/characters.rb +8 -8
  142. data/samples/project/src/skills.rb +7 -7
  143. data/samples/proofs/_tgc_proofs.rb +16 -16
  144. data/samples/ranges/_ranges.rb +64 -64
  145. data/samples/saves/_hand.rb +23 -23
  146. data/samples/saves/_portrait_landscape.rb +23 -23
  147. data/samples/saves/_save_filenames.rb +24 -24
  148. data/samples/saves/_save_pdf.rb +29 -29
  149. data/samples/saves/_saves.rb +51 -51
  150. data/samples/saves/_showcase.rb +25 -25
  151. data/samples/shapes/_draw_shapes.rb +60 -60
  152. data/samples/shapes/_proofs.rb +22 -22
  153. data/samples/sprues/_advanced_sprues.rb +25 -25
  154. data/samples/sprues/_builtin_sprues.rb +21 -21
  155. data/samples/sprues/_fold_sheet.rb +27 -27
  156. data/samples/sprues/_hex_tiles.rb +15 -15
  157. data/samples/sprues/_mints.rb +11 -11
  158. data/samples/sprues/_sprue_example.rb +11 -11
  159. data/samples/text/_embed_text.rb +128 -128
  160. data/samples/text/_text.rb +47 -47
  161. data/samples/text/_text_options.rb +102 -102
  162. data/samples/text/bug134.rb +14 -14
  163. data/samples/units/_units.rb +32 -32
  164. data/squib.gemspec +52 -52
  165. metadata +62 -63
@@ -1,102 +1,102 @@
1
- # encoding: UTF-8
2
- require 'squib'
3
-
4
- data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
5
- 'level' => [1, 2, 3] }
6
- longtext = "This is left-justified text, with newlines.\nWhat do you know about tweetle beetles? well... When tweetle beetles fight, it's called a tweetle beetle battle. And when they battle in a puddle, it's a tweetle beetle puddle battle. AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle. AND... When beetles battle beetles in a puddle paddle battle and the beetle battle puddle is a puddle in a bottle... ..they call this a tweetle beetle bottle puddle paddle battle muddle."
7
-
8
- Squib::Deck.new(width: 825, height: 1125, cards: 3) do
9
- background color: :white
10
- rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
11
- rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
12
-
13
- # Arrays are rendered over each card
14
- text str: data['name'], x: 250, y: 55, font: 'Arial weight=900 18'
15
- text str: data['level'], x: 65, y: 40, font: 'Arial 24', color: :burnt_orange
16
-
17
- text str: 'Font strings are expressive!', x:65, y: 200,
18
- font: 'Impact bold italic 12'
19
-
20
- text str: 'Font strings are expressive!', x:65, y: 300,
21
- font: 'Arial,Verdana weight=900 style=oblique 12'
22
-
23
- text str: 'Font string sizes can be overridden per card.', x: 65, y: 350,
24
- font: 'Impact 12', font_size: [5, 7, 8]
25
-
26
- text str: 'This text has fixed width, fixed height, center-aligned, middle-valigned, and has a red hint',
27
- hint: :red,
28
- x: 65, y: 400,
29
- width: 300, height: 125,
30
- align: :center, valign: 'MIDDLE', # these can be specified with case-insenstive strings too
31
- font: 'Serif 5'
32
-
33
- extents = text str: 'Ink extent return value',
34
- x: 65, y: 550,
35
- font: 'Sans Bold', font_size: [5, 7, 8]
36
- margin = 10
37
- # Extents come back as an array of hashes, which can get split out like this
38
- ws = extents.inject([]) { |arr, ext| arr << ext[:width] + 10; arr }
39
- hs = extents.inject([]) { |arr, ext| arr << ext[:height] + 10; arr }
40
- rect x: 65 - margin / 2, y: 550 - margin / 2,
41
- width: ws, height: hs,
42
- radius: 10, stroke_color: :black
43
-
44
- # If width & height are defined and the text will overflow the box, we can ellipsize.
45
- text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
46
- hint: :green, font: 'Arial 7',
47
- x: 450, y: 400,
48
- width: 280, height: 180,
49
- ellipsize: true
50
-
51
- # Text hints are guides for showing you how your text boxes are laid out exactly
52
- hint text: :cyan
53
- set font: 'Serif 7' # Impacts all future text calls (unless they specify differently)
54
- text str: 'Text hints & fonts are globally togglable!', x: 65, y: 625
55
- set font: :default # back to Squib-wide default
56
- hint text: :off
57
- text str: 'See? No hint here.',
58
- x: 565, y: 625,
59
- font: 'Arial 7'
60
-
61
- # Text can be rotated, in radians, about the upper-left corner of the text box.
62
- text str: 'Rotated',
63
- x: 565, y: 675, angle: 0.2,
64
- font: 'Arial 6', hint: :red
65
-
66
- # Text can be justified, and have newlines
67
- text str: longtext, font: 'Arial 5',
68
- x: 65, y: 700,
69
- width: '1.5in', height: inches(1),
70
- justify: true, spacing: -6
71
-
72
- # Here's how you embed images into text.
73
- # Pass a block to the method call and use the given context
74
- embed_text = 'Embedded icons! Take 1 :tool: and gain 2:health:. If Level 2, take 2 :tool:'
75
- text(str: embed_text, font: 'Sans 6',
76
- x: '1.8in', y: '2.5in', width: '0.85in',
77
- align: :left, ellipsize: false) do |embed|
78
- embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
79
- embed.svg key: ':health:', width: 28, height: 28, file: 'glass-heart.svg'
80
- end
81
-
82
- text str: 'Fill n <span fgcolor="#ff0000">stroke</span>',
83
- color: :green, stroke_width: 2.0, stroke_color: :blue,
84
- x: '1.8in', y: '2.9in', width: '0.85in', font: 'Sans Bold 9', markup: true
85
-
86
- text str: 'Stroke n <span fgcolor="#ff0000">fill</span>',
87
- color: :green, stroke_width: 2.0, stroke_color: :blue, stroke_strategy: :stroke_first,
88
- x: '1.8in', y: '3.0in', width: '0.85in', font: 'Sans Bold 9', markup: true
89
-
90
- text str: 'Dotted',
91
- color: :white, stroke_width: 2.0, dash: '4 2', stroke_color: :black,
92
- x: '1.8in', y: '3.1in', width: '0.85in', font: 'Sans Bold 9', markup: true
93
- #
94
- text str: "<b>Markup</b> is <i>quite</i> <s>'easy'</s> <span fgcolor=\"\#ff0000\">awesome</span>. Can't beat those \"smart\" 'quotes', now with 10--20% more en-dashes --- and em-dashes --- with explicit ellipses too...",
95
- markup: true,
96
- x: 50, y: 1000,
97
- width: 750, height: 100,
98
- valign: :bottom,
99
- font: 'Serif 6', hint: :cyan
100
-
101
- save prefix: 'text_options_', format: :png
102
- end
1
+ # encoding: UTF-8
2
+ require 'squib'
3
+
4
+ data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
5
+ 'level' => [1, 2, 3] }
6
+ longtext = "This is left-justified text, with newlines.\nWhat do you know about tweetle beetles? well... When tweetle beetles fight, it's called a tweetle beetle battle. And when they battle in a puddle, it's a tweetle beetle puddle battle. AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle. AND... When beetles battle beetles in a puddle paddle battle and the beetle battle puddle is a puddle in a bottle... ..they call this a tweetle beetle bottle puddle paddle battle muddle."
7
+
8
+ Squib::Deck.new(width: 825, height: 1125, cards: 3) do
9
+ background color: :white
10
+ rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
11
+ rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
12
+
13
+ # Arrays are rendered over each card
14
+ text str: data['name'], x: 250, y: 55, font: 'Arial weight=900 18'
15
+ text str: data['level'], x: 65, y: 40, font: 'Arial 24', color: :burnt_orange
16
+
17
+ text str: 'Font strings are expressive!', x:65, y: 200,
18
+ font: 'Impact bold italic 12'
19
+
20
+ text str: 'Font strings are expressive!', x:65, y: 300,
21
+ font: 'Arial,Verdana weight=900 style=oblique 12'
22
+
23
+ text str: 'Font string sizes can be overridden per card.', x: 65, y: 350,
24
+ font: 'Impact 12', font_size: [5, 7, 8]
25
+
26
+ text str: 'This text has fixed width, fixed height, center-aligned, middle-valigned, and has a red hint',
27
+ hint: :red,
28
+ x: 65, y: 400,
29
+ width: 300, height: 125,
30
+ align: :center, valign: 'MIDDLE', # these can be specified with case-insenstive strings too
31
+ font: 'Serif 5'
32
+
33
+ extents = text str: 'Ink extent return value',
34
+ x: 65, y: 550,
35
+ font: 'Sans Bold', font_size: [5, 7, 8]
36
+ margin = 10
37
+ # Extents come back as an array of hashes, which can get split out like this
38
+ ws = extents.inject([]) { |arr, ext| arr << ext[:width] + 10; arr }
39
+ hs = extents.inject([]) { |arr, ext| arr << ext[:height] + 10; arr }
40
+ rect x: 65 - margin / 2, y: 550 - margin / 2,
41
+ width: ws, height: hs,
42
+ radius: 10, stroke_color: :black
43
+
44
+ # If width & height are defined and the text will overflow the box, we can ellipsize.
45
+ text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
46
+ hint: :green, font: 'Arial 7',
47
+ x: 450, y: 400,
48
+ width: 280, height: 180,
49
+ ellipsize: true
50
+
51
+ # Text hints are guides for showing you how your text boxes are laid out exactly
52
+ hint text: :cyan
53
+ set font: 'Serif 7' # Impacts all future text calls (unless they specify differently)
54
+ text str: 'Text hints & fonts are globally togglable!', x: 65, y: 625
55
+ set font: :default # back to Squib-wide default
56
+ hint text: :off
57
+ text str: 'See? No hint here.',
58
+ x: 565, y: 625,
59
+ font: 'Arial 7'
60
+
61
+ # Text can be rotated, in radians, about the upper-left corner of the text box.
62
+ text str: 'Rotated',
63
+ x: 565, y: 675, angle: 0.2,
64
+ font: 'Arial 6', hint: :red
65
+
66
+ # Text can be justified, and have newlines
67
+ text str: longtext, font: 'Arial 5',
68
+ x: 65, y: 700,
69
+ width: '1.5in', height: inches(1),
70
+ justify: true, spacing: -6
71
+
72
+ # Here's how you embed images into text.
73
+ # Pass a block to the method call and use the given context
74
+ embed_text = 'Embedded icons! Take 1 :tool: and gain 2:health:. If Level 2, take 2 :tool:'
75
+ text(str: embed_text, font: 'Sans 6',
76
+ x: '1.8in', y: '2.5in', width: '0.85in',
77
+ align: :left, ellipsize: false) do |embed|
78
+ embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
79
+ embed.svg key: ':health:', width: 28, height: 28, file: 'glass-heart.svg'
80
+ end
81
+
82
+ text str: 'Fill n <span fgcolor="#ff0000">stroke</span>',
83
+ color: :green, stroke_width: 2.0, stroke_color: :blue,
84
+ x: '1.8in', y: '2.9in', width: '0.85in', font: 'Sans Bold 9', markup: true
85
+
86
+ text str: 'Stroke n <span fgcolor="#ff0000">fill</span>',
87
+ color: :green, stroke_width: 2.0, stroke_color: :blue, stroke_strategy: :stroke_first,
88
+ x: '1.8in', y: '3.0in', width: '0.85in', font: 'Sans Bold 9', markup: true
89
+
90
+ text str: 'Dotted',
91
+ color: :white, stroke_width: 2.0, dash: '4 2', stroke_color: :black,
92
+ x: '1.8in', y: '3.1in', width: '0.85in', font: 'Sans Bold 9', markup: true
93
+ #
94
+ text str: "<b>Markup</b> is <i>quite</i> <s>'easy'</s> <span fgcolor=\"\#ff0000\">awesome</span>. Can't beat those \"smart\" 'quotes', now with 10--20% more en-dashes --- and em-dashes --- with explicit ellipses too...",
95
+ markup: true,
96
+ x: 50, y: 1000,
97
+ width: 750, height: 100,
98
+ valign: :bottom,
99
+ font: 'Serif 6', hint: :cyan
100
+
101
+ save prefix: 'text_options_', format: :png
102
+ end
@@ -1,14 +1,14 @@
1
- require 'squib'
2
- require 'game_icons'
3
-
4
- Squib::Deck.new(cards: 1) do
5
- rect
6
- text str: 'foo', x: 275, y: 75, width: 500, height: 500, valign: :middle, hint: :blue
7
- text(str: '(heart)(heart2)',
8
- x: 75, y: 75, width: 500, height: 500,
9
- valign: :middle, hint: :red) do |embed|
10
- embed.svg key: '(heart)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
11
- embed.svg key: '(heart2)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
12
- end
13
- save_png prefix: 'bug_134_'
14
- end
1
+ require 'squib'
2
+ require 'game_icons'
3
+
4
+ Squib::Deck.new(cards: 1) do
5
+ rect
6
+ text str: 'foo', x: 275, y: 75, width: 500, height: 500, valign: :middle, hint: :blue
7
+ text(str: '(heart)(heart2)',
8
+ x: 75, y: 75, width: 500, height: 500,
9
+ valign: :middle, hint: :red) do |embed|
10
+ embed.svg key: '(heart)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
11
+ embed.svg key: '(heart2)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
12
+ end
13
+ save_png prefix: 'bug_134_'
14
+ end
@@ -1,32 +1,32 @@
1
- require 'squib'
2
-
3
- Squib::Deck.new(width: '1.5in', height: '1.5in') do
4
- background color: :white
5
-
6
- # We can use our DSL-method to use inches
7
- # Computed using @dpi (set to 300 by default)
8
- bleed = inches(0.125)
9
- cut = inches(1.25)
10
- rect x: bleed, y: bleed,
11
- width: cut, height: cut,
12
- dash: '0.5mm 0.5mm' # yes, units are in dashes too
13
-
14
- # other units too
15
- cm(2) # We can also use cm this way
16
- cm(2) + inches(2) # We can mix units too
17
-
18
- # Or we can use a string ending with cm or in
19
- safe_margin = '0.25 in' #you can have a space too
20
- safe_width = '1 in'
21
- safe_height = '1.0 in ' # trailing space is ok too
22
- rect x: safe_margin, y: safe_margin,
23
- width: safe_width, height: safe_height,
24
- radius: '2 mm '
25
-
26
- # We can also do stuff in layout. Check out the yml file...
27
- # (even cleaner in Yaml since we don't need quotes!)
28
- use_layout file: 'using_units.yml'
29
- text str: 'Hello.', layout: :example
30
-
31
- save prefix: 'units_', format: :png
32
- end
1
+ require 'squib'
2
+
3
+ Squib::Deck.new(width: '1.5in', height: '1.5in') do
4
+ background color: :white
5
+
6
+ # We can use our DSL-method to use inches
7
+ # Computed using @dpi (set to 300 by default)
8
+ bleed = inches(0.125)
9
+ cut = inches(1.25)
10
+ rect x: bleed, y: bleed,
11
+ width: cut, height: cut,
12
+ dash: '0.5mm 0.5mm' # yes, units are in dashes too
13
+
14
+ # other units too
15
+ cm(2) # We can also use cm this way
16
+ cm(2) + inches(2) # We can mix units too
17
+
18
+ # Or we can use a string ending with cm or in
19
+ safe_margin = '0.25 in' #you can have a space too
20
+ safe_width = '1 in'
21
+ safe_height = '1.0 in ' # trailing space is ok too
22
+ rect x: safe_margin, y: safe_margin,
23
+ width: safe_width, height: safe_height,
24
+ radius: '2 mm '
25
+
26
+ # We can also do stuff in layout. Check out the yml file...
27
+ # (even cleaner in Yaml since we don't need quotes!)
28
+ use_layout file: 'using_units.yml'
29
+ text str: 'Hello.', layout: :example
30
+
31
+ save prefix: 'units_', format: :png
32
+ end
@@ -1,52 +1,52 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'squib/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.specification_version = 2 if spec.respond_to? :specification_version=
8
- spec.required_rubygems_version = Gem::Requirement.new('>= 0') if spec.respond_to? :required_rubygems_version=
9
- spec.rubygems_version = '2.2.2'
10
- spec.required_ruby_version = '>= 2.4.0'
11
-
12
- spec.name = 'squib'
13
- spec.version = Squib::VERSION
14
- spec.license = 'MIT'
15
-
16
- spec.summary = 'A Ruby DSL for prototyping card games'
17
- spec.description = 'Squib is a Ruby DSL for prototyping card games'
18
- spec.authors = ['Andy Meneely']
19
- spec.email = 'andy.meneely@gmail.com'
20
- spec.homepage = 'https://github.com/andymeneely/squib'
21
-
22
- spec.rdoc_options = ['--charset=UTF-8']
23
- spec.extra_rdoc_files = Dir['README.md', 'samples/**/*.rb']
24
-
25
- spec.files = `git ls-files -z`.
26
- split("\x0").
27
- reject { |f| f.match(%r{^(spec|samples|docs|benchmarks)/}) }
28
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
29
- spec.test_files = spec.files.grep(/^(spec|samples|docs|benchmarks)\//)
30
- spec.require_paths = ['lib']
31
-
32
- spec.add_runtime_dependency 'cairo', '1.16.4'
33
- spec.add_runtime_dependency 'classy_hash', '0.2.1'
34
- spec.add_runtime_dependency 'gio2', '3.3.7'
35
- spec.add_runtime_dependency 'gobject-introspection', '3.3.7'
36
- spec.add_runtime_dependency 'highline', '2.0.2'
37
- spec.add_runtime_dependency 'mercenary', '0.3.6'
38
- spec.add_runtime_dependency 'nokogiri', '1.10.4'
39
- spec.add_runtime_dependency 'pango', '3.3.7'
40
- spec.add_runtime_dependency 'roo', '2.8.2'
41
- spec.add_runtime_dependency 'rsvg2', '3.3.7'
42
- spec.add_runtime_dependency 'ruby-progressbar', '1.10.0'
43
-
44
- spec.add_development_dependency 'bundler'
45
- spec.add_development_dependency 'coveralls', '>= 0.8.21'
46
- spec.add_development_dependency 'game_icons'
47
- spec.add_development_dependency 'launchy'
48
- spec.add_development_dependency 'rake'
49
- spec.add_development_dependency 'byebug'
50
- spec.add_development_dependency 'rspec', '~> 3.8'
51
-
52
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'squib/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.specification_version = 2 if spec.respond_to? :specification_version=
8
+ spec.required_rubygems_version = Gem::Requirement.new('>= 0') if spec.respond_to? :required_rubygems_version=
9
+ spec.rubygems_version = '2.2.2'
10
+ spec.required_ruby_version = '>= 2.4.0'
11
+
12
+ spec.name = 'squib'
13
+ spec.version = Squib::VERSION
14
+ spec.license = 'MIT'
15
+
16
+ spec.summary = 'A Ruby DSL for prototyping card games'
17
+ spec.description = 'Squib is a Ruby DSL for prototyping card games'
18
+ spec.authors = ['Andy Meneely']
19
+ spec.email = 'andy.meneely@gmail.com'
20
+ spec.homepage = 'https://github.com/andymeneely/squib'
21
+
22
+ spec.rdoc_options = ['--charset=UTF-8']
23
+ spec.extra_rdoc_files = Dir['README.md', 'samples/**/*.rb']
24
+
25
+ spec.files = `git ls-files -z`.
26
+ split("\x0").
27
+ reject { |f| f.match(%r{^(spec|samples|docs|benchmarks)/}) }
28
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
29
+ spec.test_files = spec.files.grep(/^(spec|samples|docs|benchmarks)\//)
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_runtime_dependency 'cairo', '~> 1.16'
33
+ spec.add_runtime_dependency 'classy_hash', '0.2.1'
34
+ spec.add_runtime_dependency 'gio2', '~> 3.4'
35
+ spec.add_runtime_dependency 'gobject-introspection', '~> 3.4'
36
+ spec.add_runtime_dependency 'highline', '2.0.2'
37
+ spec.add_runtime_dependency 'mercenary', '0.3.6'
38
+ spec.add_runtime_dependency 'nokogiri', '1.10.4'
39
+ spec.add_runtime_dependency 'pango', '~> 3.4'
40
+ spec.add_runtime_dependency 'roo', '2.8.2'
41
+ spec.add_runtime_dependency 'rsvg2', '~> 3.4'
42
+ spec.add_runtime_dependency 'ruby-progressbar', '~> 1.10'
43
+
44
+ spec.add_development_dependency 'bundler'
45
+ spec.add_development_dependency 'coveralls', '>= 0.8.21'
46
+ spec.add_development_dependency 'game_icons'
47
+ spec.add_development_dependency 'launchy'
48
+ spec.add_development_dependency 'rake'
49
+ spec.add_development_dependency 'byebug'
50
+ spec.add_development_dependency 'rspec', '~> 3.8'
51
+
52
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Meneely
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-26 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cairo
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.16.4
19
+ version: '1.16'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.16.4
26
+ version: '1.16'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: classy_hash
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: gio2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.3.7
47
+ version: '3.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.3.7
54
+ version: '3.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: gobject-introspection
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.3.7
61
+ version: '3.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 3.3.7
68
+ version: '3.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: highline
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: pango
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '='
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 3.3.7
117
+ version: '3.4'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '='
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 3.3.7
124
+ version: '3.4'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: roo
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -140,30 +140,30 @@ dependencies:
140
140
  name: rsvg2
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '='
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 3.3.7
145
+ version: '3.4'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '='
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 3.3.7
152
+ version: '3.4'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: ruby-progressbar
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '='
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.10.0
159
+ version: '1.10'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '='
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.10.0
166
+ version: '1.10'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: bundler
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -269,52 +269,52 @@ executables:
269
269
  extensions: []
270
270
  extra_rdoc_files:
271
271
  - README.md
272
- - samples/ranges/_ranges.rb
273
- - samples/sprues/_builtin_sprues.rb
274
- - samples/sprues/_sprue_example.rb
275
- - samples/sprues/_advanced_sprues.rb
276
- - samples/sprues/_mints.rb
277
- - samples/sprues/_fold_sheet.rb
278
- - samples/sprues/_hex_tiles.rb
272
+ - samples/autoscale_font/_autoscale_font.rb
273
+ - samples/backend/_backend.rb
274
+ - samples/basic.rb
275
+ - samples/build_groups/build_groups.rb
276
+ - samples/colors/_colors.rb
277
+ - samples/colors/_gradients.rb
278
+ - samples/colors/_switch_color.rb
279
+ - samples/config/config_text_markup.rb
280
+ - samples/config/custom_config.rb
281
+ - samples/data/_csv.rb
282
+ - samples/data/_excel.rb
283
+ - samples/data/_yaml.rb
284
+ - samples/hello_world.rb
285
+ - samples/images/_cairo_access.rb
286
+ - samples/images/_images.rb
287
+ - samples/images/_more_load_images.rb
279
288
  - samples/intro/01_hello.rb
289
+ - samples/intro/02_options.rb
280
290
  - samples/intro/03_layout.rb
281
291
  - samples/intro/04_arrays.rb
282
292
  - samples/intro/05_excel.rb
283
- - samples/intro/02_options.rb
284
- - samples/config/custom_config.rb
285
- - samples/config/config_text_markup.rb
286
- - samples/images/_more_load_images.rb
287
- - samples/images/_cairo_access.rb
288
- - samples/images/_images.rb
289
- - samples/proofs/_tgc_proofs.rb
290
- - samples/shapes/_draw_shapes.rb
291
- - samples/shapes/_proofs.rb
292
- - samples/backend/_backend.rb
293
- - samples/basic.rb
294
- - samples/units/_units.rb
293
+ - samples/layouts/builtin_layouts.rb
294
+ - samples/layouts/layouts.rb
295
295
  - samples/project/src/characters.rb
296
296
  - samples/project/src/skills.rb
297
- - samples/saves/_save_filenames.rb
297
+ - samples/proofs/_tgc_proofs.rb
298
+ - samples/ranges/_ranges.rb
299
+ - samples/saves/_hand.rb
300
+ - samples/saves/_portrait_landscape.rb
298
301
  - samples/saves/_saves.rb
299
- - samples/saves/_showcase.rb
302
+ - samples/saves/_save_filenames.rb
300
303
  - samples/saves/_save_pdf.rb
301
- - samples/saves/_portrait_landscape.rb
302
- - samples/saves/_hand.rb
303
- - samples/layouts/layouts.rb
304
- - samples/layouts/builtin_layouts.rb
305
- - samples/colors/_switch_color.rb
306
- - samples/colors/_gradients.rb
307
- - samples/colors/_colors.rb
308
- - samples/build_groups/build_groups.rb
309
- - samples/hello_world.rb
304
+ - samples/saves/_showcase.rb
305
+ - samples/shapes/_draw_shapes.rb
306
+ - samples/shapes/_proofs.rb
307
+ - samples/sprues/_advanced_sprues.rb
308
+ - samples/sprues/_builtin_sprues.rb
309
+ - samples/sprues/_fold_sheet.rb
310
+ - samples/sprues/_hex_tiles.rb
311
+ - samples/sprues/_mints.rb
312
+ - samples/sprues/_sprue_example.rb
310
313
  - samples/text/bug134.rb
311
- - samples/text/_text.rb
312
314
  - samples/text/_embed_text.rb
315
+ - samples/text/_text.rb
313
316
  - samples/text/_text_options.rb
314
- - samples/autoscale_font/_autoscale_font.rb
315
- - samples/data/_yaml.rb
316
- - samples/data/_csv.rb
317
- - samples/data/_excel.rb
317
+ - samples/units/_units.rb
318
318
  files:
319
319
  - ".gitignore"
320
320
  - ".travis.yml"
@@ -503,8 +503,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
503
503
  - !ruby/object:Gem::Version
504
504
  version: '0'
505
505
  requirements: []
506
- rubyforge_project:
507
- rubygems_version: 2.7.6.2
506
+ rubygems_version: 3.0.3
508
507
  signing_key:
509
508
  specification_version: 2
510
509
  summary: A Ruby DSL for prototyping card games