class Attestify::CLI
Command Line Interface for running Attestify
tests.
Public Class Methods
new(args = ARGV)
click to toggle source
# File lib/attestify/cli.rb, line 9 def initialize(args = ARGV) @args = args end
start()
click to toggle source
# File lib/attestify/cli.rb, line 13 def self.start Attestify.disable_autorun new.start end
Public Instance Methods
reporter()
click to toggle source
# File lib/attestify/cli.rb, line 22 def reporter @reporter ||= if options[:color] Attestify::ColorReporter.new else Attestify::Reporter.new end end
test_list()
click to toggle source
# File lib/attestify/cli.rb, line 18 def test_list @test_list ||= Attestify::TestList.new(@args, dir: options[:directory]) end
Private Instance Methods
after_exec()
click to toggle source
# File lib/attestify/cli.rb, line 75 def after_exec exit(exit_code) end
before_run()
click to toggle source
# File lib/attestify/cli.rb, line 71 def before_run option_parser.parse!(@args) end
ignore_reporting()
click to toggle source
# File lib/attestify/cli.rb, line 67 def ignore_reporting @ignore_reporting = true end
option_parser()
click to toggle source
# File lib/attestify/cli.rb, line 39 def option_parser # rubocop:disable Metrics/MethodLength @option_parser ||= OptionParser.new do |opts| opts.banner = "Usage: attestify [options] [test_files ...]" opts.on("-c", "--color", "Run with color") do options[:color] = true end opts.on("-C", "--no-color", "Run without color") do options[:color] = false end opts.on("-d", "--directory [DIR]", "Run the tests in the provided DIR") do |dir| options[:directory] = dir end opts.on("-h", "--help", "Output this help") do puts opts ignore_reporting exit end end end
options()
click to toggle source
# File lib/attestify/cli.rb, line 33 def options @options ||= { color: true } end
report?()
click to toggle source
# File lib/attestify/cli.rb, line 63 def report? !@ignore_reporting end