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
77a47502
Commit
77a47502
authored
Nov 21, 2009
by
Nathan Brazil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for spec/factories/<model>_factory.rb files.
parent
dcd4ba6d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
6 deletions
+13
-6
History.txt
History.txt
+4
-0
README.rdoc
README.rdoc
+1
-1
VERSION.yml
VERSION.yml
+1
-1
annotate.gemspec
annotate.gemspec
+1
-1
annotate_models.rb
lib/annotate/annotate_models.rb
+6
-3
No files found.
History.txt
View file @
77a47502
== 2.4.2 2009-11-21
* Annotates (spec|test)/factories/<model>_factory.rb files
== 2.4.1 2009-11-20
== 2.4.1 2009-11-20
* Annotates thoughtbot's factory_girl factories (test/factories/<model>_factory.rb)
* Annotates thoughtbot's factory_girl factories (test/factories/<model>_factory.rb)
...
...
README.rdoc
View file @
77a47502
...
@@ -7,7 +7,7 @@ Add a comment summarizing the current schema to the top or bottom of each of you
...
@@ -7,7 +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
* Thoughtbot's factory_girl factories
(test/factories/<model>_factory.rb files)
* Thoughtbot's factory_girl factories
, i.e. the (spec|test)/factories/<model>_factory.rb files
The schema comment looks like this:
The schema comment looks like this:
...
...
VERSION.yml
View file @
77a47502
---
---
:major
:
2
:major
:
2
:minor
:
4
:minor
:
4
:patch
:
1
:patch
:
2
annotate.gemspec
View file @
77a47502
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
Gem
::
Specification
.
new
do
|
s
|
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
%q{annotate}
s
.
name
=
%q{annotate}
s
.
version
=
"2.4.
1
"
s
.
version
=
"2.4.
2
"
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
authors
=
[
"Cuong Tran"
,
"Alex Chaffee"
,
"Marcos Piccinini"
]
s
.
authors
=
[
"Cuong Tran"
,
"Alex Chaffee"
,
"Marcos Piccinini"
]
...
...
lib/annotate/annotate_models.rb
View file @
77a47502
...
@@ -15,7 +15,8 @@ module AnnotateModels
...
@@ -15,7 +15,8 @@ module AnnotateModels
# Machinist http://github.com/notahat/machinist
# Machinist http://github.com/notahat/machinist
BLUEPRINTS_DIR
=
File
.
join
(
"test"
,
"blueprints"
)
BLUEPRINTS_DIR
=
File
.
join
(
"test"
,
"blueprints"
)
# Factory Girl http://github.com/thoughtbot/factory_girl
# Factory Girl http://github.com/thoughtbot/factory_girl
FACTORIES_DIR
=
File
.
join
(
"test"
,
"factories"
)
SPEC_FACTORIES_DIR
=
File
.
join
(
"spec"
,
"factories"
)
TEST_FACTORIES_DIR
=
File
.
join
(
"test"
,
"factories"
)
def
model_dir
def
model_dir
@model_dir
||
"app/models"
@model_dir
||
"app/models"
...
@@ -195,7 +196,8 @@ module AnnotateModels
...
@@ -195,7 +196,8 @@ module AnnotateModels
unless
ENV
[
'exclude_factories'
]
unless
ENV
[
'exclude_factories'
]
[
[
File
.
join
(
FACTORIES_DIR
,
"
#{
model_name
}
_factory.rb"
),
# test/factories
File
.
join
(
SPEC_FACTORIES_DIR
,
"
#{
model_name
}
_factory.rb"
),
# spec/factories
File
.
join
(
TEST_FACTORIES_DIR
,
"
#{
model_name
}
_factory.rb"
),
# test/factories
].
each
do
|
file
|
].
each
do
|
file
|
annotate_one_file
(
file
,
info
,
options_with_position
(
options
,
:position_in_factory
))
annotate_one_file
(
file
,
info
,
options_with_position
(
options
,
:position_in_factory
))
end
end
...
@@ -319,7 +321,8 @@ module AnnotateModels
...
@@ -319,7 +321,8 @@ module AnnotateModels
remove_annotation_of_file
(
file
)
if
File
.
exist?
(
file
)
remove_annotation_of_file
(
file
)
if
File
.
exist?
(
file
)
end
end
[
File
.
join
(
FACTORIES_DIR
,
"
#{
klass
.
name
.
underscore
}
_factory.rb"
)].
each
do
|
file
|
[
File
.
join
(
SPEC_FACTORIES_DIR
,
"
#{
klass
.
name
.
underscore
}
_factory.rb"
),
File
.
join
(
TEST_FACTORIES_DIR
,
"
#{
klass
.
name
.
underscore
}
_factory.rb"
)].
each
do
|
file
|
remove_annotation_of_file
(
file
)
if
File
.
exist?
(
file
)
remove_annotation_of_file
(
file
)
if
File
.
exist?
(
file
)
end
end
...
...
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