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

name                rb-rubygems
categories          ruby devel
license             {Ruby GPL-2}
version             1.3.7
revision            2

homepage            http://rubygems.org/
master_sites        http://production.cf.rubygems.org/rubygems


distname            rubygems-${version}
dist_subdir         ruby

maintainers         nomaintainer
description         a package management framework for Ruby
long_description    RubyGems is the Ruby standard for publishing and \
                    managing third party libraries.

checksums           md5     e85cfadd025ff6ab689375adbf344bbe \
                    sha1    68ad2970963db9893b76acc8777be72a77c4bee4 \
                    rmd160  2ea8e16d1535216045798258603d5f2f9e3dbfea

patchfiles          patch-lib_rubygems_commands_setup_command.rb.diff


extract.suffix      .tgz
platforms           any
supported_archs     noarch

use_configure       no
build { }

destroot.cmd        ${ruby.bin} setup.rb
destroot.args       --prefix=${prefix} --destdir=${destroot}
destroot.env

set gems_libdir ${destroot}${prefix}/lib/ruby/gems/${ruby.api_version}
destroot.keepdirs \
    ${gems_libdir}/doc \
    ${gems_libdir}/gems \
    ${gems_libdir}/specifications

variant ruby conflicts ruby186 description {add Ruby 1.8.7 support} {
    depends_lib-append      port:ruby
    destroot.args-append    --vendor --no-format-executable
    ruby.branch             1.8
    post-destroot {
        xinstall -d ${destroot}${ruby.bindir}
        move ${destroot}${prefix}/bin/gem ${destroot}${ruby.bindir}/gem
        ln -s ${ruby.bindir}/gem ${destroot}${prefix}/bin/gem${ruby.link_binaries_suffix}
    }
}

variant ruby186 conflicts ruby description {add Ruby 1.8.6 support} {
    depends_lib-append      port:ruby186
}

if {![variant_isset ruby186]} {
    default_variants +ruby
}

livecheck.type      regex
livecheck.url       https://rubygems.org/pages/download
livecheck.regex     {v([0-9.]+)}