Sha256: de057e184b107c22a2c4e7cf68e4a816d05d5e958a10023e402a2f9d5845706a

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

require 'rails/generators/active_record'

module TwoFaced
  module Generators
    class InstallGenerator < ActiveRecord::Generators::Base
      desc "Installs TwoFaced and generates the necessary migrations"

      argument :name, :type => :string, :default => "create_migrations"

      def self.source_root
        File.expand_path("../templates", __FILE__)
      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

2 entries across 2 versions & 1 rubygems

Version Path
two_faced-0.0.2 lib/generators/two_faced/install/install_generator.rb
two_faced-0.0.2.alpha lib/generators/two_faced/install/install_generator.rb