Class: GdshowsdatabaseGenerator

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

Constant Summary collapse

@@migrations_dir =
File.expand_path('../../db/migrations', __FILE__)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



7
8
9
# File 'lib/gdshowsdb/generators/gdshowsdatabase_generator.rb', line 7

def self.next_migration_number(path)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#create_migration_filesObject



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

def create_migration_files
  Dir.entries(@@migrations_dir).each do |file|
    sleep 1 #gross
    migration_template(file, "db/migrate/#{file.sub(/\d\d\d_/, '')}") unless File.directory?(file)
  end    
end