Class: FlipperTrail::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- FlipperTrail::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/flipper_trail/generators/flipper_trail/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_initializer ⇒ Object
-
#create_migration_file ⇒ Object
NOTE: must NOT be named ‘create_migration` — Rails::Generators::Migration already defines an instance method `create_migration(destination, data, config)` that migration_template calls internally; a zero-arg Thor command of the same name shadows it and raises ArgumentError (given 3, expected 0).
Class Method Details
.next_migration_number(dirname) ⇒ Object
14 15 16 17 |
# File 'lib/flipper_trail/generators/flipper_trail/install_generator.rb', line 14 def self.next_migration_number(dirname) next_number = current_migration_number(dirname) + 1 ::ActiveRecord::Migration.next_migration_number(next_number) end |
Instance Method Details
#create_initializer ⇒ Object
19 20 21 |
# File 'lib/flipper_trail/generators/flipper_trail/install_generator.rb', line 19 def create_initializer template 'initializer.rb.tt', 'config/initializers/flipper_trail.rb' end |
#create_migration_file ⇒ Object
NOTE: must NOT be named ‘create_migration` — Rails::Generators::Migration already defines an instance method `create_migration(destination, data, config)` that migration_template calls internally; a zero-arg Thor command of the same name shadows it and raises ArgumentError (given 3, expected 0).
26 27 28 |
# File 'lib/flipper_trail/generators/flipper_trail/install_generator.rb', line 26 def create_migration_file migration_template 'migration.rb.tt', 'db/migrate/create_flipper_trail_entries.rb' end |