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
67fd10c2
Commit
67fd10c2
authored
Feb 26, 2014
by
Cuong Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an option to exclude timestamp in routes, #136
parent
ecbd5fa6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
2 deletions
+13
-2
README.rdoc
README.rdoc
+1
-0
annotate
bin/annotate
+4
-0
annotate.rb
lib/annotate.rb
+1
-1
annotate_routes.rb
lib/annotate/annotate_routes.rb
+1
-1
annotate_routes_spec.rb
spec/annotate/annotate_routes_spec.rb
+6
-0
No files found.
README.rdoc
View file @
67fd10c2
...
...
@@ -179,6 +179,7 @@ you can do so with a simple environment variable, instead of editing the
--format
--force Force new annotations even if there are no changes.
--trace If unable to annotate a file, print the full stack trace, not just the exception message.
--no-timestamp Do not include an updated time in routes
== Sorting
...
...
bin/annotate
View file @
67fd10c2
...
...
@@ -132,6 +132,10 @@ OptionParser.new do |opts|
ENV
[
'force'
]
=
'yes'
end
opts
.
on
(
'--no-timestamp'
,
'Exclude timestamp in (routes) annotation'
)
do
ENV
[
'no_timestamp'
]
=
'true'
end
opts
.
on
(
'--trace'
,
'If unable to annotate a file, print the full stack trace, not just the exception message.'
)
do
|
value
|
ENV
[
'trace'
]
=
'yes'
end
...
...
lib/annotate.rb
View file @
67fd10c2
...
...
@@ -22,7 +22,7 @@ module Annotate
FLAG_OPTIONS
=
[
:show_indexes
,
:simple_indexes
,
:include_version
,
:exclude_tests
,
:exclude_fixtures
,
:exclude_factories
,
:ignore_model_sub_dir
,
:format_bare
,
:format_rdoc
,
:format_markdown
,
:sort
,
:force
,
:trace
,
:format_bare
,
:format_rdoc
,
:format_markdown
,
:sort
,
:force
,
:trace
,
:no_timestamp
]
OTHER_OPTIONS
=
[
:model_dir
,
:ignore_columns
...
...
lib/annotate/annotate_routes.rb
View file @
67fd10c2
...
...
@@ -33,7 +33,7 @@ module AnnotateRoutes
routes_map
.
shift
if
(
routes_map
.
first
=~
/^\(in \//
)
header
=
[
"
#{
PREFIX
}
(Updated
#{
Time
.
now
.
strftime
(
"%Y-%m-%d %H:%M"
)
}
)"
,
"
#{
PREFIX
}
"
+
(
options
[
:no_timestamp
]
?
""
:
" (Updated
#{
Time
.
now
.
strftime
(
"%Y-%m-%d %H:%M"
)
}
)"
)
,
"#"
]
+
routes_map
.
map
{
|
line
|
"#
#{
line
}
"
.
rstrip
}
...
...
spec/annotate/annotate_routes_spec.rb
View file @
67fd10c2
...
...
@@ -57,6 +57,12 @@ describe AnnotateRoutes do
AnnotateRoutes
.
do_annotations
end
it
"should not add a timestamp when :no-timestamp is passed"
do
File
.
should_receive
(
:read
).
with
(
"config/routes.rb"
).
and_return
(
"ActionController::Routing...
\n
foo
\n
"
)
@mock_file
.
should_receive
(
:puts
).
with
(
/ActionController::Routing...\nfoo\n\n# == Route Map\n#\n# another good line\n# good line\n/
)
AnnotateRoutes
.
do_annotations
:no_timestamp
=>
true
end
end
describe
"When Removing Annotation"
do
...
...
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