Sha256: 79357c114bf41cf0f163e1f74fcf1d39f7c484f42250c3c12df4bb8af56e2e7b

Contents?: true

Size: 993 Bytes

Versions: 1

Compression:

Stored size: 993 Bytes

Contents

module Bootstrap2FormBuilder
  module Generators
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path("../../templates/bootstrap2_form_builder", __FILE__)

      class_option :view_engine, :type => :string, :aliases => "-t", :desc => "Template engine for the views. Available options are 'erb' and 'haml'.", :default => "erb"
      class_option :haml, :type => :boolean, :default => false

      # all public methods in here will be run in order
      def add_my_initializer
        template "initializer.rb", "config/initializers/bootstrap2_form_builder.rb"
      end

      def create_error_partials
        if options[:view_engine] == "haml" || options[:haml]
          copy_file "_error_messages.html.haml", "app/views/bootstrap2_form_builder/_error_messages.html.haml"
        elsif
          copy_file "_error_messages.html.erb", "app/views/bootstrap2_form_builder/_error_messages.html.erb"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap2_form_builder-0.0.2 lib/generators/bootstrap2_form_builder/install_generator.rb