Commit d61ff54d by Miguel Herranz

Now -p option also have effect on test, spec and Object Daddy files.

parent 7a85f89f
......@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{annotate}
s.version = "2.2.6"
s.version = "2.2.7"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Marcos Piccinini"]
s.date = %q{2009-02-14}
s.date = %q{2009-02-20}
s.default_executable = %q{annotate}
s.description = %q{Annotates Rails Models and Routes}
s.email = ["x@nofxx.com"]
......
......@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
module Annotate
VERSION = '2.2.6'
VERSION = '2.2.7'
end
begin
......
......@@ -73,6 +73,8 @@ module AnnotateModels
# "before" or "after". Default is "before".
# :position_in_class<Symbol>:: where to place the annotated section in model file
# :position_in_fixture<Symbol>:: where to place the annotated section in fixture file
# :position_in_others<Symbol>:: where to place the annotated section in the rest of
# supported files
#
def annotate_one_file(file_name, info_block, options={})
if File.exist?(file_name)
......@@ -128,8 +130,8 @@ module AnnotateModels
[
File.join(UNIT_TEST_DIR, "#{model_name}_test.rb"), # test
File.join(SPEC_MODEL_DIR, "#{model_name}_spec.rb"), # spec
File.join(EXEMPLARS_DIR, "#{model_name}_exemplar.rb"), # Object Daddy
].each { |file| annotate_one_file(file, info) }
File.join(EXEMPLARS_DIR, "#{model_name}_exemplar.rb"), # Object Daddy
].each { |file| annotate_one_file(file, info, options.merge(:position=>(options[:position_in_others] || options[:position]))) }
FIXTURE_DIRS.each do |dir|
fixture_file_name = File.join(dir,klass.table_name + ".yml")
......
......@@ -3,7 +3,8 @@ task :annotate_models => :environment do
require 'annotate/annotate_models'
options={}
options[:position_in_class] = ENV['position_in_class'] || ENV['position']
options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position']
options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position']
options[:position_in_others] = ENV['position_in_others'] || ENV['position']
AnnotateModels.do_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