# -*- 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        nvm-sh nvm 0.40.3 v
github.tarball_from archive

categories          devel
platforms           any
supported_archs     noarch
license             MIT

maintainers         {@FranklinYu hotmail.com:franklinyu} openmaintainer
description         Node version manager
long_description    NVM is a simple shell script to manage multiple active Node.js versions.

checksums           rmd160  6efb5987afd96e9c3f697ac6efb0d828a0b24c3b \
                    sha256  5f4d6aaa04a177dc93c985e31dbc411ab6b8c6e1e21d8015dbc1372625fcd1d0 \
                    size    346428

use_configure       no

build {}

destroot {
    set nvm_dir ${destroot}${prefix}/share/nvm
    xinstall -d ${nvm_dir}
    xinstall -m 644 ${worksrcpath}/nvm.sh ${filespath}/init-nvm.sh ${nvm_dir}
    xinstall ${worksrcpath}/nvm-exec ${nvm_dir}
    reinplace "s|@NVM_SHARE@|${prefix}/share/nvm|g" ${nvm_dir}/init-nvm.sh

    set completions_dir ${destroot}${prefix}/share/bash-completion/completions
    xinstall -d ${completions_dir}
    xinstall ${worksrcpath}/bash_completion ${completions_dir}/nvm
}

notes "Please source the init file in '.bashrc' or '.zshrc':

    source ${prefix}/share/nvm/init-nvm.sh"
