Commit 6049ee1f by Ryan Wilcox

restored ability of annotate_models to run as a plugin.

In your rails env define module ANNOTATE_MODELS_PREFS with a constant of USE_PLUGIN = true to use plugin not gem
parent b4abdb18
def is_plugin?
(defined? ANNOTATE_MODELS_PREFS::USE_PLUGIN) &&
(!ANNOTATE_MODELS_PREFS::USE_PLUGIN.nil?) ?
ANNOTATE_MODELS_PREFS::USE_PLUGIN : false
end
desc "Add schema information (as comments) to model and fixture files"
task :annotate_models => :environment do
require 'annotate_models'
if is_plugin?
require File.expand_path(File.dirname(__FILE__) + '/../annotate/annotate_models')
else
require 'annotate_models'
end
options={}
options[:position_in_class] = ENV['position_in_class'] || ENV['position']
options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position']
......@@ -10,6 +21,10 @@ end
desc "Remove schema information from model and fixture files"
task :remove_annotation => :environment do
require 'annotate_models'
if is_plugin?
require File.expand_path(File.dirname(__FILE__) + '/../annotate/annotate_models')
else
require 'annotate_models'
end
AnnotateModels.remove_annotations
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment