Impressionist generator now accepts --orm option (defaults to active_record).

This commit is contained in:
Tute Costa 2012-03-12 18:19:29 -03:00
parent 0e7d75d1ec
commit ecb95519ec
4 changed files with 28 additions and 20 deletions

View File

@ -0,0 +1,21 @@
module ActiveRecord
module Generators
class ImpressionistGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.join(File.dirname(__FILE__), 'templates')
def self.next_migration_number(dirname)
sleep 1
if ActiveRecord::Base.timestamped_migrations
Time.now.utc.strftime("%Y%m%d%H%M%S")
else
"%.3d" % (current_migration_number(dirname) + 1)
end
end
def create_migration_file
migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb'
end
end
end
end

View File

@ -1,20 +0,0 @@
require 'rails/generators'
require 'rails/generators/migration'
class ImpressionistGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.join(File.dirname(__FILE__), 'templates')
def self.next_migration_number(dirname)
sleep 1
if ActiveRecord::Base.timestamped_migrations
Time.now.utc.strftime("%Y%m%d%H%M%S")
else
"%.3d" % (current_migration_number(dirname) + 1)
end
end
def create_migration_file
migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb'
end
end

View File

@ -0,0 +1,7 @@
module Impressionist
module Generators
class ImpressionistGenerator < Rails::Generators::Base
hook_for :orm
end
end
end