Sha256: 86aa46b5814e1194d591fc5ef1306666b4d83e6a2ab326286b37ed5ea97824cd

Contents?: true

Size: 600 Bytes

Versions: 5

Compression:

Stored size: 600 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'rails/generators'
require 'rails/generators/migration'

class GeoipGenerator < 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 'migration.rb', 'db/migrate/create_geoips.rb'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ip_to_country-0.2.0 lib/generators/geoip/geoip_generator.rb
ip_to_country-0.1.0 lib/generators/geoip/geoip_generator.rb
ip_to_country-0.0.3 lib/generators/geoip/geoip_generator.rb
ip_to_country-0.0.2 lib/generators/geoip/geoip_generator.rb
ip_to_country-0.0.1 lib/generators/geoip/geoip_generator.rb