Module: XCPretty

Defined in:
lib/xcpretty.rb,
lib/xcpretty/ansi.rb,
lib/xcpretty/term.rb,
lib/xcpretty/parser.rb,
lib/xcpretty/syntax.rb,
lib/xcpretty/printer.rb,
lib/xcpretty/snippet.rb,
lib/xcpretty/version.rb,
lib/xcpretty/formatters/tap.rb,
lib/xcpretty/reporters/html.rb,
lib/xcpretty/reporters/junit.rb,
lib/xcpretty/formatters/knock.rb,
lib/xcpretty/formatters/rspec.rb,
lib/xcpretty/formatters/simple.rb,
lib/xcpretty/reporters/reporter.rb,
lib/xcpretty/formatters/formatter.rb,
lib/xcpretty/reporters/json_compilation_database.rb

Defined Under Namespace

Modules: ANSI, FormatMethods, Matchers, Syntax, Term Classes: Formatter, HTML, JSONCompilationDatabase, JUnit, Knock, Parser, Printer, RSpec, Reporter, Simple, Snippet, TestAnything

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.class_from_path(path) ⇒ Object



18
19
20
21
22
23
# File 'lib/xcpretty.rb', line 18

def self.class_from_path(path)
  source = File.read(path)
  klass = eval(source, nil, path)
  raise unless klass.is_a?(Class)
  klass
end

.exit_with_error(message) ⇒ Object



32
33
34
35
# File 'lib/xcpretty.rb', line 32

def self.exit_with_error(message)
  $stderr.puts "[!] #{message}"
  exit 1
end

.load_custom_class(path) ⇒ Object



25
26
27
28
29
30
# File 'lib/xcpretty.rb', line 25

def self.load_custom_class(path)
  $LOAD_PATH.unshift File.dirname(path)
  class_from_path(path)
rescue SyntaxError => e
  exit_with_error("Expected custom source file to return a class. #{e}")
end