Sha256: 15b07c54945e424d7239766a9a683b9eea3463681618cabb622c361d4242c9ad

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 Bytes

Contents

require 'rake'
module Albacore
  class Application

    # the logger instance for this application
    attr_reader :logger

    # the output IO for this application, defaults to
    # STDOUT
    attr_reader :output
    
    # initialize a new albacore application with a given log IO object
    def initialize log = STDOUT, output = STDOUT
      raise ArgumentError, "log must not be nil" if log.nil?
      raise ArgumentError, "output must not be nil" if output.nil?
      @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
    end

    def define_task *args, &block
      Rake::Task.define_task *args, &block
    end

    def puts *args
      @output.puts *args 
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.6.2.rc1 lib/albacore/application.rb