Class: Mailboxer::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mailboxer::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/mailboxer/install_generator.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/generators/mailboxer/install_generator.rb', line 6 def self.next_migration_number path unless @prev_migration_nr @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end |
Instance Method Details
#copy_migrations ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/mailboxer/install_generator.rb', line 19 def copy_migrations if Rails.version < "3.1" migrations = [["20110511145103_create_mailboxer.rb","create_mailboxer.rb"], ["20110719110700_add_notified_object.rb","add_notified_object.rb"], ["20110912163911_add_notification_code.rb","add_notification_code.rb"], ["20111204163911_add_attachments.rb","add_attachments.rb"]] migrations.each do |migration| migration_template "../../../../db/migrate/" + migration[0], "db/migrate/" + migration[1] end else require 'rake' Rails.application.load_tasks Rake::Task['railties:install:migrations'].reenable Rake::Task['mailboxer_engine:install:migrations'].invoke end end |
#create_initializer_file ⇒ Object
15 16 17 |
# File 'lib/generators/mailboxer/install_generator.rb', line 15 def create_initializer_file template 'initializer.rb', 'config/initializers/mailboxer.rb' end |