Sha256: 93b06093bfaaef717c516c5f7b4ea95a0c44bf82bc6009823e1bc00c4b21b50b

Contents?: true

Size: 596 Bytes

Versions: 7

Compression:

Stored size: 596 Bytes

Contents

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

class GritterNoticesGenerator < 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.now.utc.strftime("%Y%m%d%H%M%S")
    else
      "%.3d" % (current_migration_number(dirname) + 1)
    end
  end

  def create_migration_file
    migration_template 'migration.rb', 'db/migrate/create_gritter_notices_table.rb'
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gritter_notices-0.4.0 lib/generators/gritter_notices_generator.rb
gritter_notices-0.3.4 lib/generators/gritter_notices_generator.rb
gritter_notices-0.3.3 lib/generators/gritter_notices_generator.rb
gritter_notices-0.3.2 lib/generators/gritter_notices_generator.rb
gritter_notices-0.3.1 lib/generators/gritter_notices_generator.rb
gritter_notices-0.2.0 lib/generators/gritter_notices_generator.rb
gritter_notices-0.1.1 lib/generators/gritter_notices_generator.rb