Report abuse

annotate.rake


			
require 'lib/hodel_3000_compliant_logger'

namespace :log do
  desc "Annotate the logfile with a message. Options LOGFILE=xxx, MSG=xxx"
  task :annotate do
    logfile = ENV['LOGFILE'] || "log/production.log"
    puts "annotating #{logfile} with #{ENV['MSG']}"
    logger = Hodel3000CompliantLogger.new(logfile)
    logger.debug "ANN_#{ENV['MSG'].to_s} (at #{Time.now.strftime("%Y-%m-%d %H:%M:%S")})"
  end
end

rake.rb


			
namespace :rake do
  desc "Show rake tasks available on the remote server."
  task :show_tasks, :roles => :web do
    run("cd #{deploy_to}/current; /usr/bin/rake -T")
  end

  namespace :log do
    desc "Annotate the remote production log file."
    task :annotate, :roles => :web do
      msg = ENV["MSG"] || "Bookmark"
      msg = msg.gsub("\"", "") # Get rid of unsafe characters.
      run("cd #{deploy_to}/current; /usr/bin/rake log:annotate MSG=\"#{msg}\"")
    end
  end
end