Report abuse


			
namespace :git do

  desc "Help"
  task :help do
    puts "Use :to_changelog in the following way:"
    puts "  sake git:to_changelog "
    puts "This will read all commit messages from the"
    puts "logs and write them to a CHANGELOG file. "
    puts "Besides this you can use the following options"
    puts "to redefine the task."
    puts ""
    puts "NAME   = name of the file to use"
    puts "FORMAT = specify a format according git-log(1)"
    puts "SPAN   = determine a time span for which the log"
    puts "         should be printed. Defaults to all "
    puts "         messages"
  end

  desc "Write the commit messages to CHANGELOG"
  task :to_changelog do
    name = ENV["NAME"] || "CHANGELOG"
    format = "format:" + ENV["FORMAT"] || "%s"
    span = "" || ENV["SPAN"]
    system("git log --pretty=\"#{format}\" #{span} >#{name}")
  end

end