Class: Polytrix::Command::Show

Inherits:
Base
  • Object
show all
Includes:
Reporters, Util::FileSystem, Util::String
Defined in:
lib/polytrix/command/show.rb

Constant Summary

Constants included from Reporters

Reporters::ASSETS_DIR, Reporters::GENERATORS_DIR, Reporters::RESOURCES_DIR

Instance Method Summary collapse

Methods included from Util::FileSystem

#find_file, #relativize

Methods included from Util::String

included

Methods included from Util::String::ClassMethods

#ansi2html, #escape_html, #highlight, #slugify

Methods included from Reporters

reporter

Methods included from DefaultLogger

included

Methods included from DefaultLogger::ClassMethods

#logger

Constructor Details

#initialize(cmd_args, cmd_options, options = {}) ⇒ Show

Returns a new instance of Show.



10
11
12
13
# File 'lib/polytrix/command/show.rb', line 10

def initialize(cmd_args, cmd_options, options = {})
  @indent_level = 0
  super
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/polytrix/command/show.rb', line 15

def call
  setup
  @reporter = Polytrix::Reporters.reporter(options[:format], shell)
  challenges = parse_subcommand(args.pop)

  challenges.each do | challenge |
    status_color = challenge.status_color.to_sym
    status(challenge.slug, colorize(challenge.status_description, status_color), status_color)
    indent do
      status('Test suite', challenge.suite)
      status('Test scenario', challenge.name)
      status('Implementor', challenge.implementor.name)
      source_file = challenge.absolute_source_file ? relativize(challenge.absolute_source_file, Dir.pwd) : colorize('<No code sample>', :red)
      status('Source', source_file)
      display_source(challenge)
      display_execution_result(challenge)
      display_validations(challenge)
      display_spy_data(challenge)
    end
  end
end