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
9407dc67
Commit
9407dc67
authored
Mar 07, 2015
by
cuong.tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #214 where annotation for a single model is broken
parent
d260a199
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
annotate_models.rb
lib/annotate/annotate_models.rb
+14
-12
No files found.
lib/annotate/annotate_models.rb
View file @
9407dc67
...
...
@@ -344,28 +344,27 @@ module AnnotateModels
options
.
merge
(
:position
=>
(
options
[
position_in
]
||
options
[
:position
]))
end
# Return a list of the model files to annotate. If we have
# command line arguments, they're assumed to be either
# the underscore or CamelCase versions of model names.
# Otherwise we take all the model files in the
# model_dir directory.
# Return a list of the model files to annotate.
# If we have command line arguments, they're assumed to the path
# of model files from root dir. Otherwise we take all the model files
# in the model_dir directory.
def
get_model_files
(
options
)
if
(
!
options
[
:is_rake
])
models
=
ARGV
.
dup
models
.
shift
else
models
=
[]
if
(
!
options
[
:is_rake
])
models
=
ARGV
.
dup
.
reject
{
|
m
|
m
.
match
(
/^(.*)=/
)}
end
models
.
reject!
{
|
m
|
m
.
match
(
/^(.*)=/
)}
if
models
.
empty?
begin
model_dir
.
each
do
|
dir
|
Dir
.
chdir
(
dir
)
do
models
.
concat
(
if
options
[
:ignore_model_sub_dir
]
lst
=
if
options
[
:ignore_model_sub_dir
]
Dir
[
"*.rb"
].
map
{
|
f
|
[
dir
,
f
]
}
else
Dir
[
"**/*.rb"
].
reject
{
|
f
|
f
[
"concerns/"
]
}.
map
{
|
f
|
[
dir
,
f
]
}
end
)
end
models
.
concat
(
lst
)
end
end
rescue
SystemCallError
...
...
@@ -375,6 +374,9 @@ module AnnotateModels
exit
1
end
end
puts
"MODELS:
#{
models
}
"
models
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