Class: Jabe::Generators::MigrationsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Jabe::Generators::MigrationsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/jabe/migrations/migrations_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
32 33 34 |
# File 'lib/generators/jabe/migrations/migrations_generator.rb', line 32 def self.next_migration_number(dirname) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#create_migrations ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/jabe/migrations/migrations_generator.rb', line 10 def create_migrations existing_migrations = Dir["db/migrate/*.rb"] migrations = %w( create_settings.rb create_slugs.rb devise_create_admins.rb create_entries.rb create_comments.rb ).reject { |file| existing_migrations.any? { |migration| match = migration.match(/#{file}$/) puts "skipping #{file}, exists." if match match } } migrations.each do |migration| migration_template migration, "db/migrate/#{migration}" sleep 1 # timestamps... end end |