Class: Betsy::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Betsy::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/betsy/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #copy_betsy_initalizer ⇒ Object
- #copy_betsy_migration ⇒ Object
- #copy_betsy_model ⇒ Object
- #migration_version ⇒ Object
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_initalizer ⇒ Object
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_migration ⇒ Object
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_model ⇒ Object
13 14 15 16 |
# File 'lib/generators/betsy/install_generator.rb', line 13 def copy_betsy_model model_file = Betsy.account_model.underscore template "etsy_account.rb", "app/models/#{model_file}.rb" end |
#migration_version ⇒ Object
26 27 28 |
# File 'lib/generators/betsy/install_generator.rb', line 26 def migration_version "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end |