Class: GeonamesDump::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/geonames_dump/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



25
26
27
28
# File 'lib/generators/geonames_dump/install_generator.rb', line 25

def self.next_migration_number(path)
  sleep 1 # OPTIMIZE: there might be a better way to do this ...
  @migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i.to_s
end

Instance Method Details

#copy_migrations_filesObject



11
12
13
14
15
16
# File 'lib/generators/geonames_dump/install_generator.rb', line 11

def copy_migrations_files
  #template File.join('app', 'models', 'geonames_country.rb', 'config/initializers/piktur_config.rb'
  %w(create_geonames_countries create_geonames_features).each do |file|
    migration_template File.join('db', 'migrate', "#{file}.rb")
  end
end

#copy_models_filesObject



18
19
20
21
22
23
# File 'lib/generators/geonames_dump/install_generator.rb', line 18

def copy_models_files
  #template File.join('app', 'models', 'geonames_country.rb', 'config/initializers/piktur_config.rb'
  %w(geonames_admin1 geonames_admin2 geonames_city geonames_country geonames_feature).each do |file|
    copy_file File.join('app', 'models', "#{file}.rb")
  end
end