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
7b5d20d4
Commit
7b5d20d4
authored
Jan 11, 2016
by
Hasan Kumar Reddy A
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add :ignore_routes option to skip routes which should not be annotated based on regex
parent
25b6f3d6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
1 deletion
+12
-1
annotate
bin/annotate
+4
-0
annotate.rb
lib/annotate.rb
+1
-1
annotate_routes.rb
lib/annotate/annotate_routes.rb
+4
-0
auto_annotate_models.rake
lib/generators/annotate/templates/auto_annotate_models.rake
+1
-0
annotate_models.rake
lib/tasks/annotate_models.rake
+1
-0
annotate_routes.rake
lib/tasks/annotate_routes.rake
+1
-0
No files found.
bin/annotate
View file @
7b5d20d4
...
...
@@ -178,6 +178,10 @@ OptionParser.new do |opts|
ENV
[
'ignore_columns'
]
=
regex
end
opts
.
on
(
'--ignore-routes REGEX'
,
"don't annotate routes that match a given REGEX (i.e., `annotate -I '(mobile|resque|pghero)'`"
)
do
|
regex
|
ENV
[
'ignore_routes'
]
=
regex
end
opts
.
on
(
'--hide-limit-column-types VALUES'
,
"don't show limit for given column types, separated by comas (i.e., `integer,boolean,text`)"
)
do
|
values
|
ENV
[
'hide_limit_column_types'
]
=
"
#{
values
}
"
end
...
...
lib/annotate.rb
View file @
7b5d20d4
...
...
@@ -31,7 +31,7 @@ module Annotate
]
OTHER_OPTIONS
=
[
:ignore_columns
,
:skip_on_db_migrate
,
:wrapper_open
,
:wrapper_close
,
:wrapper
,
:routes
,
:hide_limit_column_types
,
:hide_limit_column_types
,
:ignore_routes
]
PATH_OPTIONS
=
[
:require
,
:model_dir
,
:root_dir
...
...
lib/annotate/annotate_routes.rb
View file @
7b5d20d4
...
...
@@ -32,6 +32,10 @@ module AnnotateRoutes
# keep the line around.
routes_map
.
shift
if
(
routes_map
.
first
=~
/^\(in \//
)
# Skip routes which match given regex
# Note: it matches the complete line (route_name, path, controller/action)
routes_map
.
reject!
{
|
line
|
line
.
match
(
/
#{
options
[
:ignore_routes
]
}
/
)}
if
options
[
:ignore_routes
]
header
=
[
"
#{
PREFIX
}
"
+
(
options
[
:timestamp
]
?
" (Updated
#{
Time
.
now
.
strftime
(
"%Y-%m-%d %H:%M"
)
}
)"
:
""
),
"#"
...
...
lib/generators/annotate/templates/auto_annotate_models.rake
View file @
7b5d20d4
...
...
@@ -29,6 +29,7 @@ if Rails.env.development?
'exclude_helpers'
=>
'false'
,
'ignore_model_sub_dir'
=>
'false'
,
'ignore_columns'
=>
nil
,
'ignore_routes'
=>
nil
,
'ignore_unknown_models'
=>
'false'
,
'hide_limit_column_types'
=>
'<%= AnnotateModels::NO_LIMIT_COL_TYPES.join('
,
') %>'
,
'skip_on_db_migrate'
=>
'false'
,
...
...
lib/tasks/annotate_models.rake
View file @
7b5d20d4
...
...
@@ -42,6 +42,7 @@ task :annotate_models => :environment do
options
[
:wrapper_open
]
=
Annotate
.
fallback
(
ENV
[
'wrapper_open'
],
ENV
[
'wrapper'
])
options
[
:wrapper_close
]
=
Annotate
.
fallback
(
ENV
[
'wrapper_close'
],
ENV
[
'wrapper'
])
options
[
:ignore_columns
]
=
ENV
.
fetch
(
'ignore_columns'
,
nil
)
options
[
:ignore_routes
]
=
ENV
.
fetch
(
'ignore_routes'
,
nil
)
AnnotateModels
.
do_annotations
(
options
)
end
...
...
lib/tasks/annotate_routes.rake
View file @
7b5d20d4
...
...
@@ -6,6 +6,7 @@ task :annotate_routes => :environment do
options
=
{}
ENV
[
'position'
]
=
options
[
:position
]
=
Annotate
.
fallback
(
ENV
[
'position'
],
'before'
)
options
[
:position_in_routes
]
=
Annotate
.
fallback
(
ENV
[
'position_in_routes'
],
ENV
[
'position'
])
options
[
:ignore_routes
]
=
Annotate
.
fallback
(
ENV
[
'ignore_routes'
],
nil
)
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
AnnotateRoutes
.
do_annotations
(
options
)
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