Class: TwoFaced::Generators::InstallGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Defined in:
lib/generators/two_faced/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



10
11
12
# File 'lib/generators/two_faced/install/install_generator.rb', line 10

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

Instance Method Details

#create_migrationsObject



15
16
17
18
19
20
21
# File 'lib/generators/two_faced/install/install_generator.rb', line 15

def create_migrations
  Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
    name = File.basename(filepath)
    migration_template "migrations/#{name}", "db/migrate/#{name.gsub(/^\d+_/,'')}"
    sleep 1
  end
end