From bd5e6c92f6aa6d548c91b4cf31d9e620cc2154c9 Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Mon, 11 Apr 2016 21:33:15 -0400 Subject: [PATCH] samples: gistify saves --- .gitmodules | 2 +- samples/hand.rb | 23 ---------- samples/saves | 2 +- samples/saves.rb | 45 ------------------- samples/showcase.rb | 25 ----------- .../{hand.rb.txt => saves/_hand.rb.txt} | 0 .../_save_pdf.rb.txt} | 0 .../{saves.rb.txt => saves/_saves.rb.txt} | 0 .../_showcase.rb.txt} | 0 spec/samples/samples_regression_spec.rb | 9 ++-- 10 files changed, 7 insertions(+), 99 deletions(-) delete mode 100644 samples/hand.rb delete mode 100644 samples/saves.rb delete mode 100644 samples/showcase.rb rename spec/data/samples/{hand.rb.txt => saves/_hand.rb.txt} (100%) rename spec/data/samples/{save_pdf.rb.txt => saves/_save_pdf.rb.txt} (100%) rename spec/data/samples/{saves.rb.txt => saves/_saves.rb.txt} (100%) rename spec/data/samples/{showcase.rb.txt => saves/_showcase.rb.txt} (100%) diff --git a/.gitmodules b/.gitmodules index 940ed53..9f255ca 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,5 +25,5 @@ url = https://gist.github.com/59089c972b8b0e5d7e76598010e69291.git [submodule "samples/saves"] - path = samples/save + path = samples/saves url = https://gist.github.com/3c60c13b25f525abd037db4055abf35c.git diff --git a/samples/hand.rb b/samples/hand.rb deleted file mode 100644 index 95d830b..0000000 --- a/samples/hand.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'squib' - -Squib::Deck.new(cards: 8, layout: 'playing-card.yml') do - background color: :cyan - rect x: 37, y: 37, width: 750, height: 1050, fill_color: :black, radius: 25 - rect x: 75, y: 75, width: 675, height: 975, fill_color: :white, radius: 20 - text str: ('A'..'Z').to_a, layout: :bonus_ul, font: 'Sans bold 100' - - # Defaults are sensible - hand # saves to _output/hand.png - - # Here's a prettier version: - # - Each card is trimmed with rounded corners - # - Zero radius means cards rotate about the bottom of the card - # - Cards are shown in reverse order - hand trim: 37.5, trim_radius: 25, - radius: 0, - range: 7.downto(0), - file: 'hand_pretty.png' - - # Tip: you can have the top card be on the left by reversing the range - # angle_range: (Math::PI / 4)..(Math::PI / -4) -end diff --git a/samples/saves b/samples/saves index fae188e..b657866 160000 --- a/samples/saves +++ b/samples/saves @@ -1 +1 @@ -Subproject commit fae188e6b132a6282a205281dcb029165f777558 +Subproject commit b657866fccb82865697118c7ac6379928cbd6c8f diff --git a/samples/saves.rb b/samples/saves.rb deleted file mode 100644 index ac98a86..0000000 --- a/samples/saves.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'squib' - -# This sample demonstrates how to use the various save methods - -Squib::Deck.new(width: 825, height: 1125, cards: 16) do - background color: :gray - rect x: 38, y: 38, width: 750, height: 1050, - x_radius: 38, y_radius: 38, stroke: 3.0, dash: '4 4' - - text str: (1..16).to_a, x: 220, y: 78, font: 'Arial 54' - - # Here's what a regular save_png looks like for just the first card - save_png range: 0, prefix: 'save_png_' - - # save_png supports trim and trim_radius - save_png trim: 30, trim_radius: 38, - range: 0, prefix: 'save_png_trimmed_' - - # Place on multiple pages over the PDF, with bleed beeing trimmed off - save_pdf file: 'save-pdf.pdf', margin: 75, gap: 5, trim: 37 - - # PDFs also support arbitrary paper sizes, in pixels or any other supported units - save_pdf file: 'save-pdf-small.pdf', - width: '7in', height: '5in', - range: 0..1 - - # Note that our PNGs still are not trimmed even though the pdf ones were - save_png range: 1, prefix: 'saves_notrim_' - - # We can also save our PNGs into a single sheet, - # rows are calculated based on cols and number of cards - save_sheet prefix: 'save_single_sheet_', - columns: 2, margin: 75, gap: 5, trim: 37 - - # Or multiple sheets if rows are also specified - save_sheet prefix: 'save_sheet_', - columns: 4, rows: 2, - margin: 75, gap: 5, trim: 37 - - # Sheets support ranges too - save_sheet prefix: 'save_sheet_range_', - range: 0..5, - columns: 2, rows: 2, - margin: 75, gap: 5, trim: 37 -end diff --git a/samples/showcase.rb b/samples/showcase.rb deleted file mode 100644 index 0f4cfcf..0000000 --- a/samples/showcase.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'squib' - -# Showcases are a neat way to show off your cards in a modern way, using a -# reflection and a persepctive effect to make them look 3D -Squib::Deck.new(cards: 4) do - background color: '#CE534D' - rect fill_color: '#DED4B9', x: 78, y: 78, - width: '2.25in', height: '3.25in', radius: 32 - text str: %w(Grifter Thief Thug Kingpin), - font: 'Helvetica,Sans weight=800 120', - x: 78, y: 78, width: '2.25in', align: :center - svg file: 'spanner.svg', x: (825 - 500) / 2, y: 500, width: 500, height: 500 - - # Defaults are pretty sensible. - showcase file: 'showcase.png' - - # Here's a more complete example. - # Tons of ways to tweak it if you like - check the docs. - showcase trim: 32, trim_radius: 32, margin: 100, face: :right, - scale: 0.85, offset: 0.95, fill_color: :black, - reflect_offset: 25, reflect_strength: 0.1, reflect_percent: 0.4, - file: 'showcase2.png' - - save_png prefix: 'showcase_individual_' # to show that they're not trimmed -end diff --git a/spec/data/samples/hand.rb.txt b/spec/data/samples/saves/_hand.rb.txt similarity index 100% rename from spec/data/samples/hand.rb.txt rename to spec/data/samples/saves/_hand.rb.txt diff --git a/spec/data/samples/save_pdf.rb.txt b/spec/data/samples/saves/_save_pdf.rb.txt similarity index 100% rename from spec/data/samples/save_pdf.rb.txt rename to spec/data/samples/saves/_save_pdf.rb.txt diff --git a/spec/data/samples/saves.rb.txt b/spec/data/samples/saves/_saves.rb.txt similarity index 100% rename from spec/data/samples/saves.rb.txt rename to spec/data/samples/saves/_saves.rb.txt diff --git a/spec/data/samples/showcase.rb.txt b/spec/data/samples/saves/_showcase.rb.txt similarity index 100% rename from spec/data/samples/showcase.rb.txt rename to spec/data/samples/saves/_showcase.rb.txt diff --git a/spec/samples/samples_regression_spec.rb b/spec/samples/samples_regression_spec.rb index 5466e6b..7ecffba 100644 --- a/spec/samples/samples_regression_spec.rb +++ b/spec/samples/samples_regression_spec.rb @@ -38,7 +38,8 @@ describe 'Squib samples' do # These are samples that don't really need a regression log # colors.rb # unicode.rb - %w( autoscale_font/_autoscale_font.rb + %w( + autoscale_font/_autoscale_font.rb basic.rb cairo_access.rb csv_import.rb @@ -48,13 +49,13 @@ describe 'Squib samples' do embed_text.rb excel.rb gradients.rb - hand.rb + saves/_hand.rb hello_world.rb images/_more_load_images.rb portrait-landscape.rb ranges.rb - saves.rb - showcase.rb + saves/_saves.rb + saves/_showcase.rb text_options.rb tgc_proofs.rb units.rb