Commit 918bc420 by Jon Frisby

Resolve conflict between generated rakefile and CLI tool.

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