Sha256: d1792ee60e18c27035d34e574699937eaf1980681d9ec3412c68de51eaefadc6

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

module EffectiveEmailTemplates
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      desc "Creates an EffectiveEmailTemplates initializer in your application."

      source_root File.expand_path("../../templates", __FILE__)

      def self.next_migration_number(dirname)
        if not ActiveRecord::Base.timestamped_migrations
          Time.new.utc.strftime("%Y%m%d%H%M%S")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end

      def copy_initializer
        template "effective_email_templates.rb", "config/initializers/effective_email_templates.rb"
      end

      def create_migration_file
        @email_templates_table_name = ':' + EffectiveEmailTemplates.email_templates_table_name.to_s
        migration_template '../../../db/migrate/01_create_effective_email_templates.rb.erb', 'db/migrate/create_effective_email_templates.rb'
      end

      def show_readme
        readme "README" if behavior == :invoke
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
effective_email_templates-0.3.5 lib/generators/effective_email_templates/install_generator.rb
effective_email_templates-0.3.4 lib/generators/effective_email_templates/install_generator.rb
effective_email_templates-0.3.3 lib/generators/effective_email_templates/install_generator.rb
effective_email_templates-0.3.1 lib/generators/effective_email_templates/install_generator.rb
effective_email_templates-0.3.0 lib/generators/effective_email_templates/install_generator.rb
effective_email_templates-0.2.8 lib/generators/effective_email_templates/install_generator.rb