Class: BBC::A11y::CLI
- Inherits:
-
Object
- Object
- BBC::A11y::CLI
- Defined in:
- lib/bbc/a11y/cli.rb
Instance Method Summary collapse
- #all_pages_tested(summary) ⇒ Object
- #call ⇒ Object
-
#initialize(stdin, stdout, stderr, args) ⇒ CLI
constructor
A new instance of CLI.
- #page_tested(page_settings, lint_result) ⇒ Object
Constructor Details
#initialize(stdin, stdout, stderr, args) ⇒ CLI
Returns a new instance of CLI.
13 14 15 |
# File 'lib/bbc/a11y/cli.rb', line 13 def initialize(stdin, stdout, stderr, args) @stdin, @stdout, @stderr, @args = stdin, stdout, stderr, args end |
Instance Method Details
#all_pages_tested(summary) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/bbc/a11y/cli.rb', line 46 def all_pages_tested(summary) = [ (summary.pages, 'page', 'checked'), (summary.errors, 'error', 'found'), (summary.skips, 'standard', 'skipped') ] stdout.puts(.join(', ')) @any_errors = summary.fail? unless @any_errors stdout.puts NO_ERRORS_MESSAGE end end |
#call ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/bbc/a11y/cli.rb', line 17 def call Runner.new(settings, self).run exit 1 if @any_errors rescue Configuration::ParseError => error error. rescue Configuration::MissingConfigurationFileError => error error. end |
#page_tested(page_settings, lint_result) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bbc/a11y/cli.rb', line 26 def page_tested(page_settings, lint_result) if lint_result.passed? stdout.puts green("✓ #{page_settings.url}") else stdout.puts red("✗ #{page_settings.url}") current_section = nil current_name = nil lint_result.errors.each do |error| if error.section != current_section || error.name != current_name humanised_section = humanise(error.section) stdout.puts " * #{humanised_section}: #{error.name}" end stdout.puts " - #{error.}" current_section = error.section current_name = error.name end end stdout.puts "" end |