Skip to content
Browse files

Add task for adding template languages to all READMEs.

  • Loading branch information...
1 parent 4988126 commit 8753c6046b9f2ea39a0d3fedc35562dd5595e0f2 @rkh rkh committed Nov 5, 2010
Showing with 19 additions and 0 deletions.
  1. +19 −0 Rakefile
View
19 Rakefile
@@ -65,6 +65,25 @@ file 'doc/api/index.html' => FileList['lib/**/*.rb', 'README.*'] do |f|
end
CLEAN.include 'doc/api'
+# README ===============================================================
+task :add_template, [:name] do |t, args|
+ Dir.glob('README.*') do |file|
+ code = File.read(file)
+ if code =~ /^===.*#{args.name.capitalize}/
+ puts "Already covered in #{file}."
+ else
+ template = code[/===[^\n]*Liquid.*index\.liquid<\/tt>[^\n]*/m]
+ if !template
+ puts "Liquid not found in #{file}"
+ else
+ template = template.gsub(/Liquid/, args.name.capitalize).gsub(/liquid/, args.name.downcase)
+ code.gsub! '=== CoffeScript', template << "\n\n=== CoffeScript"
+ File.open(file, "w") { |f| f << code }
+ end
+ end
+ end
+end
+
# PACKAGING ============================================================
if defined?(Gem)

2 comments on commit 8753c60

@sr
Sinatra member
sr commented on 8753c60 Nov 5, 2010

haha, awesome :)

@rkh
Sinatra member
rkh commented on 8753c60 Nov 6, 2010

Wish I came up with this earlier.

Please sign in to comment.
Something went wrong with that request. Please try again.