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
b006985c
Commit
b006985c
authored
Aug 22, 2012
by
Jon Frisby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make -R work for all four task types.
parent
69cd69cb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
0 deletions
+21
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+6
-0
annotate_routes.rb
lib/annotate/annotate_routes.rb
+12
-0
annotate_models.rake
lib/tasks/annotate_models.rake
+1
-0
annotate_routes.rake
lib/tasks/annotate_routes.rake
+2
-0
No files found.
lib/annotate/annotate_models.rb
View file @
b006985c
...
@@ -407,6 +407,12 @@ module AnnotateModels
...
@@ -407,6 +407,12 @@ module AnnotateModels
end
end
def
remove_annotations
(
options
=
{})
def
remove_annotations
(
options
=
{})
if
options
[
:require
]
options
[
:require
].
each
do
|
path
|
require
path
end
end
self
.
model_dir
=
options
[
:model_dir
]
if
options
[
:model_dir
]
self
.
model_dir
=
options
[
:model_dir
]
if
options
[
:model_dir
]
deannotated
=
[]
deannotated
=
[]
deannotated_klass
=
false
deannotated_klass
=
false
...
...
lib/annotate/annotate_routes.rb
View file @
b006985c
...
@@ -23,6 +23,12 @@ module AnnotateRoutes
...
@@ -23,6 +23,12 @@ module AnnotateRoutes
def
self
.
do_annotate
(
options
=
{})
def
self
.
do_annotate
(
options
=
{})
return
unless
(
routes_exists?
)
return
unless
(
routes_exists?
)
if
options
[
:require
]
options
[
:require
].
each
do
|
path
|
require
path
end
end
position_after
=
options
[
:position_in_routes
]
!=
'before'
position_after
=
options
[
:position_in_routes
]
!=
'before'
routes_map
=
`rake routes`
.
split
(
/\n/
,
-
1
)
routes_map
=
`rake routes`
.
split
(
/\n/
,
-
1
)
...
@@ -68,6 +74,12 @@ module AnnotateRoutes
...
@@ -68,6 +74,12 @@ module AnnotateRoutes
def
self
.
remove_annotations
(
options
=
{})
def
self
.
remove_annotations
(
options
=
{})
return
unless
(
routes_exists?
)
return
unless
(
routes_exists?
)
if
options
[
:require
]
options
[
:require
].
each
do
|
path
|
require
path
end
end
(
content
,
where_header_found
)
=
strip_annotations
(
File
.
read
(
routes_file
))
(
content
,
where_header_found
)
=
strip_annotations
(
File
.
read
(
routes_file
))
content
=
strip_on_removal
(
content
,
where_header_found
)
content
=
strip_on_removal
(
content
,
where_header_found
)
...
...
lib/tasks/annotate_models.rake
View file @
b006985c
...
@@ -44,6 +44,7 @@ task :remove_annotation => :environment do
...
@@ -44,6 +44,7 @@ task :remove_annotation => :environment do
options
=
{
:is_rake
=>
true
}
options
=
{
:is_rake
=>
true
}
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
options
[
:trace
]
=
ENV
[
'trace'
]
=~
true_re
options
[
:trace
]
=
ENV
[
'trace'
]
=~
true_re
AnnotateModels
.
remove_annotations
(
options
)
AnnotateModels
.
remove_annotations
(
options
)
end
end
lib/tasks/annotate_routes.rake
View file @
b006985c
...
@@ -5,6 +5,7 @@ task :annotate_routes => :environment do
...
@@ -5,6 +5,7 @@ task :annotate_routes => :environment do
options
=
{}
options
=
{}
options
[
:position_in_routes
]
=
ENV
[
'position_in_routes'
]
||
ENV
[
'position'
]
||
'after'
options
[
:position_in_routes
]
=
ENV
[
'position_in_routes'
]
||
ENV
[
'position'
]
||
'after'
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
AnnotateRoutes
.
do_annotate
(
options
)
AnnotateRoutes
.
do_annotate
(
options
)
end
end
...
@@ -14,5 +15,6 @@ task :remove_routes => :environment do
...
@@ -14,5 +15,6 @@ task :remove_routes => :environment do
require
"
#{
annotate_lib
}
/annotate/annotate_routes"
require
"
#{
annotate_lib
}
/annotate/annotate_routes"
options
=
{}
options
=
{}
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
AnnotateRoutes
.
remove_annotations
(
options
)
AnnotateRoutes
.
remove_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