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

ruby.branches       1.9 2.3 2.4 2.5
ruby.setup          bundler 2.0.1 gem
checksums           rmd160  5ad9a57944c09b066eb9d5a555dc840df31185fc \
                    sha1    d20822ff1d6bcbe069c3e709dd39e83da341d675 \
                    sha256  c7e38039993c9c2edc27397aef4a3370a4b35c7fae3d93e434e501c4bd7656ea \
                    size    364032

license             MIT
categories-append   www devel
platforms           darwin
maintainers         {kimuraw @kimuraw} openmaintainer
supported_archs     noarch
homepage            https://bundler.io

description         Bundler provides a consistent environment for Ruby \
                    projects by tracking and installing the exact gems and \
                    versions that are needed.

long_description    ${description}\
                    \nBundler is an exit from dependency hell, and ensures \
                    that the gems you need are present in development, \
                    staging, and production. Starting work on a project is as \
                    simple as bundle install.

# Note: ruby contains bundler since 2.6.
#       bundler 2.0 requires ruby-2.3 and rubygems-2.5 or later.
if {${ruby.branch} eq "1.9"} {
    ruby.setup          bundler 1.17.3 gem
    checksums           rmd160  dc0597bea59ff9f7f1feeec140898363e3747cac \
                        sha1    b5f0a9bffd4ff9b983b536704973fbe1cf49f015 \
                        sha256  bc4bf75b548b27451aa9f443b18c46a739dd22ad79f7a5f90b485376a67dc352 \
                        size    364032
}

post-destroot {
    # bundler expects the name of gem command is "gem",
    # this causes failure of `rake build` when write a new gem with bundler.
    if {$subport ne $name} {
        # sh "gem build ..." -> sh "gem2.3 build ..."
        reinplace -E "s/(gem) (build|install|push)/gem${ruby.branch} \\2/g" \
            ${destroot}${ruby.gemdir}/gems/bundler-${version}/lib/bundler/gem_helper.rb
    }
}
