Sha256: 216dead72704f23a9c594f55361ecc9b455f6b394d40cb2ad465abbb9e524c66

Contents?: true

Size: 695 Bytes

Versions: 11

Compression:

Stored size: 695 Bytes

Contents

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

  def self.next_migration_number path
    unless @prev_migration
      @prev_migration = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
    else
      @prev_migration += 1
    end
    @prev_migration.to_s
  end

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

  def copy_migrations
    require 'rake'
    Rails.application.load_tasks
    Rake::Task['railties:install:migrations'].reenable
    Rake::Task['ratable:install:migrations'].invoke
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ratable-0.1.1 lib/generators/ratable/install_generator.rb
ratable-0.1.0 lib/generators/ratable/install_generator.rb
ratable-0.0.9 lib/generators/ratable/install_generator.rb
ratable-0.0.8 lib/generators/ratable/install_generator.rb
ratable-0.0.7 lib/generators/ratable/install_generator.rb
ratable-0.0.6 lib/generators/ratable/install_generator.rb
ratable-0.0.5 lib/generators/ratable/install_generator.rb
ratable-0.0.4 lib/generators/ratable/install_generator.rb
ratable-0.0.3 lib/generators/ratable/install_generator.rb
ratable-0.0.2 lib/generators/ratable/install_generator.rb
ratable-0.0.1 lib/generators/ratable/install_generator.rb