Commit 918bc420 by Jon Frisby

Resolve conflict between generated rakefile and CLI tool.

parent 9d52904a
......@@ -83,6 +83,7 @@ OptionParser.new do |opts|
end.parse!
ENV['is_cli'] = '1'
if Annotate.load_tasks
Rake::Task[task].invoke
else
......
......@@ -18,7 +18,7 @@ module Annotate
load 'Rakefile'
# Rails 3 wants to load our .rake files for us.
# TODO: selectively do this require on Rails 2.x?
#Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
return true
else
return false
......
......@@ -2,8 +2,7 @@
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if(Rails.env.development?)
require 'annotate/tasks'
task :set_annotation_options do
ENV['position_in_class'] = "before"
ENV['position_in_fixture'] = "before"
ENV['position_in_factory'] = "before"
......@@ -17,4 +16,5 @@ if(Rails.env.development?)
ENV['format_markdown'] = "false"
ENV['no_sort'] = "false"
ENV['force'] = "false"
end
end
if(!ENV['is_cli'])
task :set_annotation_options
task :annotate_models => :set_annotation_options
end
desc "Add schema information (as comments) to model and fixture files"
task :annotate_models => :environment do
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'annotate', 'annotate_models'))
......
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