Sha256: 8db48a47e9940c557887d0109c48c13a4e9998cc7666dbf69e2bb38d1dce3a37

Contents?: true

Size: 705 Bytes

Versions: 3

Compression:

Stored size: 705 Bytes

Contents

module Ekv
  module Generators
    class MigrationsGenerator < Rails::Generators::Base
      desc "Generates the default migrations for easy_key_value"

      include Rails::Generators::Migration

      def self.source_root
        @_ekv_source_root ||= File.expand_path("../templates", __FILE__)
      end

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

      def create_migrations
        Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
          name = File.basename(filepath)
          migration_template "migrations/#{name}", "db/migrate/#{name.gsub(/^\d+_/,'')}"
          sleep 1
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
easy_key_value-0.1.2 lib/generators/ekv/migrations/migrations_generator.rb
easy_key_value-0.1.1 lib/generators/ekv/migrations/migrations_generator.rb
easy_key_value-0.1.0 lib/generators/ekv/migrations/migrations_generator.rb