Module: XCPretty

Defined in:
lib/xcpretty.rb,
lib/xcpretty/ansi.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/reporters/learn.rb,
lib/xcpretty/formatters/knock.rb,
lib/xcpretty/formatters/rspec.rb,
lib/xcpretty/formatters/simple.rb,
lib/xcpretty/formatters/formatter.rb,
lib/xcpretty/reporters/json_compilation_database.rb

Defined Under Namespace

Modules: ANSI, FormatMethods, Matchers Classes: Formatter, GitHubInteractor, HTML, JSONCompilationDatabase, JUnit, Knock, Learn, NetrcInteractor, Parser, Printer, RSpec, RepoParser, Simple, Snippet, Syntax, TestAnything, UserIdParser, UsernameParser

Constant Summary collapse

VERSION =
"0.1.12"

Class Method Summary collapse

Class Method Details

.class_from_path(path) ⇒ Object



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

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



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

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

.load_custom_formatter(path) ⇒ Object



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

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