Skip to content

Commit

Permalink
Matched up how it searches for files to annotate so that it would cat…
Browse files Browse the repository at this point in the history
…ch my factory girl files.
  • Loading branch information
mdeering committed Nov 12, 2009
1 parent f1bf473 commit ce53cbe
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions lib/annotate_models.rb
@@ -1,11 +1,12 @@
require "config/environment"

MODEL_DIR = File.join(RAILS_ROOT, "app/models" )
UNIT_TEST_DIR = File.join(RAILS_ROOT, "test/unit" )
SPEC_MODEL_DIR = File.join(RAILS_ROOT, "spec/models")
FIXTURES_DIR = File.join(RAILS_ROOT, "test/fixtures")
SPEC_FIXTURES_DIR = File.join(RAILS_ROOT, "spec/fixtures")
SORT_COLUMNS = ENV['SORT'] != 'no'
MODEL_DIR = File.join(RAILS_ROOT, "app/models" )
UNIT_TEST_DIR = File.join(RAILS_ROOT, "test/unit" )
SPEC_MODEL_DIR = File.join(RAILS_ROOT, "spec/models")
FIXTURES_DIR = File.join(RAILS_ROOT, "test/fixtures")
SPEC_FIXTURES_DIR = File.join(RAILS_ROOT, "spec/fixtures")
SPEC_FACTORIES_DIR = File.join(RAILS_ROOT, "spec/factories")
SORT_COLUMNS = ENV['SORT'] != 'no'

module AnnotateModels

Expand Down Expand Up @@ -99,13 +100,14 @@ def self.annotate(klass, header)
fixtures_name = "#{klass.table_name}.yml"

[
File.join(MODEL_DIR, "#{model_name}.rb"), # model
File.join(UNIT_TEST_DIR, "#{model_name}_test.rb"), # test
File.join(FIXTURES_DIR, fixtures_name), # fixture
File.join(SPEC_MODEL_DIR, "#{model_name}_spec.rb"), # spec
File.join(SPEC_FIXTURES_DIR, fixtures_name), # spec fixture
File.join(RAILS_ROOT, 'test', 'factories.rb'), # factories file
File.join(RAILS_ROOT, 'spec', 'factories.rb'), # factories file
File.join(MODEL_DIR, "#{model_name}.rb"), # model
File.join(UNIT_TEST_DIR, "#{model_name}_test.rb"), # test
File.join(FIXTURES_DIR, fixtures_name), # fixture
File.join(SPEC_MODEL_DIR, "#{model_name}_spec.rb"), # spec
File.join(SPEC_FIXTURES_DIR, fixtures_name), # spec fixture
File.join(RAILS_ROOT, 'test', 'factories.rb'), # factories file
File.join(RAILS_ROOT, 'spec', 'factories.rb'), # factories file
File.join(SPEC_FACTORIES_DIR, "#{model_name.pluralize}.rb") # factories files
].each { |file| annotate_one_file(file, info) }
end

Expand Down

0 comments on commit ce53cbe

Please sign in to comment.