Class: Mkconfig::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/generators/mkconfig/install_generator.rb', line 7

def self.source_root
  File.expand_path("../templates", __FILE__)
end

Instance Method Details

#create_migrationsObject



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

def create_migrations
  Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
    name = File.basename(filepath)
    new_name = Time.now.to_i.to_s + "_" + File.basename(filepath).to_s
    template "migrations/#{name}", "db/migrate/#{new_name}"
    sleep 1
  end
end