Class: Pushme::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pushme::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/pushme/install_generator.rb
Class Method Summary collapse
-
.next_migration_number(_path) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
Instance Method Summary collapse
Class Method Details
.next_migration_number(_path) ⇒ Object
Implement the required interface for Rails::Generators::Migration
29 30 31 |
# File 'lib/generators/pushme/install_generator.rb', line 29 def self.next_migration_number(_path) Time.now.utc.strftime('%Y%m%d%H%M%S') end |
Instance Method Details
#copy_migration ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/pushme/install_generator.rb', line 15 def copy_migration file_name = 'add_devices' migration_name = "#{file_name}_to_#{table_name}.rb" if self.class.migration_exists?('db/migrate', migration_name) say_status('skipped', "Migration #{migration_name} already exists") else migration_template "#{file_name}.rb", "db/migrate/#{migration_name}", migration_version: migration_version, table_name: table_name end end |