Class: Pipeline::Reporters
- Inherits:
-
Object
- Object
- Pipeline::Reporters
- Defined in:
- lib/pipeline/reporters.rb
Class Method Summary collapse
-
.add(klass) ⇒ Object
Add a task.
- .initialize_reporters(reporters_directory = "") ⇒ Object
- .reporters ⇒ Object
-
.run_report(tracker) ⇒ Object
Run all the tasks on the given Tracker.
Instance Method Summary collapse
-
#initialize(options = { }) ⇒ Reporters
constructor
No need to use this directly.
Constructor Details
#initialize(options = { }) ⇒ Reporters
No need to use this directly.
21 22 |
# File 'lib/pipeline/reporters.rb', line 21 def initialize = { } end |
Class Method Details
.add(klass) ⇒ Object
Add a task. This will call klass.new
when running tests
5 6 7 |
# File 'lib/pipeline/reporters.rb', line 5 def self.add klass @reporters << klass unless @reporters.include? klass end |
.initialize_reporters(reporters_directory = "") ⇒ Object
13 14 15 16 17 18 |
# File 'lib/pipeline/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 |
.reporters ⇒ Object
9 10 11 |
# File 'lib/pipeline/reporters.rb', line 9 def self.reporters @reporters end |
.run_report(tracker) ⇒ Object
Run all the tasks on the given Tracker. Returns a new instance of tasks with the results.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/pipeline/reporters.rb', line 26 def self.run_report(tracker) @reporters.each do |c| reporter = c.new() if tracker.[:output_format].first == reporter.format begin output = reporter.run_report(tracker) if tracker.[:output_file] file = File.open(tracker.[:output_file], 'w'){ |f| f.write(output)} else Pipeline.notify output unless tracker.[:quiet] end rescue => e Pipeline.error e. tracker.error e end end end end |