Sha256: 1e2bdcaf4ad9234babb74bf91308cd438b69edf3f2226f9cf9192fb4be57f700

Contents?: true

Size: 598 Bytes

Versions: 6

Compression:

Stored size: 598 Bytes

Contents

# Requires
require 'rails/generators'
require 'rails/generators/migration'

class PurgatoryGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
  def self.source_root
    @source_root ||= File.join(File.dirname(__FILE__), 'templates')
  end

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

  def create_migration_file
    migration_template 'create_purgatories.rb', 'db/migrate/create_purgatories.rb'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
purgatory-2.2.0 lib/generators/purgatory/purgatory_generator.rb
purgatory-2.1.0 lib/generators/purgatory/purgatory_generator.rb
purgatory-2.0.0 lib/generators/purgatory/purgatory_generator.rb
purgatory-1.1.0 lib/generators/purgatory/purgatory_generator.rb
purgatory-1.0.0 lib/generators/purgatory/purgatory_generator.rb
purgatory-0.2.0 lib/generators/purgatory/purgatory_generator.rb