class Glue::Reporters

Public Class Methods

add(klass) click to toggle source

Add a task. This will call klass.new when running tests

# File lib/glue/reporters.rb, line 5
def self.add klass
  @reporters << klass unless @reporters.include? klass
end
initialize_reporters(reporters_directory = "") click to toggle source
# File lib/glue/reporters.rb, line 13
def self.initialize_reporters reporters_directory = ""
  #Load all files in task_directory
  Dir.glob(File.join(reporters_directory, "*.rb")).sort.each do |f|
    require f
  end
end
new(options = { }) click to toggle source

No need to use this directly.

# File lib/glue/reporters.rb, line 21
def initialize options = { }
end
reporters() click to toggle source
# File lib/glue/reporters.rb, line 9
def self.reporters
  @reporters
end
run_report(tracker) click to toggle source

Run all the tasks on the given Tracker. Returns a new instance of tasks with the results.

# File lib/glue/reporters.rb, line 26
def self.run_report(tracker)
  @reporters.each do |c|
    reporter = c.new()
    if tracker.options[:output_format].first == reporter.format
      begin
        output = reporter.run_report(tracker)
        if tracker.options[:output_file]
          file = File.open(tracker.options[:output_file], 'w'){ |f| f.write(output)}
        else
          Glue.notify output unless tracker.options[:quiet]
        end
      rescue => e
        Glue.error e.message
        tracker.error e
      end
    end
  end
end