Sha256: bc106aac315dbeb9aa3d24352f82262e5330e8c480ddcf5be76d1ebc0fa873c2

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module Formtastic
  # Copies a config initializer to config/initializers/formtastic.rb
  #
  # @example
  # !!!shell
  #   $ rails generate formtastic:install
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path('../../../templates', __FILE__)
    class_option :template_engine

    desc "Copies a config initializer to config/initializers/formtastic.rb"
    def copy_files
      copy_file 'formtastic.rb', 'config/initializers/formtastic.rb'
    end

    def copy_scaffold_template
      engine = options[:template_engine]
      copy_file "_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
formtastic-5.0.0 lib/generators/formtastic/install/install_generator.rb