# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0

github.setup        GoogleContainerTools skaffold 2.23.0 v
revision            0

categories          devel
maintainers         {breun @breun} openmaintainer
platforms           darwin
license             Apache-2

description         Skaffold is a command line tool that facilitates continuous development for Kubernetes applications

long_description    Skaffold is a command line tool that facilitates continuous development for Kubernetes applications. \
                    You can iterate on your application source code locally then deploy to local or remote Kubernetes clusters. \
                    Skaffold handles the workflow for building, pushing and deploying your application. \
                    It also provides building blocks and describe customizations for a CI/CD pipeline.

homepage            https://skaffold.dev

github.tarball_from archive

checksums           rmd160  f467b8183a21e7f8ac50806d25d6cc0f9e67d196 \
                    sha256  af16760930e9463139f3228858a9308bb5e1eaa1c595c09768a1e058a1ae0baa \
                    size    74999439

depends_build       port:go

use_configure       no

build.env-append    VERSION=${version} LOCAL=true
build.target

test.run    yes
test.cmd    out/${name}
test.target
test.args   version

destroot {
    set binary_dir ${prefix}/share/${name}
    set binary ${binary_dir}/skaffold

    # Install binary
    xinstall -d ${destroot}${binary_dir}
    xinstall -m 0755 ${worksrcpath}/out/${name} ${destroot}${binary}

    # Create launch script
    # Disable update check: https://skaffold.dev/docs/references/privacy/#update-check
    set launch_script [open ${destroot}${prefix}/bin/skaffold w 0755]
    puts $launch_script "#!/bin/sh"
    puts $launch_script "SKAFFOLD_UPDATE_CHECK=false ${binary} \"$@\""
    close $launch_script

    # bash completion
    xinstall -d ${destroot}${prefix}/etc/bash_completion.d
    system "${destroot}${binary} completion bash > ${destroot}${prefix}/etc/bash_completion.d/${name}"

    # zsh completion
    xinstall -d ${destroot}${prefix}/share/zsh/site-functions
    system "${destroot}${binary} completion zsh > ${destroot}${prefix}/share/zsh/site-functions/_${name}"
}
