Class: Licensed::Reporters::StatusReporter
- Defined in:
- lib/licensed/reporters/status_reporter.rb
Instance Method Summary collapse
-
#begin_report_app(app, report) ⇒ Object
Reports the start of checking records for an app.
-
#end_report_app(app, report) ⇒ Object
Reports any errors found when checking status, as well as overall number of dependencies checked.
-
#end_report_command(command, report) ⇒ Object
Reports any errors encountered at the command level.
-
#end_report_dependency(dependency, report) ⇒ Object
Reports whether the dependency’s status is valid in dot format.
Methods inherited from Reporter
#begin_report_command, #begin_report_dependency, #begin_report_source, #end_report_source, #initialize
Constructor Details
This class inherits a constructor from Licensed::Reporters::Reporter
Instance Method Details
#begin_report_app(app, report) ⇒ Object
Reports the start of checking records for an app
app - An application configuration report - A report containing information about the app evaluation
21 22 23 |
# File 'lib/licensed/reporters/status_reporter.rb', line 21 def begin_report_app(app, report) shell.info "Checking cached dependency records for #{app["name"]}" end |
#end_report_app(app, report) ⇒ Object
Reports any errors found when checking status, as well as overall number of dependencies checked
app - An application configuration report - A report containing information about the app evaluation
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/licensed/reporters/status_reporter.rb', line 30 def end_report_app(app, report) all_reports = report.all_reports warning_reports = all_reports.select { |r| r.warnings.any? }.to_a if warning_reports.any? shell.newline shell.warn "Warnings:" warning_reports.each do |r| = r.map { |k, v| "#{k}: #{v}" }.join(", ") shell.warn "* #{r.name}" shell.warn " #{}" unless .empty? r.warnings.each do |warning| shell.warn " - #{warning}" end shell.newline end end errored_reports = all_reports.select { |r| r.errors.any? }.to_a dependency_count = all_reports.count { |r| r.target.is_a?(Licensed::Dependency) } error_count = errored_reports.reduce(0) { |count, r| count + r.errors.size } if error_count > 0 shell.newline shell.error "Errors:" errored_reports.each do |r| = r.map { |k, v| "#{k}: #{v}" }.join(", ") shell.error "* #{r.name}" shell.error " #{}" unless .empty? r.errors.each do |error| shell.error " - #{error}" end shell.newline end end shell.newline shell.info "#{dependency_count} dependencies checked, #{error_count} errors found." end |
#end_report_command(command, report) ⇒ Object
Reports any errors encountered at the command level
command - The command being run report - A report object containing information about the command run
10 11 12 13 14 15 |
# File 'lib/licensed/reporters/status_reporter.rb', line 10 def end_report_command(command, report) if report.errors.any? shell.newline report.errors.each { |e| shell.error e } end end |
#end_report_dependency(dependency, report) ⇒ Object
Reports whether the dependency’s status is valid in dot format
dependency - An application dependency report - A report containing information about the dependency evaluation
77 78 79 80 81 82 83 |
# File 'lib/licensed/reporters/status_reporter.rb', line 77 def end_report_dependency(dependency, report) if report.errors.empty? shell.confirm(".", false) else shell.error("F", false) end end |