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
43520d82
Commit
43520d82
authored
Mar 01, 2012
by
Jon Frisby
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'robertwahler/master' into development
Conflicts: README.rdoc Rakefile annotate.gemspec bin/annotate lib/annotate/annotate_models.rb tasks/migrate.rake
parents
075c125e
6311d7c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
annotate.rb
lib/annotate.rb
+1
-1
annotate_routes.rb
lib/annotate/annotate_routes.rb
+11
-11
No files found.
lib/annotate.rb
View file @
43520d82
...
@@ -11,7 +11,7 @@ module Annotate
...
@@ -11,7 +11,7 @@ module Annotate
version
=
"0.0.0"
version
=
"0.0.0"
end
end
end
end
def
self
.
load_tasks
def
self
.
load_tasks
if
File
.
exists?
(
'Rakefile'
)
if
File
.
exists?
(
'Rakefile'
)
require
'rake'
require
'rake'
...
...
lib/annotate/annotate_routes.rb
View file @
43520d82
# == Annotate Routes
# == Annotate Routes
#
#
# Based on:
# Based on:
#
#
#
#
#
#
# Prepends the output of "rake routes" to the top of your routes.rb file.
# Prepends the output of "rake routes" to the top of your routes.rb file.
# Yes, it's simple but I'm thick and often need a reminder of what my routes mean.
# Yes, it's simple but I'm thick and often need a reminder of what my routes mean.
#
#
# Running this task will replace any exising route comment generated by the task.
# Running this task will replace any exising route comment generated by the task.
# Best to back up your routes file before running:
# Best to back up your routes file before running:
#
#
# Author:
# Author:
# Gavin Montague
# Gavin Montague
# gavin@leftbrained.co.uk
# gavin@leftbrained.co.uk
#
#
# Released under the same license as Ruby. No Support. No Warranty.module AnnotateRoutes
# Released under the same license as Ruby. No Support. No Warranty.module AnnotateRoutes
#
#
module
AnnotateRoutes
module
AnnotateRoutes
PREFIX
=
"#== Route Map"
PREFIX
=
"#== Route Map"
def
self
.
do_annotate
def
self
.
do_annotate
routes_rb
=
File
.
join
(
"config"
,
"routes.rb"
)
routes_rb
=
File
.
join
(
"config"
,
"routes.rb"
)
header
=
PREFIX
+
"
\n
# Generated on
#{
Time
.
now
.
strftime
(
"%d %b %Y %H:%M"
)
}
\n
#"
header
=
PREFIX
+
"
\n
# Generated on
#{
Time
.
now
.
strftime
(
"%d %b %Y %H:%M"
)
}
\n
#"
if
File
.
exists?
routes_rb
if
File
.
exists?
routes_rb
...
@@ -29,8 +29,8 @@ module AnnotateRoutes
...
@@ -29,8 +29,8 @@ module AnnotateRoutes
routes_map
=
routes_map
.
inject
(
header
){
|
sum
,
line
|
sum
<<
"
\n
# "
<<
line
}
routes_map
=
routes_map
.
inject
(
header
){
|
sum
,
line
|
sum
<<
"
\n
# "
<<
line
}
content = File.read(routes_rb)
content = File.read(routes_rb)
content, old = content.split(/^#== Route .*?
\n
/)
content, old = content.split(/^#== Route .*?
\n
/)
File.open(routes_rb, "wb") do |f|
File.open(routes_rb, "wb") do |f|
f.puts content.sub!(/
\n
?
\z
/, "
\n
") + routes_map
f.puts content.sub!(/
\n
?
\z
/, "
\n
") + routes_map
end
end
puts "Route file annotated."
puts "Route file annotated."
else
else
...
...
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