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
4a8e2a03
Commit
4a8e2a03
authored
Apr 06, 2011
by
Ben Langfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the ability to ignore subdirectories of the models dir
parent
9c68c8c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
annotate
bin/annotate
+5
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+5
-1
No files found.
bin/annotate
View file @
4a8e2a03
...
@@ -48,6 +48,11 @@ OptionParser.new do |opts|
...
@@ -48,6 +48,11 @@ OptionParser.new do |opts|
ENV
[
'model_dir'
]
=
dir
ENV
[
'model_dir'
]
=
dir
end
end
opts
.
on
(
'--ignore-model-subdirectories'
,
"Ignore subdirectories of the models directory"
)
do
|
dir
|
ENV
[
'ignore_model_sub_dir'
]
=
"yes"
end
opts
.
on
(
'-R'
,
'--require path'
,
opts
.
on
(
'-R'
,
'--require path'
,
"Additional files to require before loading models"
)
do
|
path
|
"Additional files to require before loading models"
)
do
|
path
|
if
ENV
[
'require'
]
if
ENV
[
'require'
]
...
...
lib/annotate/annotate_models.rb
View file @
4a8e2a03
...
@@ -211,7 +211,11 @@ module AnnotateModels
...
@@ -211,7 +211,11 @@ module AnnotateModels
if
models
.
empty?
if
models
.
empty?
begin
begin
Dir
.
chdir
(
model_dir
)
do
Dir
.
chdir
(
model_dir
)
do
models
=
Dir
[
"**/*.rb"
]
models
=
if
ENV
[
'ignore_model_sub_dir'
]
Dir
[
"*.rb"
]
else
Dir
[
"**/*.rb"
]
end
end
end
rescue
SystemCallError
rescue
SystemCallError
puts
"No models found in directory '
#{
model_dir
}
'."
puts
"No models found in directory '
#{
model_dir
}
'."
...
...
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