Commit 9407dc67 by cuong.tran

Fix #214 where annotation for a single model is broken

parent d260a199
...@@ -344,28 +344,27 @@ module AnnotateModels ...@@ -344,28 +344,27 @@ module AnnotateModels
options.merge(:position=>(options[position_in] || options[:position])) options.merge(:position=>(options[position_in] || options[:position]))
end end
# Return a list of the model files to annotate. If we have # Return a list of the model files to annotate.
# command line arguments, they're assumed to be either # If we have command line arguments, they're assumed to the path
# the underscore or CamelCase versions of model names. # of model files from root dir. Otherwise we take all the model files
# Otherwise we take all the model files in the # in the model_dir directory.
# model_dir directory.
def get_model_files(options) def get_model_files(options)
models = []
if(!options[:is_rake]) if(!options[:is_rake])
models = ARGV.dup models = ARGV.dup.reject{|m| m.match(/^(.*)=/)}
models.shift
else
models = []
end end
models.reject!{|m| m.match(/^(.*)=/)}
if models.empty? if models.empty?
begin begin
model_dir.each do |dir| model_dir.each do |dir|
Dir.chdir(dir) do Dir.chdir(dir) do
models.concat( if options[:ignore_model_sub_dir] lst =
Dir["*.rb"].map{ |f| [dir, f] } if options[:ignore_model_sub_dir]
else Dir["*.rb"].map{ |f| [dir, f] }
Dir["**/*.rb"].reject{ |f| f["concerns/"] }.map{ |f| [dir, f] } else
end) Dir["**/*.rb"].reject{ |f| f["concerns/"] }.map{ |f| [dir, f] }
end
models.concat(lst)
end end
end end
rescue SystemCallError rescue SystemCallError
...@@ -375,6 +374,9 @@ module AnnotateModels ...@@ -375,6 +374,9 @@ module AnnotateModels
exit 1 exit 1
end end
end end
puts "MODELS: #{models}"
models models
end 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