Class: GeoserverMigrations::Generators::AddGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/geoserver_migrations/add/add_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_migrationObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/geoserver_migrations/add/add_generator.rb', line 8

def add_migration
  migration_name = file_name.underscore
  class_name = file_name.camelize

  create_file File.join(Rails.root, GeoserverMigrations.migrations_rootpath, "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{migration_name}.rb"), <<-MIGRATION_FILE
class #{class_name} < GeoserverMigrations::Migration

  def run 
    # add migration code here
  end 

end
MIGRATION_FILE
  
end