Class: GitHealthCheck::Cli::GitHealthCheckCommand
- Inherits:
-
Object
- Object
- GitHealthCheck::Cli::GitHealthCheckCommand
- Defined in:
- lib/git-health-check/cli/git_health_check_command.rb
Direct Known Subclasses
Instance Method Summary collapse
- #execute(view) ⇒ Object
-
#initialize(parser, threshold = 0.5) ⇒ GitHealthCheckCommand
constructor
A new instance of GitHealthCheckCommand.
Constructor Details
#initialize(parser, threshold = 0.5) ⇒ GitHealthCheckCommand
Returns a new instance of GitHealthCheckCommand.
8 9 10 11 12 |
# File 'lib/git-health-check/cli/git_health_check_command.rb', line 8 def initialize(parser, threshold = 0.5) @threshold = threshold @parser = parser @repository = Dir.pwd end |
Instance Method Details
#execute(view) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/git-health-check/cli/git_health_check_command.rb', line 14 def execute(view) history = GitHealthCheck::History.new(@repository, 'HEAD', @threshold) working_copy = GitHealthCheck::WorkingCopy.new @repository packfile = GitHealthCheck::Packfile.new(@repository) packfile.packfile_stats working_copy_output = working_copy.fast_find_in_working_copy history_output = history.search working_copy_report = Table("object sha", "size (KB)", "compressed (KB)", "path") history_report = Table("object sha", "size (MB)", "path", "commit details", "author") working_copy_output.each { |sha, (size, csize, path)| working_copy_report << [sha, size, csize, 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) report.create view.report_success end |