docs: readthedocs.org --> .io
parent
b8908b0d60
commit
a8241418c6
|
|
@ -4,12 +4,12 @@ Squib follows [semantic versioning](http://semver.org).
|
||||||
## v0.10.0 / 2016-05-06
|
## v0.10.0 / 2016-05-06
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
* 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.org/en/latest/build_groups.html).
|
* 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).
|
||||||
* 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)
|
* 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)
|
||||||
* The `csv` method now supports a `data` option to read CSV data directly. When set, it overrides the `file` option.
|
* The `csv` method now supports a `data` option to read CSV data directly. When set, it overrides the `file` option.
|
||||||
* 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).
|
* 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).
|
||||||
* 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).
|
* 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).
|
||||||
* Rewrote the entire API doc and placed it on [squib.readthedocs.org](http://squib.readthedocs.org). :tada:
|
* Rewrote the entire API doc and placed it on [squib.readthedocs.io](http://squib.readthedocs.io). :tada:
|
||||||
|
|
||||||
Bugs:
|
Bugs:
|
||||||
* The `save_pdf` method will flush to file upon exit so that the PDF is available immediately. (#150, thanks for the bug report Qgel!)
|
* The `save_pdf` method will flush to file upon exit so that the PDF is available immediately. (#150, thanks for the bug report Qgel!)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ require_relative '../args/draw'
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def background(opts = {})
|
def background(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ require_relative '../args/csv_opts'
|
||||||
|
|
||||||
module Squib
|
module Squib
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def xlsx(opts = {})
|
def xlsx(opts = {})
|
||||||
input = Args::InputFile.new(file: 'deck.xlsx').load!(opts)
|
input = Args::InputFile.new(file: 'deck.xlsx').load!(opts)
|
||||||
import = Args::Import.new.load!(opts)
|
import = Args::Import.new.load!(opts)
|
||||||
|
|
@ -30,7 +30,7 @@ module Squib
|
||||||
end# xlsx
|
end# xlsx
|
||||||
module_function :xlsx
|
module_function :xlsx
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def csv(opts = {})
|
def csv(opts = {})
|
||||||
# TODO refactor all this out to separate methods, and its own class
|
# TODO refactor all this out to separate methods, and its own class
|
||||||
import = Args::Import.new.load!(opts)
|
import = Args::Import.new.load!(opts)
|
||||||
|
|
@ -93,12 +93,12 @@ module Squib
|
||||||
|
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def xlsx(opts = {})
|
def xlsx(opts = {})
|
||||||
Squib.xlsx(opts)
|
Squib.xlsx(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def csv(opts = {})
|
def csv(opts = {})
|
||||||
Squib.csv(opts)
|
Squib.csv(opts)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,25 +12,25 @@ module Squib
|
||||||
|
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def build grp = :all, &block
|
def build grp = :all, &block
|
||||||
raise 'Please provide a block' unless block_given?
|
raise 'Please provide a block' unless block_given?
|
||||||
block.yield if build_groups.include? grp
|
block.yield if build_groups.include? grp
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def enable_build grp
|
def enable_build grp
|
||||||
build_groups # make sure it's initialized
|
build_groups # make sure it's initialized
|
||||||
@build_groups << grp
|
@build_groups << grp
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def disable_build grp
|
def disable_build grp
|
||||||
build_groups # make sure it's initialized
|
build_groups # make sure it's initialized
|
||||||
@build_groups.delete grp
|
@build_groups.delete grp
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def build_groups
|
def build_groups
|
||||||
@build_groups ||= Set.new.add(:all)
|
@build_groups ||= Set.new.add(:all)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ require_relative '../args/svg_special'
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def png(opts = {})
|
def png(opts = {})
|
||||||
Dir.chdir(img_dir) do
|
Dir.chdir(img_dir) do
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
|
|
@ -25,7 +25,7 @@ module Squib
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def svg(opts = {})
|
def svg(opts = {})
|
||||||
Dir.chdir(img_dir) do
|
Dir.chdir(img_dir) do
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,21 @@ require_relative '../args/showcase_special'
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def save(opts = {})
|
def save(opts = {})
|
||||||
save_png(opts) if Array(opts[:format]).include? :png
|
save_png(opts) if Array(opts[:format]).include? :png
|
||||||
save_pdf(opts) if Array(opts[:format]).include? :pdf
|
save_pdf(opts) if Array(opts[:format]).include? :pdf
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def save_pdf(opts = {})
|
def save_pdf(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
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)
|
sheet = Args::Sheet.new(custom_colors, { file: 'output.pdf' }).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
render_pdf(range, sheet)
|
render_pdf(range, sheet)
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def save_png(opts = {})
|
def save_png(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -33,7 +33,7 @@ module Squib
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def save_sheet(opts = {})
|
def save_sheet(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -41,7 +41,7 @@ module Squib
|
||||||
render_sheet(range, batch, sheet)
|
render_sheet(range, batch, sheet)
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def showcase(opts = {})
|
def showcase(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
showcase = Args::ShowcaseSpecial.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
showcase = Args::ShowcaseSpecial.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -49,7 +49,7 @@ module Squib
|
||||||
render_showcase(range, sheet, showcase)
|
render_showcase(range, sheet, showcase)
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def hand(opts = {})
|
def hand(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
hand = Args::HandSpecial.new(height).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
hand = Args::HandSpecial.new(height).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def hint(text: :off)
|
def hint(text: :off)
|
||||||
conf.text_hint = text
|
conf.text_hint = text
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def set(opts = {})
|
def set(opts = {})
|
||||||
raise 'DEPRECATED: As of v0.7 img_dir is no longer supported in "set". Use config.yml instead.' if opts.key? :img_dir
|
raise 'DEPRECATED: As of v0.7 img_dir is no longer supported in "set". Use config.yml instead.' if opts.key? :img_dir
|
||||||
@font = (opts[:font] == :default) ? Squib::DEFAULT_FONT : opts[:font]
|
@font = (opts[:font] == :default) ? Squib::DEFAULT_FONT : opts[:font]
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def use_layout(file: 'layout.yml')
|
def use_layout(file: 'layout.yml')
|
||||||
@layout = LayoutParser.load_layout(file, @layout)
|
@layout = LayoutParser.load_layout(file, @layout)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require_relative '../args/coords'
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def rect(opts = {})
|
def rect(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
box = Args::Box.new(self).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
box = Args::Box.new(self).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -15,7 +15,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].rect(box[i], draw[i]) }
|
range.each { |i| @cards[i].rect(box[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def circle(opts = {})
|
def circle(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
coords = Args::Coords.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
coords = Args::Coords.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -23,7 +23,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].circle(coords[i], draw[i]) }
|
range.each { |i| @cards[i].circle(coords[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def ellipse(opts = {})
|
def ellipse(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -31,7 +31,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].ellipse(box[i], draw[i]) }
|
range.each { |i| @cards[i].ellipse(box[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def grid(opts = {})
|
def grid(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -39,7 +39,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].grid(box[i], draw[i]) }
|
range.each { |i| @cards[i].grid(box[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def triangle(opts = {})
|
def triangle(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -47,7 +47,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].triangle(coords[i], draw[i]) }
|
range.each { |i| @cards[i].triangle(coords[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def line(opts = {})
|
def line(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -55,7 +55,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].line(coords[i], draw[i]) }
|
range.each { |i| @cards[i].line(coords[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def curve(opts = {})
|
def curve(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -63,7 +63,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].curve(coords[i], draw[i]) }
|
range.each { |i| @cards[i].curve(coords[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def star(opts = {})
|
def star(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
@ -72,7 +72,7 @@ module Squib
|
||||||
range.each { |i| @cards[i].star(coords[i], trans[i], draw[i]) }
|
range.each { |i| @cards[i].star(coords[i], trans[i], draw[i]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def polygon(opts = {})
|
def polygon(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require_relative '../args/paragraph'
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def text(opts = {})
|
def text(opts = {})
|
||||||
range = Args::CardRange.new(opts[:range], deck_size: size)
|
range = Args::CardRange.new(opts[:range], deck_size: size)
|
||||||
para = Args::Paragraph.new(font).load!(opts, expand_by: size, layout: layout)
|
para = Args::Paragraph.new(font).load!(opts, expand_by: size, layout: layout)
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ require_relative '../constants'
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def inches(n)
|
def inches(n)
|
||||||
@dpi * n.to_f
|
@dpi * n.to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
# DSL method. See http://squib.readthedocs.org
|
# DSL method. See http://squib.readthedocs.io
|
||||||
def cm(n)
|
def cm(n)
|
||||||
@dpi * Squib::INCHES_IN_CM * n.to_f
|
@dpi * Squib::INCHES_IN_CM * n.to_f
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue