Sha256: 9a4cc86cd0facbd6be1205508a36ae0b08f997ee91837bb455821341f7a8d553

Contents?: true

Size: 774 Bytes

Versions: 9

Compression:

Stored size: 774 Bytes

Contents

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

module GeonamesRails
  module Generators
    class MigrationGenerator < Rails::Generators::Base
      source_root File.expand_path(File.join(File.dirname(__FILE__), 'migration_templates'))
      include Rails::Generators::Migration
      desc "add the geonames migrations"

      def generate_migration
        migration_template 'geonames_tables.rb',"db/migrate/create_geonames_tables.rb"
      end

      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

    end
    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
geonames_rails-0.2.2 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.2.1 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.2.0 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.1.6 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.1.5 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.1.3 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.1.2 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.1.1 lib/generators/geonames_rails/migration_generator.rb
geonames_rails-0.1.0 lib/generators/geonames_rails/migration_generator.rb