Class: Ace::Git::Secrets::Commands::CheckReleaseCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/git/secrets/commands/check_release_command.rb

Overview

CLI command for pre-release security check

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CheckReleaseCommand

Returns a new instance of CheckReleaseCommand.



16
17
18
# File 'lib/ace/git/secrets/commands/check_release_command.rb', line 16

def initialize(options)
  @options = options
end

Class Method Details

.execute(options) ⇒ Integer

Execute check-release command

Parameters:

  • options (Hash)

    Command options

Returns:

  • (Integer)

    Exit code (0=passed, 1=failed, 2=error)



12
13
14
# File 'lib/ace/git/secrets/commands/check_release_command.rb', line 12

def self.execute(options)
  new(options).execute
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ace/git/secrets/commands/check_release_command.rb', line 20

def execute
  # Ensure gitleaks is available
  Atoms::GitleaksRunner.ensure_available!

  puts "Performing pre-release security check..."
  puts

  gate = Organisms::ReleaseGate.new(
    repository_path: ".",
    strict: @options[:strict],
    gitleaks_config: Ace::Git::Secrets.gitleaks_config_path
  )

  result = gate.check

  # Output formatted result
  format = @options[:format] || Ace::Git::Secrets.config.dig("output", "format") || "table"
  puts gate.format_result(result, format: format)

  result[:exit_code]
rescue => e
  puts "Error: #{e.message}"
  puts e.backtrace.first(5).join("\n") if ENV["DEBUG"]
  2
end