Skip to content

Commit

Permalink
Add task for adding template languages to all READMEs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Nov 5, 2010
1 parent 4988126 commit 8753c60
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Rakefile
Expand Up @@ -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)
Expand Down

2 comments on commit 8753c60

@sr
Copy link
Member

@sr sr commented on 8753c60 Nov 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, awesome :)

@rkh
Copy link
Member Author

@rkh rkh commented on 8753c60 Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wish I came up with this earlier.

Please sign in to comment.