Commit b006985c by Jon Frisby

Make -R work for all four task types.

parent 69cd69cb
......@@ -407,6 +407,12 @@ module AnnotateModels
end
def remove_annotations(options={})
if options[:require]
options[:require].each do |path|
require path
end
end
self.model_dir = options[:model_dir] if options[:model_dir]
deannotated = []
deannotated_klass = false
......
......@@ -23,6 +23,12 @@ module AnnotateRoutes
def self.do_annotate(options={})
return unless(routes_exists?)
if options[:require]
options[:require].each do |path|
require path
end
end
position_after = options[:position_in_routes] != 'before'
routes_map = `rake routes`.split(/\n/, -1)
......@@ -68,6 +74,12 @@ module AnnotateRoutes
def self.remove_annotations(options={})
return unless(routes_exists?)
if options[:require]
options[:require].each do |path|
require path
end
end
(content, where_header_found) = strip_annotations(File.read(routes_file))
content = strip_on_removal(content, where_header_found)
......
......@@ -44,6 +44,7 @@ task :remove_annotation => :environment do
options={ :is_rake => true }
options[:model_dir] = ENV['model_dir']
options[:require] = ENV['require'] ? ENV['require'].split(',') : []
options[:trace] = ENV['trace'] =~ true_re
AnnotateModels.remove_annotations(options)
end
......@@ -5,6 +5,7 @@ task :annotate_routes => :environment do
options={}
options[:position_in_routes] = ENV['position_in_routes'] || ENV['position'] || 'after'
options[:require] = ENV['require'] ? ENV['require'].split(',') : []
AnnotateRoutes.do_annotate(options)
end
......@@ -14,5 +15,6 @@ task :remove_routes => :environment do
require "#{annotate_lib}/annotate/annotate_routes"
options={}
options[:require] = ENV['require'] ? ENV['require'].split(',') : []
AnnotateRoutes.remove_annotations(options)
end
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