From 1cf11cb47397a50689a7f606d424c912e86c2ede Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Fri, 5 Nov 2010 13:57:03 +0100 Subject: [PATCH] Fix add_template rake task. --- Rakefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 6a60347c..c6737d15 100644 --- a/Rakefile +++ b/Rakefile @@ -70,14 +70,15 @@ 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}." + 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" + puts "Adding section to #{file}" + template = template.gsub(/Liquid/, args.name.capitalize).gsub(/liquid/, args.name.downcase) + code.gsub! /^(\s*===.*CoffeeScript)/, template << "\n\\1" File.open(file, "w") { |f| f << code } end end