class Airbrussh::Configuration

Attributes

banner[RW]
color[RW]
command_output[RW]
context[RW]
log_file[RW]
monkey_patch_rake[RW]
task_prefix[RW]
truncate[RW]

Public Class Methods

new() click to toggle source
# File lib/airbrussh/configuration.rb, line 10
def initialize
  self.log_file = nil
  self.monkey_patch_rake = false
  self.color = :auto
  self.truncate = :auto
  self.banner = :auto
  self.command_output = false
  self.task_prefix = nil
  self.context = Airbrussh::Rake::Context
end

Public Instance Methods

apply_options(options) click to toggle source
# File lib/airbrussh/configuration.rb, line 21
def apply_options(options)
  return self if options.nil?

  options.each do |key, value|
    if respond_to?(writer = "#{key}=")
      public_send(writer, value)
    else
      warn_unrecognized_key(key)
    end
  end
  self
end
banner_message() click to toggle source
formatters(io) click to toggle source

This returns an array of formatters appropriate for the configuration. Depending on whether a log file is configured, this could be just the Airbrussh:ConsoleFormatter, or that plus the LogFileFormatter.

# File lib/airbrussh/configuration.rb, line 48
def formatters(io)
  fmts = [Airbrussh::ConsoleFormatter.new(io, self)]
  fmts.unshift(Airbrussh::LogFileFormatter.new(log_file)) if log_file
  fmts
end
show_command_output?(sym) click to toggle source
# File lib/airbrussh/configuration.rb, line 54
def show_command_output?(sym)
  command_output == true || Array(command_output).include?(sym)
end

Private Instance Methods

warn_unrecognized_key(key) click to toggle source
# File lib/airbrussh/configuration.rb, line 60
def warn_unrecognized_key(key)
  $stderr.puts("Ignoring unrecognized Airbrussh option: #{key}")
end