Class: Space::Architect::CLI::Architect::Integrate

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:, space: nil, lanes: nil, teardown: false, message: nil, message_from: nil, commit_mode: nil, into: nil, **opts) ⇒ Object



564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/space_architect/cli/architect.rb', line 564

def call(iteration:, space: nil, lanes: nil, teardown: false, message: nil, message_from: nil, commit_mode: nil, into: nil, **opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    lane_names = lanes.to_s.split(",").map(&:strip).reject(&:empty?)
    raise Space::Core::Error, "integrate needs --lanes <set>, or --teardown for teardown-only" \
      if lane_names.empty? && !teardown

    render(store.find(space)) do |sp|
      project = ArchitectProject.new(space: sp)
      results = project.integrate!(iteration, lanes: lane_names, teardown: teardown,
        message: read_commit_message(message: message, message_from: message_from),
        commit_mode: commit_mode, into: into)
      if lane_names.empty?
        if results.empty?
          terminal.say "Nothing to tear down for #{iteration}"
        else
          results.each do |r|
            terminal.say "Tore down #{r[:lane]} (removed worktree, deleted #{r[:lane_branch]})"
          end
        end
      else
        results.each do |r|
          terminal.say "Merged #{r[:lane]}#{r[:integration_branch]} (#{r[:merge_sha][0, 8]})"
        end
        terminal.say "Gates NOT run — run gates: `architect gate #{iteration}`"
      end
      CLI.record_outcome(Outcome.new(exit_code: 0))
    end
  end
end