class Albacore::Application

Attributes

logger[R]

the logger instance for this application

output[R]

the output IO for this application, defaults to STDOUT

output_err[R]

the standard IO error output

Public Class Methods

new(log = STDOUT, output = STDOUT, output_err = STDERR) click to toggle source

initialize a new albacore application with a given log IO object

# File lib/albacore/application.rb, line 18
def initialize log = STDOUT, output = STDOUT, output_err = STDERR
  raise ArgumentError, "log must not be nil" unless log
  raise ArgumentError, "output must not be nil" unless output
  raise ArgumentError, "out_err must not be nil" unless output_err
  @logger = Logger.new log
  @logger.level = Logger::INFO
  @logger.formatter = proc do |severity, datetime, progname, msg|
    "#{severity[0]} #{datetime.to_datetime.iso8601(6)}: #{msg}\n"
  end
  @output = output
  @output_err = output_err
end

Public Instance Methods

define_task(*args, &block) click to toggle source
# File lib/albacore/application.rb, line 31
def define_task *args, &block
  Rake::Task.define_task *args, &block
end
err(*args) click to toggle source

write a line to stderr

# File lib/albacore/application.rb, line 41
def err *args
  @output_err.puts *args
end
puts(*args) click to toggle source

wite a line to stdout

# File lib/albacore/application.rb, line 36
def puts *args
  @output.puts *args 
end