Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
02def679
Commit
02def679
authored
Dec 20, 2011
by
Cuong Tran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #64 from ijcd/fabrication
Add support for Fabrication fabricators (by ijcd)
parents
672a22ab
2b29aa1a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
README.rdoc
README.rdoc
+4
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+6
-1
No files found.
README.rdoc
View file @
02def679
...
@@ -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.
lib/annotate/annotate_models.rb
View file @
02def679
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment