Class: Space::Architect::CLI::Architect::Gate

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/space_architect/cli/architect.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

commit_message_options, phase

Instance Method Details

#call(iteration:, lane: nil, space: nil, **opts) ⇒ Object



805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
# File 'lib/space_architect/cli/architect.rb', line 805

def call(iteration:, lane: nil, space: nil, **opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    render(store.find(space)) do |sp|
      project = ArchitectProject.new(space: sp)
      results = project.run_gates(iteration, lane: lane)
      results.each do |r|
        marker = r[:status] == :pass ? "PASS" : "FAIL"
        terminal.say ""
        terminal.say "── #{r[:ac].empty? ? "(gate)" : r[:ac]}: #{r[:cmd]}  (exit #{r[:exit_code]})  [#{marker}]"
        terminal.say "   dir: #{terminal.path(r[:dir])}"
        terminal.say "   reason: #{r[:reason]}" if r[:status] == :fail && !r[:reason].to_s.empty?
        terminal.say r[:stdout].rstrip unless r[:stdout].strip.empty?
        terminal.say r[:stderr].rstrip unless r[:stderr].strip.empty?
      end
      terminal.say ""
      terminal.say "Mechanical gate results above; the Acceptance-Criteria verdict — necessary, not sufficient — remains the architect's."
      any_fail = results.any? { |r| r[:status] == :fail }
      CLI.record_outcome(Outcome.new(exit_code: any_fail ? 1 : 0))
    end
  end
end