# -*- 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

name            spring-boot-cli
version         2.0.3

categories      java
platforms       darwin
maintainers     {@breun breun.nl:nils} openmaintainer
license         Apache-2
supported_archs noarch

description     Spring Boot CLI -- An opinionated view of building \
                production-ready Spring applications.

long_description The Spring Boot CLI is a command line tool that can be used \
                if you want to quickly prototype with Spring. It allows you to \
                run Groovy scripts, which means that you have a familiar \
                Java-like syntax, without much boilerplate code. \
                \
                You don't need to use the CLI to work with Spring Boot but \
                it's definitely the quickest way to get a Spring application \
                off the ground.

homepage        https://projects.spring.io/spring-boot/
master_sites    https://repo.spring.io/release/org/springframework/boot/${name}/${version}.RELEASE/

distname        ${name}-${version}.RELEASE-bin

checksums       rmd160  92c14502c701656c609c015cd71315cf836f0835 \
                sha256  5a4bf071ed6509f5d915091573d2c1494f86c8ea915153d5e93dfdcc5ba75a44 \
                size    9116513

worksrcdir      spring-${version}.RELEASE

use_configure   no

build {}

destroot {
    set target ${destroot}${prefix}/share/java/${name}

    # Create the target java directory
    xinstall -m 755 -d ${target}

    # Copy over the needed elements of our directory tree
    foreach d { bin lib } {
        copy ${worksrcpath}/${d} ${target}
    }

    # Remove extraneous bat files
    foreach f [glob -directory ${target}/bin *.bat] {
        delete ${f}
    }

    # Add symlink to the script
    ln -s ../share/java/${name}/bin/spring ${destroot}${prefix}/bin
}

variant bash_completion {
    depends_run-append path:etc/bash_completion:bash-completion
    post-destroot {
        xinstall -d ${destroot}${prefix}/etc/bash_completion.d
        copy ${worksrcpath}/shell-completion/bash/spring \
             ${destroot}${prefix}/etc/bash_completion.d/spring
    }
}

livecheck.type  regex
livecheck.url   http://repo.spring.io/release/org/springframework/boot/${name}/
livecheck.regex (\[0-9.\]+).RELEASE