Class: GunterReporter
- Inherits:
-
Object
- Object
- GunterReporter
- Defined in:
- lib/gunter_reporter.rb,
lib/gunter_reporter/version.rb
Constant Summary collapse
- VERSION =
"0.1.10"
Instance Method Summary collapse
- #clear_results ⇒ Object
-
#initialize ⇒ GunterReporter
constructor
A new instance of GunterReporter.
- #submit_results(environment_variables) ⇒ Object
Constructor Details
#initialize ⇒ GunterReporter
Returns a new instance of GunterReporter.
10 11 12 13 |
# File 'lib/gunter_reporter.rb', line 10 def initialize clear_results build_data end |
Instance Method Details
#clear_results ⇒ Object
15 16 17 |
# File 'lib/gunter_reporter.rb', line 15 def clear_results FileUtils.rm_r(Dir.glob('tmp/gunter')) end |
#submit_results(environment_variables) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gunter_reporter.rb', line 19 def submit_results(environment_variables) files = Dir.glob("tmp/gunter/#{environment_variables['TASK_ID']}/*") responses = files.map do |file| report = File.read(file) next unless XmlSimple.xml_in(report).key?('testcase') || XmlSimple.xml_in(report).dig('testsuite', 0, 'testcase') form_data = environment_variables.merge(build_data).merge('report' => report) response = submit_result(form_data) print_result(response) response end response_body = responses.first&.body || '{}' JSON.parse(response_body) end |