Sha256: e315f3a4310de55b8e0d859deed6a24e748750e7c48b274db1621aa8cf2fb8e0

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

class Mailboxer::InstallGenerator < Rails::Generators::Base #:nodoc:
  include Rails::Generators::Migration
  source_root File.expand_path('../templates', __FILE__)
  require 'rails/generators/migration'

  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

  def create_initializer_file
    template 'initializer.rb', 'config/initializers/mailboxer.rb'
  end

  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
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
mailboxer-0.11.0 lib/generators/mailboxer/install_generator.rb
mailboxer-0.10.3 lib/generators/mailboxer/install_generator.rb
curationexperts-mailboxer-0.10.3 lib/generators/mailboxer/install_generator.rb
curationexperts-mailboxer-0.10.3.rc1 lib/generators/mailboxer/install_generator.rb
mailboxer-0.10.2 lib/generators/mailboxer/install_generator.rb
mailboxer-0.10.1 lib/generators/mailboxer/install_generator.rb
mailboxer-0.10.0 lib/generators/mailboxer/install_generator.rb
mailboxer-0.9.0 lib/generators/mailboxer/install_generator.rb
mailboxer-0.8.0 lib/generators/mailboxer/install_generator.rb
mailboxer-0.7.0 lib/generators/mailboxer/install_generator.rb
mailboxer-0.6.5 lib/generators/mailboxer/install_generator.rb