Commit 02def679 by Cuong Tran

Merge pull request #64 from ijcd/fabrication

Add support for Fabrication fabricators (by ijcd)
parents 672a22ab 2b29aa1a
...@@ -7,6 +7,7 @@ Add a comment summarizing the current schema to the top or bottom of each of you ...@@ -7,6 +7,7 @@ Add a comment summarizing the current schema to the top or bottom of each of you
* Tests and Specs * Tests and Specs
* Object Daddy exemplars * Object Daddy exemplars
* Machinist blueprints * Machinist blueprints
* Fabrication fabricators
The schema comment looks like this: The schema comment looks like this:
...@@ -113,6 +114,8 @@ to an automatically created comment block. ...@@ -113,6 +114,8 @@ to an automatically created comment block.
* Factory Girl => http://github.com/thoughtbot/factory_girl (NOT IMPLEMENTED) * Factory Girl => http://github.com/thoughtbot/factory_girl (NOT IMPLEMENTED)
* Object Daddy => http://github.com/flogic/object_daddy * Object Daddy => http://github.com/flogic/object_daddy
* Machinist => http://github.com/notahat/machinist
* Fabrication => http://github.com/paulelliott/fabrication
* SpatialAdapter => http://github.com/pdeffendol/spatial_adapter * SpatialAdapter => http://github.com/pdeffendol/spatial_adapter
* PostgisAdapter => http://github.com/nofxx/postgis_adapter * PostgisAdapter => http://github.com/nofxx/postgis_adapter
...@@ -142,5 +145,6 @@ Modifications by: ...@@ -142,5 +145,6 @@ Modifications by:
- Bob Potter - http://github.com/bpot - Bob Potter - http://github.com/bpot
- Gavin Montague - http://github.com/govan/ - Gavin Montague - http://github.com/govan/
- Alexander Semyonov - http://github.com/rotuka/ - Alexander Semyonov - http://github.com/rotuka/
- Ian Duggan http://github.com/ijcd/
and many others that I may have missed to add. and many others that I may have missed to add.
...@@ -17,6 +17,9 @@ module AnnotateModels ...@@ -17,6 +17,9 @@ module AnnotateModels
# FactoryGirl http://github.com/thoughtbot/factory_girl # FactoryGirl http://github.com/thoughtbot/factory_girl
FACTORIES_TEST_DIR = File.join("test", "factories") FACTORIES_TEST_DIR = File.join("test", "factories")
FACTORIES_SPEC_DIR = File.join("spec", "factories") FACTORIES_SPEC_DIR = File.join("spec", "factories")
# Fabrication https://github.com/paulelliott/fabrication.git
FABRICATORS_TEST_DIR = File.join("test", "fabricators")
FABRICATORS_SPEC_DIR = File.join("spec", "fabricators")
def model_dir def model_dir
...@@ -169,7 +172,7 @@ module AnnotateModels ...@@ -169,7 +172,7 @@ module AnnotateModels
# of the model and fixture source files. # of the model and fixture source files.
# Returns true or false depending on whether the source # Returns true or false depending on whether the source
# files were modified. # files were modified.
def annotate(klass, file, header,options={}) def annotate(klass, file, header, options={})
info = get_schema_info(klass, header, options) info = get_schema_info(klass, header, options)
annotated = false annotated = false
model_name = klass.name.underscore model_name = klass.name.underscore
...@@ -198,6 +201,8 @@ module AnnotateModels ...@@ -198,6 +201,8 @@ module AnnotateModels
File.join(BLUEPRINTS_DIR, "#{model_name}_blueprint.rb"), # Machinist Blueprints File.join(BLUEPRINTS_DIR, "#{model_name}_blueprint.rb"), # Machinist Blueprints
File.join(FACTORIES_TEST_DIR, "#{model_name.pluralize}.rb"), # FactoryGirl Factories File.join(FACTORIES_TEST_DIR, "#{model_name.pluralize}.rb"), # FactoryGirl Factories
File.join(FACTORIES_SPEC_DIR, "#{model_name.pluralize}.rb"), # FactoryGirl Factories File.join(FACTORIES_SPEC_DIR, "#{model_name.pluralize}.rb"), # FactoryGirl Factories
File.join(FABRICATORS_TEST_DIR, "#{model_name}_fabricator.rb"), # Fabrication Fabricators
File.join(FABRICATORS_SPEC_DIR, "#{model_name}_fabricator.rb"), # Fabrication Fabricators
].each do |file| ].each do |file|
if annotate_one_file(file, info, options_with_position(options, :position_in_fixture)) if annotate_one_file(file, info, options_with_position(options, :position_in_fixture))
annotated = true annotated = true
......
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