Class: DeltaTest::CLI::StatsShowCommand

Inherits:
CommandBase show all
Defined in:
lib/delta_test/cli/stats_show_command.rb

Constant Summary

Constants inherited from CommandBase

CommandBase::DEFAULT_OPTIONS

Instance Method Summary collapse

Methods inherited from CommandBase

#bundler_enabled?, #create_error_file, #current_process_status_success?, #error_file, #error_recorded?, #exec_with_data, #exit_with_message, #hook_create_error_file, #initialize, #invoke, #parse_options!, #record_error

Constructor Details

This class inherits a constructor from DeltaTest::CLI::CommandBase

Instance Method Details

#invoke!Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/delta_test/cli/stats_show_command.rb', line 9

def invoke!
  if stats.base_commit
    puts 'Base commit: %s' % [stats.base_commit]
    puts
  else
    raise StatsNotFoundError
  end

  list.load_table!(stats.table_file_path)
  print_table
end

#listObject



25
26
27
# File 'lib/delta_test/cli/stats_show_command.rb', line 25

def list
  @list ||= RelatedSpecList.new
end


29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/delta_test/cli/stats_show_command.rb', line 29

def print_table
  if list.table.any?
    list.table.each do |spec_file, dependencies|
      puts spec_file
      puts
      dependencies.each do |dependency|
        puts "\t#{dependency}"
      end
      puts
    end
  else
    puts '(no entry)'
  end
end

#statsObject



21
22
23
# File 'lib/delta_test/cli/stats_show_command.rb', line 21

def stats
  @stats ||= Stats.new
end