Sha256: 228a3497cebe4e592e0899028ec29491dd0ef7d26892d763a02804b5e33972e0

Contents?: true

Size: 1.1 KB

Versions: 35

Compression:

Stored size: 1.1 KB

Contents

require 'rails/generators'
require 'rails/generators/migration'
require 'active_record'
require 'rails/generators/active_record'

module NoNotifierNeeded
  class InstallGenerator < Rails::Generators::Base
    include Rails::Generators::Migration
    source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))

    def copy_migration_and_config

      #Config file
      copy_file 'no_notifier_needed_initalizer.rb', 'config/initializers/no_notifier_needed_initalizer.rb'

      #Resque workers
      copy_file "jobs/email_processor.rb", "app/jobs/email_processor.rb"

      #Active Record File
      copy_file "email_template.rb", "app/models/email_template.rb"

      #create migration
      migration_template 'install.rb', 'db/migrate/install_acts_as_no_notifier_needed.rb'
    end

    def self.next_migration_number(dirname)
      next_migration_number = current_migration_number(dirname) + 1
      if ActiveRecord::Base.timestamped_migrations
        [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
      else
        "%.3d" % next_migration_number
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
no_notifier_needed-2.4.5 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.4.4 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.4.3 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.4.2 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.4.1 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.4.0 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.8 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.7 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.6 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.5 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.4 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.3 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.2 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.1 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.3.0 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.2.4 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.2.3 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.2.2 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.2.1 lib/generators/no_notifier_needed/install_generator.rb
no_notifier_needed-2.2.0 lib/generators/no_notifier_needed/install_generator.rb