Sha256: 5ef5987c61c0d363bfa3b4c4327776a281c920175a995339209821813095da60

Contents?: true

Size: 754 Bytes

Versions: 35

Compression:

Stored size: 754 Bytes

Contents

require 'rails/generators/migration'

module Tagtical
  class MigrationGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    desc "Generates migration for Tag and Tagging models"

    def self.orm
      Rails::Generators.options[:rails][:orm]
    end

    def self.source_root
      File.join(File.dirname(__FILE__), 'templates', (orm.to_s unless orm.class.eql?(String)) )
    end

    def self.orm_has_migration?
      [:active_record].include? orm
    end

    def self.next_migration_number(path)
      Time.now.utc.strftime("%Y%m%d%H%M%S")
    end

    def create_migration_file
      if self.class.orm_has_migration?
        migration_template 'migration.rb', 'db/migrate/tagtical_migration'
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
tagtical-1.6.2 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.6.1 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.6.0 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.9 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.8 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.7 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.6 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.5 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.4 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.3 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.2 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.1 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.5.0 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.4.12 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.4.11 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.4.10 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.4.9 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.4.8 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.4.7 lib/generators/tagtical/migration/migration_generator.rb
tagtical-1.4.6 lib/generators/tagtical/migration/migration_generator.rb