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
2957837b
Commit
2957837b
authored
Dec 20, 2011
by
Ian Duggan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for Fabrication fabricators
parent
672a22ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
annotate_models.rb
lib/annotate/annotate_models.rb
+6
-1
No files found.
lib/annotate/annotate_models.rb
View file @
2957837b
...
@@ -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