Class: WepayRails::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/wepay_rails/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/generators/wepay_rails/install/install_generator.rb', line 9

def self.next_migration_number(path)
  unless @prev_migration_nr
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  else
    @prev_migration_nr += 1
  end
  @prev_migration_nr.to_s
end

Instance Method Details

#copy_migrationsObject



22
23
24
25
26
# File 'lib/generators/wepay_rails/install/install_generator.rb', line 22

def copy_migrations
  migration_template "create_wepay_checkout_records.rb", "db/migrate/create_wepay_checkout_records.rb"
  copy_file "wepay_checkout_record.rb", "app/models/wepay_checkout_record.rb"
  copy_file "wepay.yml", "config/wepay.yml.example"
end

#setup_routesObject



18
19
20
# File 'lib/generators/wepay_rails/install/install_generator.rb', line 18

def setup_routes
  route "WepayRails.routes(self)"
end