Class: SpaceArchitect::CLI::Architect::Verify

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
GlobalOptions, Helpers
Defined in:
lib/space_architect/cli/architect.rb

Instance Method Summary collapse

Methods included from Helpers

#display_date, #handle_errors, #project_config, #render, #setup_terminal, #state, #store, #terminal

Methods included from GlobalOptions

included

Instance Method Details

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



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/space_architect/cli/architect.rb', line 124

def call(iteration:, space: nil, **opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    render(store.find(space)) do |sp|
      mission = ArchitectMission.new(space: sp)
      results = mission.verify(iteration)

      if results.empty?
        terminal.say "No lanes recorded for iteration '#{iteration}'"
        CLI.record_outcome(Outcome.new(exit_code: 0))
        next
      end

      rows = results.flat_map do |r|
        lane = r[:lane]
        c = r[:checks]
        [
          [lane, "(a) frozen sections untouched", pass_fail(c[:frozen_untouched])],
          [lane, "(b) no builder commits",        pass_fail(c[:no_builder_commits])],
          [lane, "(c) scratch report exists",     pass_fail(c[:report_exists])],
          [lane, "(d) in-bounds",                 pass_fail(c[:in_bounds])]
        ]
      end

      terminal.say terminal.table(%w[Lane Check Result], rows)
      CLI.record_outcome(Outcome.new(exit_code: 0))
    end
  end
end