# -*- 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
# $Id: Portfile 78670 2011-05-17 02:44:22Z ryandesign@macports.org $

PortSystem          1.0

name                coffee-script
version             1.1.1
set gitbranch       d4d0271
platforms           darwin
categories          lang
maintainers         ryandesign openmaintainer
license             MIT
supported_archs     noarch

description         a language that compiles into JavaScript

long_description    CoffeeScript is ${description}. Underneath all of \
                    those embarrassing braces and semicolons, JavaScript \
                    has always had a gorgeous object model at its heart. \
                    CoffeeScript is an attempt to expose the good parts \
                    of JavaScript in a simple way.

homepage            http://jashkenas.github.com/coffee-script/
master_sites        https://github.com/jashkenas/coffee-script/tarball/${version}

worksrcdir          jashkenas-${name}-${gitbranch}

checksums           sha1    acfa6be55a17038f2a836734cbd0dabe139bf541 \
                    rmd160  1a84398eec12e685e2886897aa64eeb8175ae90d

depends_lib         port:nodejs

patchfiles          patch-Cakefile.diff patch-prefix.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/bin/cake ${worksrcpath}/bin/coffee
}

use_configure       no

build.cmd           bin/cake
build.target        build

destroot.destdir
destroot.pre_args   --prefix ${destroot}${prefix} ${destroot.target}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        LICENSE \
        README \
        ${docdir}
}

livecheck.type      regex
livecheck.url       https://github.com/jashkenas/coffee-script/downloads
livecheck.regex     {tarball/([0-9.]+)"}

if {![file exists $env(HOME)/.node_libraries/coffee-script]} {
    notes-append "
To use ${name}, make a symlink to ${prefix}/lib/coffee-script/lib at\
~/.node_libraries/coffee-script:

    mkdir -p ~/.node_libraries
    ln -s ${prefix}/lib/coffee-script/lib ~/.node_libraries/coffee-script
"
}
