Class: Perfgate::CLI::CompareCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/perfgate/cli/compare_command.rb

Overview

Implements baseline compare (spec section 10.3): loads two already-produced result bundles, runs them through the comparison engine and policy engine, saves the comparison document, prints a console (or Markdown, with --format markdown) report, and exits with the CI exit code from spec section 17.

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CompareCommand

Returns a new instance of CompareCommand.



19
20
21
22
# File 'lib/perfgate/cli/compare_command.rb', line 19

def initialize(argv)
  @argv = argv.dup
  @options = { config: "perfgate.yml" }
end

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/perfgate/cli/compare_command.rb', line 24

def call
  parse_options!
  require_bundle_options!
  config = load_configuration

  comparison_result = compare(config)
  policy_result = Policy::Engine.evaluate(comparison_result: comparison_result, config: config)

  comparison_path = save(config, comparison_result)
  report(comparison_result, policy_result, comparison_path)
  policy_result.fetch("exit_code")
end