Sha256: 8f42117d00f7ead03d34daf591b8ce60ca4d5c348c094973ce2447fc751e4d44

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

# tau ship project start
module ShipProjectStart
  # Start a takelship
  def ship_project_start(project)
    return false if _docker_container_lib_check_matrjoschka

    return false if ship_container_check_existing

    takelship = _ship_info_lib_get_takelshipinfo
    project = _ship_info_lib_get_project(project, takelship)

    return false unless _ship_info_lib_valid_project? takelship, project

    log.debug "Starting takelship project \"#{project}\""
    ports = _ship_project_start_ports takelship, project
    say _ship_container_lib_docker_privileged ports, project
  end

  private

  # Get takelship ports
  # rubocop:disable Metrics/MethodLength
  # rubocop:disable Metrics/AbcSize
  def _ship_project_start_ports(takelship, project)
    ports = []
    takelship['projects'].each do |takelship_project|
      next unless project == takelship_project['name']

      takelship_project['services'].each do |service|
        next unless service.key?('ports')

        service['ports'].each do |port|
          ports << port['port']
        end
      end
    end
    if config.active['ship_port_expose_podman_socket'] == 'true'
      log.debug "Add DOCKER_HOST port #{config.active['ship_docker_host']}"
      ports << config.active['ship_docker_host']
    end
    ports
  end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
takeltau-0.44.2 lib/takeltau/ship/project/start.rb
takeltau-0.43.23 lib/takeltau/ship/project/start.rb
takeltau-0.43.21 lib/takeltau/ship/project/start.rb