Sha256: d3afa680cd3511430a5ffaed03dda433ba821505ec015f8a11a476809bb96c8b

Contents?: true

Size: 1.15 KB

Versions: 66

Compression:

Stored size: 1.15 KB

Contents

require 'rake'
require 'time'

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

    # the standard IO error output
    attr_reader :output_err

    # initialize a new albacore application with a given log IO object
    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

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

    # wite a line to stdout
    def puts *args
      @output.puts *args 
    end

    # write a line to stderr
    def err *args
      @output_err.puts *args
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
albacore-3.0.1 ./lib/albacore/application.rb
albacore-3.0.0.pre.alpha.6 ./lib/albacore/application.rb
albacore-3.0.0.pre.alpha.5 ./lib/albacore/application.rb
albacore-3.0.0.pre.alpha.4 ./lib/albacore/application.rb
albacore-3.0.0.pre.alpha.3 ./lib/albacore/application.rb
albacore-3.0.0.pre.alpha.2 ./lib/albacore/application.rb
albacore-3.0.0.pre.alpha ./lib/albacore/application.rb
albacore-2.8.0 ./lib/albacore/application.rb
albacore-2.7.0 ./lib/albacore/application.rb
albacore-2.6.8 ./lib/albacore/application.rb
albacore-2.6.7 ./lib/albacore/application.rb
albacore-2.6.6 ./lib/albacore/application.rb
albacore-2.6.4 ./lib/albacore/application.rb
albacore-2.6.3 ./lib/albacore/application.rb
albacore-2.6.2 ./lib/albacore/application.rb
albacore-2.6.1 ./lib/albacore/application.rb
albacore-2.6.0 ./lib/albacore/application.rb
albacore-2.5.14 ./lib/albacore/application.rb
albacore-2.5.13 ./lib/albacore/application.rb
albacore-2.5.11 ./lib/albacore/application.rb