Class: UnifiedPayment::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



13
14
15
# File 'lib/generators/unified_payment/install_generator.rb', line 13

def self.source_root
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#create_migrationsObject

Generator Code. Remember this is just suped-up Thor so methods are executed in order



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

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