Browse Source

docs: readthedocs.org --> .io

dev
Andy Meneely 10 years ago
parent
commit
a8241418c6
  1. 4
      CHANGELOG.md
  2. 2
      lib/squib/api/background.rb
  3. 8
      lib/squib/api/data.rb
  4. 8
      lib/squib/api/groups.rb
  5. 4
      lib/squib/api/image.rb
  6. 12
      lib/squib/api/save.rb
  7. 6
      lib/squib/api/settings.rb
  8. 18
      lib/squib/api/shapes.rb
  9. 2
      lib/squib/api/text.rb
  10. 4
      lib/squib/api/units.rb

4
CHANGELOG.md

@ -4,12 +4,12 @@ Squib follows [semantic versioning](http://semver.org).
## v0.10.0 / 2016-05-06
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)
* 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 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:
* The `save_pdf` method will flush to file upon exit so that the PDF is available immediately. (#150, thanks for the bug report Qgel!)

2
lib/squib/api/background.rb

@ -4,7 +4,7 @@ require_relative '../args/draw'
module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def background(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)

8
lib/squib/api/data.rb

@ -6,7 +6,7 @@ require_relative '../args/csv_opts'
module Squib
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def xlsx(opts = {})
input = Args::InputFile.new(file: 'deck.xlsx').load!(opts)
import = Args::Import.new.load!(opts)
@ -30,7 +30,7 @@ module Squib
end# xlsx
module_function :xlsx
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def csv(opts = {})
# TODO refactor all this out to separate methods, and its own class
import = Args::Import.new.load!(opts)
@ -93,12 +93,12 @@ module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def xlsx(opts = {})
Squib.xlsx(opts)
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def csv(opts = {})
Squib.csv(opts)
end

8
lib/squib/api/groups.rb

@ -12,25 +12,25 @@ module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def build grp = :all, &block
raise 'Please provide a block' unless block_given?
block.yield if build_groups.include? grp
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def enable_build grp
build_groups # make sure it's initialized
@build_groups << grp
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def disable_build grp
build_groups # make sure it's initialized
@build_groups.delete grp
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def build_groups
@build_groups ||= Set.new.add(:all)
end

4
lib/squib/api/image.rb

@ -8,7 +8,7 @@ require_relative '../args/svg_special'
module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def png(opts = {})
Dir.chdir(img_dir) do
range = Args::CardRange.new(opts[:range], deck_size: size)
@ -25,7 +25,7 @@ module Squib
end
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def svg(opts = {})
Dir.chdir(img_dir) do
range = Args::CardRange.new(opts[:range], deck_size: size)

12
lib/squib/api/save.rb

@ -7,21 +7,21 @@ require_relative '../args/showcase_special'
module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def save(opts = {})
save_png(opts) if Array(opts[:format]).include? :png
save_pdf(opts) if Array(opts[:format]).include? :pdf
self
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
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)
render_pdf(range, sheet)
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def save_png(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
@ -33,7 +33,7 @@ module Squib
end
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def save_sheet(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
@ -41,7 +41,7 @@ module Squib
render_sheet(range, batch, sheet)
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def showcase(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
showcase = Args::ShowcaseSpecial.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
@ -49,7 +49,7 @@ module Squib
render_showcase(range, sheet, showcase)
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def hand(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
hand = Args::HandSpecial.new(height).load!(opts, expand_by: size, layout: layout, dpi: dpi)

6
lib/squib/api/settings.rb

@ -1,18 +1,18 @@
module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def hint(text: :off)
conf.text_hint = text
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
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
@font = (opts[:font] == :default) ? Squib::DEFAULT_FONT : opts[:font]
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def use_layout(file: 'layout.yml')
@layout = LayoutParser.load_layout(file, @layout)
end

18
lib/squib/api/shapes.rb

@ -7,7 +7,7 @@ require_relative '../args/coords'
module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def rect(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def circle(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def ellipse(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def grid(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def triangle(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def line(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def curve(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def star(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
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]) }
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def polygon(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
draw = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)

2
lib/squib/api/text.rb

@ -7,7 +7,7 @@ require_relative '../args/paragraph'
module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def text(opts = {})
range = Args::CardRange.new(opts[:range], deck_size: size)
para = Args::Paragraph.new(font).load!(opts, expand_by: size, layout: layout)

4
lib/squib/api/units.rb

@ -3,12 +3,12 @@ require_relative '../constants'
module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def inches(n)
@dpi * n.to_f
end
# DSL method. See http://squib.readthedocs.org
# DSL method. See http://squib.readthedocs.io
def cm(n)
@dpi * Squib::INCHES_IN_CM * n.to_f
end

Loading…
Cancel
Save