Class: RpushMigrationGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RpushMigrationGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/rpush_migration_generator.rb
Class Attribute Summary collapse
-
.next_template ⇒ Object
Returns the value of attribute next_template.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.next_template ⇒ Object
Returns the value of attribute next_template.
6 7 8 |
# File 'lib/generators/rpush_migration_generator.rb', line 6 def next_template @next_template end |
Class Method Details
.new_migration_number ⇒ Object
18 19 20 21 22 23 |
# File 'lib/generators/rpush_migration_generator.rb', line 18 def new_migration_number @time ||= Time.now.utc @calls ||= -1 @calls += 1 (@time + @calls.seconds).strftime('%Y%m%d%H%M%S') end |
.next_migration_number(path) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/rpush_migration_generator.rb', line 8 def next_migration_number(path) return new_migration_number unless next_template if existing_migration = migration_exists?(File.('db/migrate'), next_template) return File.basename(existing_migration).scan(/(\d+)_/).flatten.first end new_migration_number end |
Instance Method Details
#copy_migration ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/generators/rpush_migration_generator.rb', line 26 def copy_migration if has_migration?('create_rapns_notifications') add_rpush_migration('create_rapns_feedback') add_rpush_migration('add_alert_is_json_to_rapns_notifications') add_rpush_migration('add_app_to_rapns') add_rpush_migration('create_rapns_apps') add_rpush_migration('add_gcm') add_rpush_migration('add_wpns') add_rpush_migration('add_adm') add_rpush_migration('rename_rapns_to_rpush') add_rpush_migration('add_fail_after_to_rpush_notifications') else add_rpush_migration('add_rpush') end add_rpush_migration('rpush_2_0_0_updates') add_rpush_migration('rpush_2_1_0_updates') add_rpush_migration('rpush_2_6_0_updates') add_rpush_migration('rpush_2_7_0_updates') add_rpush_migration('rpush_3_0_0_updates') add_rpush_migration('rpush_3_0_1_updates') end |