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
3c29b0ac
Commit
3c29b0ac
authored
Mar 01, 2012
by
Jon Frisby
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'benlangfeld/master' into development
Conflicts: annotate.gemspec bin/annotate lib/annotate/annotate_models.rb
parents
61b2574d
42515461
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
11 deletions
+22
-11
README.rdoc
README.rdoc
+1
-1
annotate_models
bin/annotate_models
+5
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+5
-1
auto_annotate_models.rake
...ators/annotate_models/templates/auto_annotate_models.rake
+10
-9
annotate_models.rake
lib/tasks/annotate_models.rake
+1
-0
No files found.
README.rdoc
View file @
3c29b0ac
...
@@ -101,11 +101,11 @@ anywhere in the file:
...
@@ -101,11 +101,11 @@ anywhere in the file:
-i, --show-indexes List the table's database indexes in the annotation
-i, --show-indexes List the table's database indexes in the annotation
-s, --simple-indexes Concat the column's related indexes in the annotation
-s, --simple-indexes Concat the column's related indexes in the annotation
--model-dir dir Annotate model files stored in dir rather than app/models
--model-dir dir Annotate model files stored in dir rather than app/models
--ignore-model-subdirs Ignore sub-directories of the models directory.
-R, --require path Additional files to require before loading models
-R, --require path Additional files to require before loading models
-e [tests,fixtures] Do not annotate fixtures/factories, and/or test files
-e [tests,fixtures] Do not annotate fixtures/factories, and/or test files
--exclude
--exclude
== WARNING
== WARNING
Note that this code will blow away the initial/final comment
Note that this code will blow away the initial/final comment
...
...
bin/annotate_models
View file @
3c29b0ac
...
@@ -50,6 +50,11 @@ OptionParser.new do |opts|
...
@@ -50,6 +50,11 @@ OptionParser.new do |opts|
ENV
[
'model_dir'
]
=
dir
ENV
[
'model_dir'
]
=
dir
end
end
opts
.
on
(
'--ignore-model-subdirects'
,
"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 @
3c29b0ac
...
@@ -257,7 +257,11 @@ module AnnotateModels
...
@@ -257,7 +257,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
options
[
: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
}
'."
...
...
lib/generators/annotate_models/templates/auto_annotate_models.rake
View file @
3c29b0ac
...
@@ -4,13 +4,14 @@
...
@@ -4,13 +4,14 @@
if
(
Rails
.
env
.
development?
)
if
(
Rails
.
env
.
development?
)
require
'annotate/tasks'
require
'annotate/tasks'
ENV
[
'position_in_class'
]
=
"before"
ENV
[
'position_in_class'
]
=
"before"
ENV
[
'position_in_fixture'
]
=
"before"
ENV
[
'position_in_fixture'
]
=
"before"
ENV
[
'position_in_factory'
]
=
"before"
ENV
[
'position_in_factory'
]
=
"before"
ENV
[
'show_indexes'
]
=
"true"
ENV
[
'show_indexes'
]
=
"true"
ENV
[
'include_version'
]
=
"false"
ENV
[
'include_version'
]
=
"false"
ENV
[
'exclude_tests'
]
=
"false"
ENV
[
'exclude_tests'
]
=
"false"
ENV
[
'exclude_fixtures'
]
=
"false"
ENV
[
'exclude_fixtures'
]
=
"false"
ENV
[
'skip_on_db_migrate'
]
=
"false"
ENV
[
'ignore_model_sub_dir'
]
=
"false"
ENV
[
'format_rdoc'
]
=
"false"
ENV
[
'skip_on_db_migrate'
]
=
"false"
ENV
[
'format_rdoc'
]
=
"false"
end
end
lib/tasks/annotate_models.rake
View file @
3c29b0ac
...
@@ -16,6 +16,7 @@ task :annotate_models => :environment do
...
@@ -16,6 +16,7 @@ task :annotate_models => :environment do
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
options
[
:exclude_tests
]
=
ENV
[
'exclude_tests'
]
=~
true_re
options
[
:exclude_tests
]
=
ENV
[
'exclude_tests'
]
=~
true_re
options
[
:exclude_fixtures
]
=
ENV
[
'exclude_fixtures'
]
=~
true_re
options
[
:exclude_fixtures
]
=
ENV
[
'exclude_fixtures'
]
=~
true_re
options
[
:ignore_model_sub_dir
]
=
ENV
[
'ignore_model_sub_dir'
]
=~
true_re
options
[
:format_rdoc
]
=
ENV
[
'format_rdoc'
]
=~
true_re
options
[
:format_rdoc
]
=
ENV
[
'format_rdoc'
]
=~
true_re
AnnotateModels
.
do_annotations
(
options
)
AnnotateModels
.
do_annotations
(
options
)
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