Class: ApnOnRails::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ApnOnRails::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/apn_on_rails/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/generators/apn_on_rails/install/install_generator.rb', line 17 def self.next_migration_number(path) unless @prev_migration_nr @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end |
Instance Method Details
#create_migrations ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/generators/apn_on_rails/install/install_generator.rb', line 26 def create_migrations Dir.glob(File.join(self.class.source_root, '*.rb')).sort.each_with_index do |f, i| source = File.basename(f) source.match(/\d+\_(.+)/) destination = "db/migrate/#{$1}" migration_template source, destination end end |