Skip to content
Snippets Groups Projects

Cookathon Card Game Ruby Script

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Kevin Whitaker

    This script is an example of Ruby code written to generate materials for a card game.

    Edited
    recipe-card-v3.rb 26.11 KiB
    require 'squib'
    require 'roo'
    load './colors.rb'
    
    no_data = Squib.xlsx file: 'recipe-cards-v3.xlsx', sheet: 2
    
    def get_icon_for_ingredient (ingredient_name)
        idata = Roo::Spreadsheet.open 'ingredient-cards-v3.xlsx'
        sheet = idata.sheet(0)
        sheet.each(uname: 'Unprepared Food Name', usvg: 'Unprepared SVG') do |row|
            if row[:uname] == ingredient_name then
                return row[:usvg]
            end
        end
        return 'icons/svg/blank.svg'
    end
    
    course_icon = {'A' => 'icons/svg/appetizer.svg', 'E' => 'icons/svg/chicken.svg',  'D' => 'icons/svg/sweets.svg'}
    course_bg = {'A' => 'icons/svg/green-recipe-book-by-flat-icons.svg', 'E' => 'icons/svg/orange-recipe-book-by-flat-icons.svg', 'D' => 'icons/svg/blue-recipe-book-by-flat-icons.svg'}
    
    Squib::Deck.new(layout:'recipe-card-layout.yml', cards: no_data['Recipe Name'].size) do
        no_data['Course'].each_with_index do |course,i|
            #rect layout: 'recipe_background', fill_color: phase_bg[phase], range: i
            svg x:'0in', y: '0.85in', width: '2.8in', height: '2.6in', file: course_bg[course], range: i
            svg layout: 'course', file: course_icon[course], range: i
        end
        svg layout: 'city', file: 'icons/svg/Ingredient backs/Final choices/022-tom-yum.svg'
        text layout: 'recipe_name', font: 'League Spartan, Bold', str: no_data['Recipe Name']
        text layout: 'recipe_prep_title', font: 'League Spartan, medium', font_size: 10, str: 'Recipe Prep Time:'
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Dark, 20', color: 'white', str: no_data['Recipe Prep Time']
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Heavy, 20', str: no_data['Recipe Prep Time']
        #svg layout: 'final_step_icon', file: 'icons/svg/combine.svg'
        svg layout: 'points_icon', file: 'star-by-freepik.svg'
        text layout: 'points_icon_text', font: 'League Spartan, medium 12', align: :center, str: no_data['Meal Points']
        no_data['Ingredient1'].each_with_index do |ing,i|
            svg layout: 'ingredient_1_icon', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['Ingredient2'].each_with_index do |ing,i|
            svg layout: 'ingredient_2_icon', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['Ingredient3'].each_with_index do |ing,i|
            svg layout: 'ingredient_3_icon', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['Ingredient4'].each_with_index do |ing,i|
            svg layout: 'ingredient_4_icon', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['Ingredient5'].each_with_index do |ing,i|
            svg layout: 'ingredient_5_icon', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['Ingredient6'].each_with_index do |ing,i|
            svg layout: 'ingredient_6_icon', file: get_icon_for_ingredient(ing), range: i
        end
        text layout: 'ingredient_1_name', str: no_data['Ingredient1']
        text layout: 'ingredient_2_name', str: no_data['Ingredient2']
        text layout: 'ingredient_3_name', str: no_data['Ingredient3']
        text layout: 'ingredient_4_name', str: no_data['Ingredient4']
        text layout: 'ingredient_5_name', str: no_data['Ingredient5']
        text layout: 'ingredient_6_name', str: no_data['Ingredient6']
        no_data['Recipe Type'].each_with_index do |t,i|
            if t == '1' then
                line layout: 'optional_line', range: i
                text layout: 'optional_title', font: 'League Spartan, medium', str: 'Optional:  +2', range: i
            end
        end
        no_data['o1'].each_with_index do |ing,i|
            svg layout: 'optional_ing_1', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['o2'].each_with_index do |ing,i|
            svg layout: 'optional_ing_2', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['o3'].each_with_index do |ing,i|
            svg layout: 'optional_ing_3', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['o4'].each_with_index do |ing,i|
            svg layout: 'optional_ing_4', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['o5'].each_with_index do |ing,i|
            svg layout: 'optional_ing_5', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['o6'].each_with_index do |ing,i|
            svg layout: 'optional_ing_6', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['o7'].each_with_index do |ing,i|
            svg layout: 'optional_ing_7', file: get_icon_for_ingredient(ing), range: i
        end
        no_data['o8'].each_with_index do |ing,i|
            svg layout: 'optional_ing_8', file: get_icon_for_ingredient(ing), range: i
        end
        #cut_zone
        #safe_zone
        #save_png prefix: 'recpie_'
        build :selfprint do
            save_pdf file: 'no-recipe_cards-v3.pdf'
        end
        build :drivethru do
            save_pdf file: 'no-recipe_cards-v3-drivethru-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :phipps do
            save_pdf file: 'no-recipe_cards-v3-phipps-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :selfsheet do
            save_sheet prefix: 'no-recipe_cards-v3-sheet-fronts', sprue: 'letter_poker_card_9up.yml'
        end
    end
    
    Squib::Deck.new(layout:'recipe-card-back-layout.yml', cards: no_data['Recipe Name'].size) do
            rect layout: 'card_background', fill_color: '#'+Standard_colors[3][:hex]
            text layout: 'logo_text', str: 'Cookathon', color: 'white', font: 'League Spartan, Black 22'
            text layout: 'card_type', str: 'Recipe' , color: 'white', font: 'League Spartan, Bold 20'
            svg layout: 'logo_image', file: 'icons/svg/recipe-book-face2.svg'
            #cut_zone
            build :selfprint do
                save_png prefix: 'no-recipe_back_', range: 0
            end
            build :drivethru do
                save_pdf file: 'no-recipe_cards-v3-drivethru-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
            build :phipps do
                save_pdf file: 'no-recipe_cards-v3-phipps-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
    end
    
    #
    #
    #
    
    mx_data = Squib.xlsx file: 'recipe-cards-v3.xlsx', sheet: 3
    
    Squib::Deck.new(layout:'recipe-card-layout.yml', cards: mx_data['Recipe Name'].size) do
        mx_data['Course'].each_with_index do |course,i|
            #rect layout: 'recipe_background', fill_color: phase_bg[phase], range: i
            svg x:'0in', y: '0.85in', width: '2.8in', height: '2.6in', file: course_bg[course], range: i
            svg layout: 'course', file: course_icon[course], range: i
        end
        svg layout: 'city', file: 'icons/svg/Ingredient backs/Final choices/024-quesadilla.svg'
        text layout: 'recipe_name', font: 'League Spartan, Bold', str: mx_data['Recipe Name']
        text layout: 'recipe_prep_title', font: 'League Spartan, medium', font_size: 10, str: 'Recipe Prep Time:'
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Dark, 20', color: 'white', str: mx_data['Recipe Prep Time']
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Heavy, 20', str: mx_data['Recipe Prep Time']
        #svg layout: 'final_step_icon', file: 'icons/svg/combine.svg'
        svg layout: 'points_icon', file: 'star-by-freepik.svg'
        text layout: 'points_icon_text', font: 'League Spartan, medium 12', align: :center, str: mx_data['Meal Points']
        mx_data['Ingredient1'].each_with_index do |ing,i|
            svg layout: 'ingredient_1_icon', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['Ingredient2'].each_with_index do |ing,i|
            svg layout: 'ingredient_2_icon', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['Ingredient3'].each_with_index do |ing,i|
            svg layout: 'ingredient_3_icon', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['Ingredient4'].each_with_index do |ing,i|
            svg layout: 'ingredient_4_icon', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['Ingredient5'].each_with_index do |ing,i|
            svg layout: 'ingredient_5_icon', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['Ingredient6'].each_with_index do |ing,i|
            svg layout: 'ingredient_6_icon', file: get_icon_for_ingredient(ing), range: i
        end
        text layout: 'ingredient_1_name', str: mx_data['Ingredient1']
        text layout: 'ingredient_2_name', str: mx_data['Ingredient2']
        text layout: 'ingredient_3_name', str: mx_data['Ingredient3']
        text layout: 'ingredient_4_name', str: mx_data['Ingredient4']
        text layout: 'ingredient_5_name', str: mx_data['Ingredient5']
        text layout: 'ingredient_6_name', str: mx_data['Ingredient6']
        mx_data['Recipe Type'].each_with_index do |t,i|
            if t == '1' then
                line layout: 'optional_line', range: i
                text layout: 'optional_title', font: 'League Spartan, medium', str: 'Optional:  +2', range: i
            end
        end
        mx_data['o1'].each_with_index do |ing,i|
            svg layout: 'optional_ing_1', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['o2'].each_with_index do |ing,i|
            svg layout: 'optional_ing_2', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['o3'].each_with_index do |ing,i|
            svg layout: 'optional_ing_3', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['o4'].each_with_index do |ing,i|
            svg layout: 'optional_ing_4', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['o5'].each_with_index do |ing,i|
            svg layout: 'optional_ing_5', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['o6'].each_with_index do |ing,i|
            svg layout: 'optional_ing_6', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['o7'].each_with_index do |ing,i|
            svg layout: 'optional_ing_7', file: get_icon_for_ingredient(ing), range: i
        end
        mx_data['o8'].each_with_index do |ing,i|
            svg layout: 'optional_ing_8', file: get_icon_for_ingredient(ing), range: i
        end
        #cut_zone
        #safe_zone
        #save_png prefix: 'recpie_'
        build :selfprint do
            save_pdf file: 'mx-recipe_cards-v3.pdf'
        end
        build :drivethru do
            save_pdf file: 'mx-recipe_cards-v3-drivethru-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :phipps do
            save_pdf file: 'mx-recipe_cards-v3-phipps-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :selfsheet do
            save_sheet prefix: 'mx-recipe_cards-v3-sheet-fronts', sprue: 'letter_poker_card_9up.yml'
        end
    end
    
    Squib::Deck.new(layout:'recipe-card-back-layout.yml', cards: mx_data['Recipe Name'].size) do
            rect layout: 'card_background', fill_color: '#'+Standard_colors[3][:hex]
            text layout: 'logo_text', str: 'Cookathon', color: 'white', font: 'League Spartan, Black 22'
            text layout: 'card_type', str: 'Recipe' , color: 'white', font: 'League Spartan, Bold 20'
            svg layout: 'logo_image', file: 'icons/svg/recipe-book-face2.svg'
            #cut_zone
            build :selfprint do
                save_png prefix: 'mx-recipe_back_', range: 0
            end
            build :drivethru do
                save_pdf file: 'mx-recipe_cards-v3-drivethru-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
            build :phipps do
                save_pdf file: 'mx-recipe_cards-v3-phipps-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
    end
    
    
    #
    #
    #
    
    bo_data = Squib.xlsx file: 'recipe-cards-v3.xlsx', sheet: 4
    
    Squib::Deck.new(layout:'recipe-card-layout.yml', cards: bo_data['Recipe Name'].size) do
        bo_data['Course'].each_with_index do |course,i|
            #rect layout: 'recipe_background', fill_color: phase_bg[phase], range: i
            svg x:'0in', y: '0.85in', width: '2.8in', height: '2.6in', file: course_bg[course], range: i
            svg layout: 'course', file: course_icon[course], range: i
        end
        svg layout: 'city', file: 'icons/svg/Ingredient backs/Final choices/028-lobster.svg'
        text layout: 'recipe_name', font: 'League Spartan, Bold', str: bo_data['Recipe Name']
        text layout: 'recipe_prep_title', font: 'League Spartan, medium', font_size: 10, str: 'Recipe Prep Time:'
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Dark, 20', color: 'white', str: bo_data['Recipe Prep Time']
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Heavy, 20', str: bo_data['Recipe Prep Time']
        #svg layout: 'final_step_icon', file: 'icons/svg/combine.svg'
        svg layout: 'points_icon', file: 'star-by-freepik.svg'
        text layout: 'points_icon_text', font: 'League Spartan, medium 12', align: :center, str: bo_data['Meal Points']
        bo_data['Ingredient1'].each_with_index do |ing,i|
            svg layout: 'ingredient_1_icon', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['Ingredient2'].each_with_index do |ing,i|
            svg layout: 'ingredient_2_icon', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['Ingredient3'].each_with_index do |ing,i|
            svg layout: 'ingredient_3_icon', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['Ingredient4'].each_with_index do |ing,i|
            svg layout: 'ingredient_4_icon', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['Ingredient5'].each_with_index do |ing,i|
            svg layout: 'ingredient_5_icon', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['Ingredient6'].each_with_index do |ing,i|
            svg layout: 'ingredient_6_icon', file: get_icon_for_ingredient(ing), range: i
        end
        text layout: 'ingredient_1_name', str: bo_data['Ingredient1']
        text layout: 'ingredient_2_name', str: bo_data['Ingredient2']
        text layout: 'ingredient_3_name', str: bo_data['Ingredient3']
        text layout: 'ingredient_4_name', str: bo_data['Ingredient4']
        text layout: 'ingredient_5_name', str: bo_data['Ingredient5']
        text layout: 'ingredient_6_name', str: bo_data['Ingredient6']
        bo_data['Recipe Type'].each_with_index do |t,i|
            if t == '1' then
                line layout: 'optional_line', range: i
                text layout: 'optional_title', font: 'League Spartan, medium', str: 'Optional:  +2', range: i
            end
        end
        bo_data['o1'].each_with_index do |ing,i|
            svg layout: 'optional_ing_1', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['o2'].each_with_index do |ing,i|
            svg layout: 'optional_ing_2', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['o3'].each_with_index do |ing,i|
            svg layout: 'optional_ing_3', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['o4'].each_with_index do |ing,i|
            svg layout: 'optional_ing_4', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['o5'].each_with_index do |ing,i|
            svg layout: 'optional_ing_5', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['o6'].each_with_index do |ing,i|
            svg layout: 'optional_ing_6', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['o7'].each_with_index do |ing,i|
            svg layout: 'optional_ing_7', file: get_icon_for_ingredient(ing), range: i
        end
        bo_data['o8'].each_with_index do |ing,i|
            svg layout: 'optional_ing_8', file: get_icon_for_ingredient(ing), range: i
        end
        #cut_zone
        #safe_zone
        #save_png prefix: 'recpie_'
        build :selfprint do
            save_pdf file: 'bo-recipe_cards-v3.pdf'
        end
        build :drivethru do
            save_pdf file: 'bo-recipe_cards-v3-drivethru-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :phipps do
            save_pdf file: 'bo-recipe_cards-v3-phipps-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :selfsheet do
            save_sheet prefix: 'bo-recipe_cards-v3-sheet-fronts', sprue: 'letter_poker_card_9up.yml'
        end
    end
    
    Squib::Deck.new(layout:'recipe-card-back-layout.yml', cards: bo_data['Recipe Name'].size) do
            rect layout: 'card_background', fill_color: '#'+Standard_colors[3][:hex]
            text layout: 'logo_text', str: 'Cookathon', color: 'white', font: 'League Spartan, Black 22'
            text layout: 'card_type', str: 'Recipe' , color: 'white', font: 'League Spartan, Bold 20'
            svg layout: 'logo_image', file: 'icons/svg/recipe-book-face2.svg'
            #cut_zone
            build :selfprint do
                save_png prefix: 'bo-recipe_back_', range: 0
            end
            build :drivethru do
                save_pdf file: 'bo-recipe_cards-v3-drivethru-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
            build :phipps do
                save_pdf file: 'bo-recipe_cards-v3-phipps-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
    end
    
    
    #
    #
    #
    
    ty_data = Squib.xlsx file: 'recipe-cards-v3.xlsx', sheet: 5
    
    Squib::Deck.new(layout:'recipe-card-layout.yml', cards: ty_data['Recipe Name'].size) do
        ty_data['Course'].each_with_index do |course,i|
            #rect layout: 'recipe_background', fill_color: phase_bg[phase], range: i
            svg x:'0in', y: '0.85in', width: '2.8in', height: '2.6in', file: course_bg[course], range: i
            svg layout: 'course', file: course_icon[course], range: i
        end
        svg layout: 'city', file: 'icons/svg/Ingredient backs/Final choices/025-ramen.svg'
        text layout: 'recipe_name', font: 'League Spartan, Bold', str: ty_data['Recipe Name']
        text layout: 'recipe_prep_title', font: 'League Spartan, medium', font_size: 10, str: 'Recipe Prep Time:'
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Dark, 20', color: 'white', str: ty_data['Recipe Prep Time']
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Heavy, 20', str: ty_data['Recipe Prep Time']
        #svg layout: 'final_step_icon', file: 'icons/svg/combine.svg'
        svg layout: 'points_icon', file: 'star-by-freepik.svg'
        text layout: 'points_icon_text', font: 'League Spartan, medium 12', align: :center, str: ty_data['Meal Points']
        ty_data['Ingredient1'].each_with_index do |ing,i|
            svg layout: 'ingredient_1_icon', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['Ingredient2'].each_with_index do |ing,i|
            svg layout: 'ingredient_2_icon', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['Ingredient3'].each_with_index do |ing,i|
            svg layout: 'ingredient_3_icon', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['Ingredient4'].each_with_index do |ing,i|
            svg layout: 'ingredient_4_icon', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['Ingredient5'].each_with_index do |ing,i|
            svg layout: 'ingredient_5_icon', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['Ingredient6'].each_with_index do |ing,i|
            svg layout: 'ingredient_6_icon', file: get_icon_for_ingredient(ing), range: i
        end
        text layout: 'ingredient_1_name', str: ty_data['Ingredient1']
        text layout: 'ingredient_2_name', str: ty_data['Ingredient2']
        text layout: 'ingredient_3_name', str: ty_data['Ingredient3']
        text layout: 'ingredient_4_name', str: ty_data['Ingredient4']
        text layout: 'ingredient_5_name', str: ty_data['Ingredient5']
        text layout: 'ingredient_6_name', str: ty_data['Ingredient6']
        ty_data['Recipe Type'].each_with_index do |t,i|
            if t == '1' then
                line layout: 'optional_line', range: i
                text layout: 'optional_title', font: 'League Spartan, medium', str: 'Optional:  +2', range: i
            end
        end
        ty_data['o1'].each_with_index do |ing,i|
            svg layout: 'optional_ing_1', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['o2'].each_with_index do |ing,i|
            svg layout: 'optional_ing_2', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['o3'].each_with_index do |ing,i|
            svg layout: 'optional_ing_3', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['o4'].each_with_index do |ing,i|
            svg layout: 'optional_ing_4', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['o5'].each_with_index do |ing,i|
            svg layout: 'optional_ing_5', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['o6'].each_with_index do |ing,i|
            svg layout: 'optional_ing_6', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['o7'].each_with_index do |ing,i|
            svg layout: 'optional_ing_7', file: get_icon_for_ingredient(ing), range: i
        end
        ty_data['o8'].each_with_index do |ing,i|
            svg layout: 'optional_ing_8', file: get_icon_for_ingredient(ing), range: i
        end
        #cut_zone
        #safe_zone
        #save_png prefix: 'recpie_'
        build :selfprint do
            save_pdf file: 'ty-recipe_cards-v3.pdf'
        end
        build :drivethru do
            save_pdf file: 'ty-recipe_cards-v3-drivethru-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :phipps do
            save_pdf file: 'ty-recipe_cards-v3-phipps-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :selfsheet do
            save_sheet prefix: 'ty-recipe_cards-v3-sheet-fronts', sprue: 'letter_poker_card_9up.yml'
        end
    end
    
    Squib::Deck.new(layout:'recipe-card-back-layout.yml', cards: ty_data['Recipe Name'].size) do
            rect layout: 'card_background', fill_color: '#'+Standard_colors[3][:hex]
            text layout: 'logo_text', str: 'Cookathon', color: 'white', font: 'League Spartan, Black 22'
            text layout: 'card_type', str: 'Recipe' , color: 'white', font: 'League Spartan, Bold 20'
            svg layout: 'logo_image', file: 'icons/svg/recipe-book-face2.svg'
            #cut_zone
            build :selfprint do
                save_png prefix: 'ty-recipe_back_', range: 0
            end
            build :drivethru do
                save_pdf file: 'ty-recipe_cards-v3-drivethru-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
            build :phipps do
                save_pdf file: 'ty-recipe_cards-v3-phipps-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
    end
    
    #
    #
    #
    
    rm_data = Squib.xlsx file: 'recipe-cards-v3.xlsx', sheet: 6
    
    Squib::Deck.new(layout:'recipe-card-layout.yml', cards: rm_data['Recipe Name'].size) do
        rm_data['Course'].each_with_index do |course,i|
            #rect layout: 'recipe_background', fill_color: phase_bg[phase], range: i
            svg x:'0in', y: '0.85in', width: '2.8in', height: '2.6in', file: course_bg[course], range: i
            svg layout: 'course', file: course_icon[course], range: i
        end
        svg layout: 'city', file: 'icons/svg/Ingredient backs/Final choices/pizza.svg'
        text layout: 'recipe_name', font: 'League Spartan, Bold', str: rm_data['Recipe Name']
        text layout: 'recipe_prep_title', font: 'League Spartan, medium', font_size: 10, str: 'Recipe Prep Time:'
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Dark, 20', color: 'white', str: rm_data['Recipe Prep Time']
        text layout: 'recipe_prep_amnt', font: 'Dicier Round-Heavy, 20', str: rm_data['Recipe Prep Time']
        #svg layout: 'final_step_icon', file: 'icons/svg/combine.svg'
        svg layout: 'points_icon', file: 'star-by-freepik.svg'
        text layout: 'points_icon_text', font: 'League Spartan, medium 12', align: :center, str: rm_data['Meal Points']
        rm_data['Ingredient1'].each_with_index do |ing,i|
            svg layout: 'ingredient_1_icon', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['Ingredient2'].each_with_index do |ing,i|
            svg layout: 'ingredient_2_icon', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['Ingredient3'].each_with_index do |ing,i|
            svg layout: 'ingredient_3_icon', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['Ingredient4'].each_with_index do |ing,i|
            svg layout: 'ingredient_4_icon', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['Ingredient5'].each_with_index do |ing,i|
            svg layout: 'ingredient_5_icon', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['Ingredient6'].each_with_index do |ing,i|
            svg layout: 'ingredient_6_icon', file: get_icon_for_ingredient(ing), range: i
        end
        text layout: 'ingredient_1_name', str: rm_data['Ingredient1']
        text layout: 'ingredient_2_name', str: rm_data['Ingredient2']
        text layout: 'ingredient_3_name', str: rm_data['Ingredient3']
        text layout: 'ingredient_4_name', str: rm_data['Ingredient4']
        text layout: 'ingredient_5_name', str: rm_data['Ingredient5']
        text layout: 'ingredient_6_name', str: rm_data['Ingredient6']
        rm_data['Recipe Type'].each_with_index do |t,i|
            if t == '1' then
                line layout: 'optional_line', range: i
                text layout: 'optional_title', font: 'League Spartan, medium', str: 'Optional:  +2', range: i
            end
        end
        rm_data['o1'].each_with_index do |ing,i|
            svg layout: 'optional_ing_1', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['o2'].each_with_index do |ing,i|
            svg layout: 'optional_ing_2', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['o3'].each_with_index do |ing,i|
            svg layout: 'optional_ing_3', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['o4'].each_with_index do |ing,i|
            svg layout: 'optional_ing_4', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['o5'].each_with_index do |ing,i|
            svg layout: 'optional_ing_5', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['o6'].each_with_index do |ing,i|
            svg layout: 'optional_ing_6', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['o7'].each_with_index do |ing,i|
            svg layout: 'optional_ing_7', file: get_icon_for_ingredient(ing), range: i
        end
        rm_data['o8'].each_with_index do |ing,i|
            svg layout: 'optional_ing_8', file: get_icon_for_ingredient(ing), range: i
        end
        #cut_zone
        #safe_zone
        #save_png prefix: 'recpie_'
        build :selfprint do
            save_pdf file: 'rm-recipe_cards-v3.pdf'
        end
        build :drivethru do
            save_pdf file: 'rm-recipe_cards-v3-drivethru-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :phipps do
            save_pdf file: 'rm-recipe_cards-v3-phipps-fronts.pdf', sprue: 'drivethrucards_1up.yml'
        end
        build :selfsheet do
            save_sheet prefix: 'rm-recipe_cards-v3-sheet-fronts', sprue: 'letter_poker_card_9up.yml'
        end
    end
    
    Squib::Deck.new(layout:'recipe-card-back-layout.yml', cards: rm_data['Recipe Name'].size) do
            rect layout: 'card_background', fill_color: '#'+Standard_colors[3][:hex]
            text layout: 'logo_text', str: 'Cookathon', color: 'white', font: 'League Spartan, Black 22'
            text layout: 'card_type', str: 'Recipe' , color: 'white', font: 'League Spartan, Bold 20'
            svg layout: 'logo_image', file: 'icons/svg/recipe-book-face2.svg'
            #cut_zone
            build :selfprint do
                save_png prefix: 'rm-recipe_back_', range: 0
            end
            build :drivethru do
                save_pdf file: 'rm-recipe_cards-v3-drivethru-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
            build :phipps do
                save_pdf file: 'rm-recipe_cards-v3-phipps-backs.pdf', sprue: 'drivethrucards_1up.yml'
            end
    end
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment