# -*- 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.5 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  19b25921671b94f7bc0254ec6af1b22b18105697 \
                    sha256  9f350650afc5e4cfcc6af9fc327b2a6112c5700ad848bbe517254db64aee5061 \
                    size    372458

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"
