# -*- 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        asdf-vm asdf 0.16.5 v
github.tarball_from archive
revision            0

categories          sysutils devel
installs_libs       no
license             MIT
platforms           any
supported_archs     noarch
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

description         Extendable version manager with support for Ruby, Node.js, \
                    Elixir, Erlang & more

long_description    ${name} is a CLI tool that can manage multiple language \
                    runtime versions on a per-project basis.
homepage            https://asdf-vm.com/

checksums           rmd160  c8d5e7375cf4d97c29e4ec3529ea6c7f0553bcde \
                    sha256  d7b6e1efcdd62c881c7f4a539ce3a56131d9ddcbcc13e8099ee371545d38706a \
                    size    323594

use_configure       no
build               {}

depends_run-append  bin:curl:curl \
                    bin:git:git

destroot {
    xinstall -d -m 0755 ${destroot}${prefix}/share/${name}
    copy {*}[glob ${worksrcpath}/*] ${destroot}${prefix}/share/${name}
    touch ${destroot}${prefix}/share/${name}/asdf_updates_disabled

    set asdf_share_dir ${prefix}/share/${name}

    # Bash completions
    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    ln -s ${asdf_share_dir}/completions/${name}.bash \
         ${destroot}${prefix}/share/bash-completion/completions/${name}

    # Zsh completions
    xinstall -d ${destroot}${prefix}/share/zsh/site-functions
    ln -s ${asdf_share_dir}/completions/_${name} \
        ${destroot}${prefix}/share/zsh/site-functions/_${name}

    # Fish completions
    xinstall -d ${destroot}${prefix}/share/fish/vendor_completions.d
    ln -s ${asdf_share_dir}/completions/${name}.fish \
        ${destroot}${prefix}/share/fish/vendor_completions.d/${name}.fish
}

notes "
Activate asdf by adding it to your shell profile.

Zsh or Bash: Add the following line to ~/.zshrc or ~/.bashrc
    . ${prefix}/share/${name}/asdf.sh

Fish: Add the following line to ~/.config/fish/config.fish
    source ${prefix}/share/${name}/asdf.fish
"
