Sha256: f1817fa852d66429cb01f8feb764475366ddbd5c017ec32c52db8d4d5844c905
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
require "xcpretty/version" require "xcpretty/printer" require "xcpretty/syntax" require "xcpretty/formatters/formatter" require "xcpretty/formatters/simple" require "xcpretty/formatters/rspec" require "xcpretty/reporters/junit" module XCPretty module ExitStatus include XCPretty::Matchers POSSIBLE_FAILURES = [ FAILING_TEST_MATCHER, /\serror:\s/ ] def self.code $exit_status || 0 end def self.handle(text) POSSIBLE_FAILURES.detect do |failure| $exit_status = 1 if text =~ failure end end end def self.class_from_path(path) source = File.read(path) klass = eval(source, nil, path) raise unless klass.is_a?(Class) klass end def self.load_custom_formatter(path) begin $:.unshift File.dirname(path) class_from_path(path) rescue SyntaxError => e exit_with_error("Expected formatter source file to return a class. #{e}") end end def self.exit_with_error(message) $stderr.puts "[!] #{message}" exit 1 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xcpretty-0.1.2 | lib/xcpretty.rb |
xcpretty-0.1.1 | lib/xcpretty.rb |
xcpretty-0.1.0 | lib/xcpretty.rb |