Sha256: 54965abde98338125ffb382f12658d4a6666e1854b0e8855fd16cba1dfb864d9

Contents?: true

Size: 1.41 KB

Versions: 24

Compression:

Stored size: 1.41 KB

Contents

require 'rails/generators/migration'
 
module TkhContent
  module Generators
    class CreateOrUpdateMigrationsGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "create or update page migrations"
      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
 
      def copy_migrations
        puts 'creating or updating page migrations'
        migration_template "create_pages.rb", "db/migrate/create_pages.rb"
        migration_template "add_short_title_to_pages.rb", "db/migrate/add_short_title_to_pages.rb"
        migration_template "add_author_to_pages.rb", "db/migrate/add_author_to_pages.rb"
        migration_template "add_parent_id_to_pages.rb", "db/migrate/add_parent_id_to_pages.rb"
        migration_template "create_tags.rb", "db/migrate/create_tags.rb"
        migration_template "create_taggings.rb", "db/migrate/create_taggings.rb"
        migration_template "create_contacts.rb", "db/migrate/create_contacts.rb"
        migration_template "add_various_indices_to_pages.rb", "db/migrate/add_various_indices_to_pages.rb"
        migration_template "create_comments.rb", "db/migrate/create_comments.rb"
      end
 
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
tkh_content-0.9.15 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.14 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.13 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.12 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.11 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.10 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.9 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.8 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.7 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.6 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.5 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.4 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.3 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.2 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.4.7 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9.1 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.9 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.4.6 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.4.5 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_content-0.4.4 lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb