Sha256: f71b51928c0aa23b7d15e8a9545e598f44471394199e079af9508cd624d79838

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

module Playmo
  module Recipes
    class FormsRecipe < Playmo::Recipe
      source_root File.expand_path('../templates/forms_recipe', __FILE__)

      def setup
        question "Which form builder you prefer?" do
          answer "Use default form_for helper" => :use_default
          answer "Simple Form"                 => :install_simple_form
          answer "Formtastic"                  => :install_formtastic
        end
      end

    protected

      def use_default
        # do nothing
      end

      def install_simple_form
        gem 'simple_form'

        Event.events.listen(:after_install) do |event_data|
          generate "simple_form:install"
        end
      end

      def install_formtastic
        gem 'formtastic'

        Event.events.listen(:after_install) do |event_data|
          generate "formtastic:install"
        end
      end

    end
  end
end

# Write down this recipe to our Cookbook if it's available
require File.dirname(__FILE__) + '/compass_recipe'
Playmo::Cookbook.instance.insert_after(Playmo::Recipes::CompassRecipe, Playmo::Recipes::FormsRecipe) if defined?(Playmo::Cookbook)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
playmo-0.0.18 lib/playmo/recipes/forms_recipe.rb
playmo-0.0.17 lib/playmo/recipes/forms_recipe.rb