Skip to content

Commit

Permalink
Merge remote-tracking branch 'robertwahler/master' into development
Browse files Browse the repository at this point in the history
Conflicts:
	README.rdoc
	Rakefile
	annotate.gemspec
	bin/annotate
	lib/annotate/annotate_models.rb
	tasks/migrate.rake
  • Loading branch information
MrJoy committed Mar 1, 2012
2 parents 075c125 + 6311d7c commit 43520d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/annotate.rb
Expand Up @@ -11,7 +11,7 @@ def self.version
version = "0.0.0"
end
end

def self.load_tasks
if File.exists?('Rakefile')
require 'rake'
Expand Down
22 changes: 11 additions & 11 deletions lib/annotate/annotate_routes.rb
@@ -1,25 +1,25 @@
# == Annotate Routes
#
#
# Based on:
#
#
#
#
#
# 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.
#
#
# Running this task will replace any exising route comment generated by the task.
# Best to back up your routes file before running:
#
#
# Author:
# Gavin Montague
# gavin@leftbrained.co.uk
#
#
# Released under the same license as Ruby. No Support. No Warranty.module AnnotateRoutes
#
module AnnotateRoutes
module AnnotateRoutes
PREFIX = "#== Route Map"
def self.do_annotate

def self.do_annotate
routes_rb = File.join("config", "routes.rb")
header = PREFIX + "\n# Generated on #{Time.now.strftime("%d %b %Y %H:%M")}\n#"
if File.exists? routes_rb
Expand All @@ -29,8 +29,8 @@ def self.do_annotate
routes_map = routes_map.inject(header){|sum, line| sum<<"\n# "<<line}
content = File.read(routes_rb)
content, old = content.split(/^#== Route .*?\n/)
File.open(routes_rb, "wb") do |f|
f.puts content.sub!(/\n?\z/, "\n") + routes_map
File.open(routes_rb, "wb") do |f|
f.puts content.sub!(/\n?\z/, "\n") + routes_map
end
puts "Route file annotated."
else
Expand Down

0 comments on commit 43520d8

Please sign in to comment.