Class: Betsy::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



30
31
32
33
# File 'lib/generators/betsy/install_generator.rb', line 30

def self.next_migration_number(path)
  next_migration_number = current_migration_number(path) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#copy_betsy_initalizerObject



22
23
24
# File 'lib/generators/betsy/install_generator.rb', line 22

def copy_betsy_initalizer
  template "betsy.rb", "config/initializers/betsy.rb"
end

#copy_betsy_migrationObject



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

def copy_betsy_migration
  migration_template "create_etsy_accounts.rb", "db/migrate/create_etsy_accounts.rb", migration_version: migration_version
end

#copy_betsy_modelObject



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

def copy_betsy_model
  model_file = Betsy..underscore
  template "etsy_account.rb", "app/models/#{model_file}.rb"
end

#migration_versionObject



26
27
28
# File 'lib/generators/betsy/install_generator.rb', line 26

def migration_version
  "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end