Class: GitHealthCheck::Cli::GitHealthCheckCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/git-health-check/cli/git_health_check_command.rb

Direct Known Subclasses

HelpCommand, VersionCommand

Instance Method Summary collapse

Constructor Details

#initialize(parser, options) ⇒ GitHealthCheckCommand

Returns a new instance of GitHealthCheckCommand.



8
9
10
11
12
13
14
15
16
# File 'lib/git-health-check/cli/git_health_check_command.rb', line 8

def initialize(parser, options)
  @options = options
  @parser = parser
  @threshold = options[:threshold]
  @limit = options[:limit]
  @history = GitHealthCheck::History.new options
  @working_copy = GitHealthCheck::WorkingCopy.new options
  @packfile = GitHealthCheck::Packfile.new
end

Instance Method Details

#execute(view) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/git-health-check/cli/git_health_check_command.rb', line 18

def execute(view)
  @packfile.packfile_stats

  working_copy_output = @working_copy.find_in_working_copy
  history_output = @history.search

  working_copy_report = Table('object sha', 'size (MB)', 'path')
  history_report = Table('object sha', 'size (MB)', 'path', 'commit details', 'author')

  working_copy_output.each { |sha, size, path| working_copy_report << [sha, size, path] }
  history_output.each { |sha, size, path, where, who| history_report << [sha, size, path, where, who] }

  report = GitHealthCheck::Report.new(working_copy_report.to_html, history_report.to_html, @packfile, @options)
  report.create

  view.report_success
end