Browse Source

sprues: rename "template" to "sprue"

Also:
  * Move stuff around to a builtin/ folder
  * Separate out classes to follow my one-class-per-file convention
  * Samples are renamed to the underscore convention

I just like the word "sprue", and it's more descriptive than our original choice of "template". If I had to start Squib all over again, I would probably name it "Sprue" :P
dev
Andy Meneely 9 years ago
parent
commit
0d076b1e85
  1. 4
      CHANGELOG.md
  2. 8
      bin/squib
  3. 2
      lib/squib.rb
  4. 31
      lib/squib/api/save.rb
  5. 7
      lib/squib/args/sprue_file.rb
  6. 0
      lib/squib/builtin/sprues/a4_euro_card.yml
  7. 0
      lib/squib/builtin/sprues/a4_poker_card_8up.yml
  8. 0
      lib/squib/builtin/sprues/a4_poker_card_9up.yml
  9. 0
      lib/squib/builtin/sprues/a4_usa_card.yml
  10. 2
      lib/squib/commands/make_sprue.rb
  11. 6
      lib/squib/graphics/save_sprue.rb
  12. 42
      lib/squib/sprues/builtin/a4_euro_card.yml
  13. 40
      lib/squib/sprues/builtin/a4_poker_card_8up.yml
  14. 42
      lib/squib/sprues/builtin/a4_poker_card_9up.yml
  15. 42
      lib/squib/sprues/builtin/a4_usa_card.yml
  16. 28
      lib/squib/sprues/crop_line.rb
  17. 35
      lib/squib/sprues/crop_line_dash.rb
  18. 78
      lib/squib/sprues/sprue.rb
  19. 3
      samples/sprues/_fold_sheet.rb
  20. 3
      samples/sprues/_hex_tiles.rb
  21. 3
      samples/sprues/_use_package_template.rb
  22. 0
      samples/sprues/my_sprues/fold_sheet.yml
  23. 0
      samples/sprues/my_sprues/hex_tiles.yml
  24. 3
      spec/commands/new_spec.rb
  25. 0
      spec/data/sprues/basic.yml
  26. 0
      spec/data/sprues/card_center_coord.yml
  27. 0
      spec/data/sprues/card_rotation.yml
  28. 0
      spec/data/sprues/custom_crop_lines.yml
  29. 0
      spec/data/sprues/fail_no_card_height.yml
  30. 0
      spec/data/sprues/fail_no_card_width.yml
  31. 0
      spec/data/sprues/fail_no_sheet_height.yml
  32. 0
      spec/data/sprues/fail_no_sheet_width.yml
  33. 2
      spec/samples/samples_regression_spec.rb
  34. 6
      spec/spec_helper.rb
  35. 25
      spec/sprue_spec.rb

4
CHANGELOG.md

@ -4,12 +4,10 @@ Squib follows [semantic versioning](http://semver.org).
## v0.14.0 / Unreleased
Features:
* `save_pdf/save_sheet` method now supports `sprue`, which allows you to define templated layouts and position your cards freely (#217) by @felixleong. See docs for how to use this _very_ powerful feature!
* `circle` method now supports various `arc` options, so you can draw partial circles (#211) by @sparr
* `save_sheet` method now supports `rtl` or "right-to-left", for easier duplex printing of backs (#204, #208) by @sparr
<<<<<<< HEAD
* `yaml` method for reading in data, much like `csv` and `xlsx` by @blinks
* `save_pdf/save_sheet` method now supports `template_file`, which allows you to define
template layouts and position your cards freely (#217) by @felixleong
Special thanks to @sparr, @blinks and @felixleong for all of their work!!

8
bin/squib

@ -16,12 +16,12 @@ Mercenary.program(:squib) do |p|
end
end
p.command(:make_template) do |c|
c.syntax 'make_template'
c.description 'Creates a template definition file to generate a templated PDF.'
p.command(:make_sprue) do |c|
c.syntax 'make_sprue'
c.description 'Creates a sprue definition file.'
c.action do |args, options|
Squib::Commands::MakeTemplate.new.process(args)
Squib::Commands::MakeSprue.new.process(args)
end
end

2
lib/squib.rb

@ -4,7 +4,7 @@ require 'pango'
require 'rsvg2'
require_relative 'squib/version'
require_relative 'squib/commands/new'
require_relative 'squib/commands/make_template'
require_relative 'squib/commands/make_sprue'
require_relative 'squib/deck'
require_relative 'squib/card'

31
lib/squib/api/save.rb

@ -1,13 +1,12 @@
require_relative '../template'
require_relative '../args/card_range'
require_relative '../args/hand_special'
require_relative '../args/output_file'
require_relative '../args/save_batch'
require_relative '../args/sheet'
require_relative '../args/template_file'
require_relative '../args/output_file'
require_relative '../args/showcase_special'
require_relative '../args/sprue_file'
require_relative '../graphics/save_pdf'
require_relative '../graphics/save_templated_sheet'
require_relative '../graphics/save_sprue'
module Squib
class Deck
@ -23,15 +22,15 @@ module Squib
def save_pdf(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
sheet = Args::Sheet.new(custom_colors, { file: 'output.pdf' }).load!(opts, expand_by: size, layout: layout, dpi: dpi)
tmpl_file = Args::TemplateFile.new.load!(opts, expand_by: size)
sprue_file = Args::SprueFile.new.load!(opts, expand_by: size)
if tmpl_file.template_file.nil?
if sprue_file.sprue.nil?
Graphics::SavePDF.new(self).render_pdf(range, sheet)
else
tmpl = Template.load tmpl_file.template_file, dpi
Graphics::SaveTemplatedSheetPDF.new(self, tmpl, sheet).render_sheet(
range
)
tmpl = Sprue.load sprue_file.sprue, dpi
Graphics::SaveSpruePDF.
new(self, tmpl, sheet).
render_sheet(range)
end
end
@ -52,15 +51,15 @@ module Squib
range = Args::CardRange.new(opts[:range], deck_size: size)
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
sheet = Args::Sheet.new(custom_colors, { margin: 0 }, size).load!(opts, expand_by: size, layout: layout, dpi: dpi)
tmpl_file = Args::TemplateFile.new.load!(opts, expand_by: size)
sprue_file = Args::SprueFile.new.load!(opts, expand_by: size)
if tmpl_file.template_file.nil?
if sprue_file.sprue.nil?
render_sheet(range, batch, sheet)
else
tmpl = Template.load tmpl_file.template_file, dpi
Graphics::SaveTemplatedSheetPNG.new(self, tmpl, batch).render_sheet(
range
)
tmpl = Sprue.load sprue_file.sprue, dpi
Graphics::SaveSpruePNG.
new(self, tmpl, batch).
render_sheet(range)
end
end

7
lib/squib/args/template_file.rb → lib/squib/args/sprue_file.rb

@ -3,8 +3,7 @@ require_relative 'arg_loader'
module Squib
# @api private
module Args
# Template file argument loader
class TemplateFile
class SprueFile
include ArgLoader
def initialize(dsl_method_default = {})
@ -13,7 +12,7 @@ module Squib
def self.parameters
{
template_file: nil
sprue: nil
}
end
@ -38,7 +37,7 @@ module Squib
private
def builtin(file)
"#{File.dirname(__FILE__)}/../sheet_templates/#{file}"
"#{File.dirname(__FILE__)}/../builtin/sprues/#{file}"
end
end
end

0
lib/squib/sheet_templates/a4_euro_card.yml → lib/squib/builtin/sprues/a4_euro_card.yml

0
lib/squib/sheet_templates/a4_poker_card_8up.yml → lib/squib/builtin/sprues/a4_poker_card_8up.yml

0
lib/squib/sheet_templates/a4_poker_card_9up.yml → lib/squib/builtin/sprues/a4_poker_card_9up.yml

0
lib/squib/sheet_templates/a4_usa_card.yml → lib/squib/builtin/sprues/a4_usa_card.yml

2
lib/squib/commands/make_template.rb → lib/squib/commands/make_sprue.rb

@ -12,7 +12,7 @@ module Squib
# +save_templated_sheet+
#
# @api public
class MakeTemplate
class MakeSprue
# :nodoc:
# @api private
def process(args)

6
lib/squib/graphics/save_templated_sheet.rb → lib/squib/graphics/save_sprue.rb

@ -1,7 +1,7 @@
module Squib
module Graphics
# Helper class to generate templated sheet.
class SaveTemplatedSheet
class SaveSprue
def initialize(deck, tmpl, outfile)
@deck = deck
@tmpl = tmpl
@ -184,7 +184,7 @@ module Squib
end
# Templated sheet renderer in PDF format.
class SaveTemplatedSheetPDF < SaveTemplatedSheet
class SaveSpruePDF < SaveSprue
def init_cc
ratio = 72.0 / @deck.dpi
@ -210,7 +210,7 @@ module Squib
end
# Templated sheet renderer in PDF format.
class SaveTemplatedSheetPNG < SaveTemplatedSheet
class SaveSpruePNG < SaveSprue
def init_cc
surface = Cairo::ImageSurface.new @tmpl.sheet_width, @tmpl.sheet_height
Cairo::Context.new(surface)

42
lib/squib/sprues/builtin/a4_euro_card.yml

@ -1,42 +0,0 @@
---
sheet_width: 210mm
sheet_height: 297mm
card_width: 59.0mm
card_height: 92.0mm
cards:
- x: 16.5mm
y: 10.0mm
- x: 75.5mm
y: 10.0mm
- x: 134.5mm
y: 10.0mm
- x: 16.5mm
y: 102.0mm
- x: 75.5mm
y: 102.0mm
- x: 134.5mm
y: 102.0mm
- x: 16.5mm
y: 194.0mm
- x: 75.5mm
y: 194.0mm
- x: 134.5mm
y: 194.0mm
crop_line:
lines:
- type: :vertical
position: 16.5mm
- type: :vertical
position: 75.5mm
- type: :vertical
position: 134.5mm
- type: :vertical
position: 193.5mm
- type: :horizontal
position: 10.0mm
- type: :horizontal
position: 102.0mm
- type: :horizontal
position: 194.0mm
- type: :horizontal
position: 286.0mm

40
lib/squib/sprues/builtin/a4_poker_card_8up.yml

@ -1,40 +0,0 @@
---
sheet_width: 297mm
sheet_height: 210mm
card_width: 63.0mm
card_height: 88.0mm
cards:
- x: 22.5mm
y: 10.0mm
- x: 85.5mm
y: 10.0mm
- x: 148.5mm
y: 10.0mm
- x: 211.5mm
y: 10.0mm
- x: 22.5mm
y: 98.0mm
- x: 85.5mm
y: 98.0mm
- x: 148.5mm
y: 98.0mm
- x: 211.5mm
y: 98.0mm
crop_line:
lines:
- type: :vertical
position: 22.5mm
- type: :vertical
position: 85.5mm
- type: :vertical
position: 148.5mm
- type: :vertical
position: 211.5mm
- type: :vertical
position: 274.5mm
- type: :horizontal
position: 10.0mm
- type: :horizontal
position: 98.0mm
- type: :horizontal
position: 186.0mm

42
lib/squib/sprues/builtin/a4_poker_card_9up.yml

@ -1,42 +0,0 @@
---
sheet_width: 210mm
sheet_height: 297mm
card_width: 63.0mm
card_height: 88.0mm
cards:
- x: 10.5mm
y: 10.0mm
- x: 73.5mm
y: 10.0mm
- x: 136.5mm
y: 10.0mm
- x: 10.5mm
y: 98.0mm
- x: 73.5mm
y: 98.0mm
- x: 136.5mm
y: 98.0mm
- x: 10.5mm
y: 186.0mm
- x: 73.5mm
y: 186.0mm
- x: 136.5mm
y: 186.0mm
crop_line:
lines:
- type: :vertical
position: 10.5mm
- type: :vertical
position: 73.5mm
- type: :vertical
position: 136.5mm
- type: :vertical
position: 199.5mm
- type: :horizontal
position: 10.0mm
- type: :horizontal
position: 98.0mm
- type: :horizontal
position: 186.0mm
- type: :horizontal
position: 274.0mm

42
lib/squib/sprues/builtin/a4_usa_card.yml

@ -1,42 +0,0 @@
---
sheet_width: 210mm
sheet_height: 297mm
card_width: 56.0mm
card_height: 87.0mm
cards:
- x: 21.0mm
y: 10.0mm
- x: 77.0mm
y: 10.0mm
- x: 133.0mm
y: 10.0mm
- x: 21.0mm
y: 97.0mm
- x: 77.0mm
y: 97.0mm
- x: 133.0mm
y: 97.0mm
- x: 21.0mm
y: 184.0mm
- x: 77.0mm
y: 184.0mm
- x: 133.0mm
y: 184.0mm
crop_line:
lines:
- type: :vertical
position: 21.0mm
- type: :vertical
position: 77.0mm
- type: :vertical
position: 133.0mm
- type: :vertical
position: 189.0mm
- type: :horizontal
position: 10.0mm
- type: :horizontal
position: 97.0mm
- type: :horizontal
position: 184.0mm
- type: :horizontal
position: 271.0mm

28
lib/squib/sprues/crop_line.rb

@ -0,0 +1,28 @@
module Squib
module Sprues
class CropLine
attr_reader :x1, :y1, :x2, :y2
def initialize(type, position, sheet_width, sheet_height, dpi)
method = "parse_#{type}"
send method, position, sheet_width, sheet_height, dpi
end
def parse_horizontal(position, sheet_width, _, dpi)
position = Args::UnitConversion.parse(position, dpi)
@x1 = 0
@y1 = position
@x2 = sheet_width
@y2 = position
end
def parse_vertical(position, _, sheet_height, dpi)
position = Args::UnitConversion.parse(position, dpi)
@x1 = position
@y1 = 0
@x2 = position
@y2 = sheet_height
end
end
end
end

35
lib/squib/sprues/crop_line_dash.rb

@ -0,0 +1,35 @@
module Squib
module Sprues
class CropLineDash
VALIDATION_REGEX = /%r{
^(\d*[.])?\d+(in|cm|mm)
\s+
(\d*[.])?\d+(in|cm|mm)$
}x/
attr_reader :pattern
def initialize(value, dpi)
if value == :solid
@pattern = nil
elsif value == :dotted
@pattern = [
Args::UnitConversion.parse('0.2mm', dpi),
Args::UnitConversion.parse('0.5mm', dpi)
]
elsif value == :dashed
@pattern = [
Args::UnitConversion.parse('2mm', dpi),
Args::UnitConversion.parse('2mm', dpi)
]
elsif value.is_a? String
@pattern = value.split(' ').map do |val|
Args::UnitConversion.parse val, dpi
end
else
raise ArgumentError, 'Unsupported dash style'
end
end
end
end
end

78
lib/squib/template.rb → lib/squib/sprues/sprue.rb

@ -1,44 +1,12 @@
require 'yaml'
require 'classy_hash'
require_relative 'args/color_validator'
require_relative 'args/unit_conversion'
require_relative '../args/color_validator'
require_relative '../args/unit_conversion'
require_relative 'crop_line'
require_relative 'crop_line_dash'
module Squib
# Crop line dash definition
class CropLineDash
VALIDATION_REGEX = /%r{
^(\d*[.])?\d+(in|cm|mm)
\s+
(\d*[.])?\d+(in|cm|mm)$
}x/
attr_reader :pattern
def initialize(value, dpi)
if value == :solid
@pattern = nil
elsif value == :dotted
@pattern = [
Args::UnitConversion.parse('0.2mm', dpi),
Args::UnitConversion.parse('0.5mm', dpi)
]
elsif value == :dashed
@pattern = [
Args::UnitConversion.parse('2mm', dpi),
Args::UnitConversion.parse('2mm', dpi)
]
elsif value.is_a? String
@pattern = value.split(' ').map do |val|
Args::UnitConversion.parse val, dpi
end
else
raise ArgumentError, 'Unsupported dash style'
end
end
end
# Template file
class Template
class Sprue
include Args::ColorValidator
# Defaults are set for poker sized deck on a A4 sheet, with no cards
@ -85,7 +53,7 @@ module Squib
# Create a new template file
warn_unrecognized(yaml)
Template.new new_hash, dpi
Sprue.new new_hash, dpi
end
def sheet_width
@ -181,7 +149,7 @@ module Squib
'crop_line' => {
'style' => [
ClassyHash::G.enum(:solid, :dotted, :dashed),
CropLineDash::VALIDATION_REGEX
Sprues::CropLineDash::VALIDATION_REGEX
],
'width' => UNIT_REGEX,
'color' => [String, Symbol],
@ -214,7 +182,7 @@ module Squib
# Return path for built-in sheet templates
def self.builtin(file)
"#{File.dirname(__FILE__)}/sheet_templates/#{file}"
"#{File.dirname(__FILE__)}/../builtin/sprues/#{file}"
end
# Parse crop line definitions from template.
@ -223,8 +191,8 @@ module Squib
new_line['width'] = Args::UnitConversion.parse(new_line['width'], @dpi)
new_line['color'] = colorify new_line['color']
new_line['style_desc'] = new_line['style']
new_line['style'] = CropLineDash.new(new_line['style'], @dpi)
new_line['line'] = CropLine.new(
new_line['style'] = Sprues::CropLineDash.new(new_line['style'], @dpi)
new_line['line'] = Sprues::CropLine.new(
new_line['type'], new_line['position'], sheet_width, sheet_height, @dpi
)
new_line
@ -271,30 +239,4 @@ module Squib
end
end
end
# Crop line definition
class CropLine
attr_reader :x1, :y1, :x2, :y2
def initialize(type, position, sheet_width, sheet_height, dpi)
method = "parse_#{type}"
send method, position, sheet_width, sheet_height, dpi
end
def parse_horizontal(position, sheet_width, _, dpi)
position = Args::UnitConversion.parse(position, dpi)
@x1 = 0
@y1 = position
@x2 = sheet_width
@y2 = position
end
def parse_vertical(position, _, sheet_height, dpi)
position = Args::UnitConversion.parse(position, dpi)
@x1 = position
@y1 = 0
@x2 = position
@y2 = sheet_height
end
end
end

3
samples/templates/fold_sheet.rb → samples/sprues/_fold_sheet.rb

@ -6,5 +6,6 @@ Squib::Deck.new(width: '63mm', height: '88mm', cards: 8) do
str: %w[Front_1 Front_2 Front_3 Front_4 Back_1 Back_2 Back_3 Back_4],
x: '3mm', y: '3mm'
)
save_pdf file: 'fold_sheet.pdf', template_file: 'templates/fold_sheet.yml'
save_pdf file: 'fold_sheet.pdf',
sprue: 'my_sprues/fold_sheet.yml'
end

3
samples/templates/hex_tiles.rb → samples/sprues/_hex_tiles.rb

@ -10,5 +10,6 @@ Squib::Deck.new(width: '65.8mm', height: '76mm', cards: 9) do
x: '27mm', y: '35mm', width: '11.8mm', height: '6mm',
align: :center, valign: :middle
)
save_pdf file: 'hex_tiles.pdf', template_file: 'templates/hex_tiles.yml'
save_pdf file: 'hex_tiles.pdf',
sprue: 'my_sprues/hex_tiles.yml'
end

3
samples/templates/use_package_template.rb → samples/sprues/_use_package_template.rb

@ -4,5 +4,6 @@ Squib::Deck.new(width: '63mm', height: '88mm', cards: 9) do
text(
str: %w[One Two Three Four Five Six Seven Eight Nine], x: '3mm', y: '3mm'
)
save_pdf file: 'use_package_tmpl.pdf', template_file: 'a4_poker_card_9up.yml'
save_pdf file: 'use_package_tmpl.pdf',
sprue: 'a4_poker_card_9up.yml'
end

0
samples/templates/templates/fold_sheet.yml → samples/sprues/my_sprues/fold_sheet.yml

0
samples/templates/templates/hex_tiles.yml → samples/sprues/my_sprues/hex_tiles.yml

3
spec/commands/new_spec.rb

@ -6,6 +6,8 @@ describe Squib::Commands::New do
describe '#process' do
before(:all) do
@old_stderr = $stderr
@old_stdout = $stdout
$stdout = StringIO.new
$stderr = StringIO.new
@oldpwd = Dir.pwd
Dir.chdir(output_dir)
@ -41,6 +43,7 @@ describe Squib::Commands::New do
after(:all) do
$stderr = @old_stderr
$stdout = @old_stdout
Dir.chdir(@oldpwd)
end
end

0
spec/data/templates/basic.yml → spec/data/sprues/basic.yml

0
spec/data/templates/card_center_coord.yml → spec/data/sprues/card_center_coord.yml

0
spec/data/templates/card_rotation.yml → spec/data/sprues/card_rotation.yml

0
spec/data/templates/custom_crop_lines.yml → spec/data/sprues/custom_crop_lines.yml

0
spec/data/templates/fail_no_card_height.yml → spec/data/sprues/fail_no_card_height.yml

0
spec/data/templates/fail_no_card_width.yml → spec/data/sprues/fail_no_card_width.yml

0
spec/data/templates/fail_no_sheet_height.yml → spec/data/sprues/fail_no_sheet_height.yml

0
spec/data/templates/fail_no_sheet_width.yml → spec/data/sprues/fail_no_sheet_width.yml

2
spec/samples/samples_regression_spec.rb

@ -62,7 +62,7 @@ describe 'Squib samples' do
Dir.chdir(File.dirname("#{samples_dir}/#{sample}")) do
load full_sample_path
end
# overwrite_sample(sample, log) # Use TEMPORARILY once happy with the new sample log
overwrite_sample(sample, log) # Use TEMPORARILY once happy with the new sample log
test_file_str = File.open(sample_regression_file(sample), 'r:UTF-8').read
expect(log.string).to eq(test_file_str)
end

6
spec/spec_helper.rb

@ -50,8 +50,8 @@ def yaml_file(file)
"#{File.expand_path(File.dirname(__FILE__))}/data/yaml/#{file}"
end
def template_file(file)
"#{File.expand_path(File.dirname(__FILE__))}/data/templates/#{file}"
def sprue_file(file)
"#{File.expand_path(File.dirname(__FILE__))}/data/sprues/#{file}"
end
def project_template(file)
@ -127,7 +127,7 @@ def mock_cairo(strio)
triangle line_to operator= show_page clip transform mask rectangle
reset_clip antialias= curve_to matrix= pango_layout_path stroke_preserve
fill_preserve close_path set_dash set_line_cap set_line_join
arc arc_negative).each do |m|
arc arc_negative new_path new_sub_path).each do |m|
allow(cxt).to receive(m) { |*args| strio << scrub_hex("cairo: #{m}(#{args})\n") }
end

25
spec/template_spec.rb → spec/sprue_spec.rb

@ -1,22 +1,23 @@
require 'spec_helper'
require 'squib/sprues/sprue'
describe Squib::Template do
it 'loads a template' do
tmpl = Squib::Template.load(template_file('basic.yml'), 100)
describe Squib::Sprue do
it 'loads a sprue' do
tmpl = Squib::Sprue.load(sprue_file('basic.yml'), 100)
expect(tmpl.sheet_width).to eq(850)
expect(tmpl.sheet_height).to eq(1100)
expect(tmpl.card_width).to eq(250)
expect(tmpl.card_height).to eq(350)
expect(tmpl.dpi).to eq(100)
expect(tmpl.crop_line_overlay).to eq(
Squib::Template::DEFAULTS['crop_line']['overlay']
Squib::Sprue::DEFAULTS['crop_line']['overlay']
)
expect(tmpl.crop_lines).to eq([])
expect(tmpl.cards).to eq([{ 'x' => 50, 'y' => 100, 'rotate' => 0 }])
end
it 'loads from the default templates if none exists' do
tmpl = Squib::Template.load('a4_poker_card_9up.yml', 100)
tmpl = Squib::Sprue.load('a4_poker_card_9up.yml', 100)
expect(tmpl.sheet_width).to eq(826.7716527)
expect(tmpl.sheet_height).to eq(1169.2913373899999)
expect(tmpl.card_width).to eq(248.03149580999997)
@ -77,7 +78,7 @@ describe Squib::Template do
end
it 'loads a template with the coordinates specifying the middle of cards' do
tmpl = Squib::Template.load(template_file('card_center_coord.yml'), 100)
tmpl = Squib::Sprue.load(sprue_file('card_center_coord.yml'), 100)
expect(tmpl.sheet_width).to eq(850)
expect(tmpl.sheet_height).to eq(1100)
expect(tmpl.card_width).to eq(200)
@ -94,7 +95,7 @@ describe Squib::Template do
end
it 'loads a template with customized crop lines' do
tmpl = Squib::Template.load(template_file('custom_crop_lines.yml'), 100)
tmpl = Squib::Sprue.load(sprue_file('custom_crop_lines.yml'), 100)
expect(tmpl.sheet_width).to eq(850)
expect(tmpl.sheet_height).to eq(1100)
expect(tmpl.card_width).to eq(200)
@ -130,7 +131,7 @@ describe Squib::Template do
end
it 'loads a template with rotated cards' do
tmpl = Squib::Template.load(template_file('card_rotation.yml'), 100)
tmpl = Squib::Sprue.load(sprue_file('card_rotation.yml'), 100)
expect(tmpl.sheet_width).to eq(850)
expect(tmpl.sheet_height).to eq(1100)
expect(tmpl.card_width).to eq(250)
@ -145,7 +146,7 @@ describe Squib::Template do
it 'fails when sheet_width is not defined' do
expect do
Squib::Template.load(template_file('fail_no_sheet_width.yml'), 100)
Squib::Sprue.load(sprue_file('fail_no_sheet_width.yml'), 100)
end.to raise_error(
RuntimeError,
'"sheet_width" is not a String matching /^(\d*[.])?\d+(in|cm|mm)$/'
@ -154,7 +155,7 @@ describe Squib::Template do
it 'fails when sheet_height is not defined' do
expect do
Squib::Template.load(template_file('fail_no_sheet_height.yml'), 100)
Squib::Sprue.load(sprue_file('fail_no_sheet_height.yml'), 100)
end.to raise_error(
RuntimeError,
'"sheet_height" is not a String matching /^(\d*[.])?\d+(in|cm|mm)$/'
@ -163,7 +164,7 @@ describe Squib::Template do
it 'fails when card_width is not defined' do
expect do
Squib::Template.load(template_file('fail_no_card_width.yml'), 100)
Squib::Sprue.load(sprue_file('fail_no_card_width.yml'), 100)
end.to raise_error(
RuntimeError,
'"card_width" is not a String matching /^(\d*[.])?\d+(in|cm|mm)$/'
@ -172,7 +173,7 @@ describe Squib::Template do
it 'fails when card_height is not defined' do
expect do
Squib::Template.load(template_file('fail_no_card_height.yml'), 100)
Squib::Sprue.load(sprue_file('fail_no_card_height.yml'), 100)
end.to raise_error(
RuntimeError,
'"card_height" is not a String matching /^(\d*[.])?\d+(in|cm|mm)$/'
Loading…
Cancel
Save