# $Id: Portfile 66857 2010-04-23 23:50:09Z breskeby@macports.org $

PortSystem 1.0

name				grails-devel
version				1.3.0.RC2
categories			devel java
maintainers			breskeby
description			An open-source web application framework that leverages the Groovy language
long_description	Grails aims to bring the "coding by convention" paradigm to Groovy. \
					It's an open-source web application framework that leverages the Groovy \
					language and complements Java Web development. \
					You can use Grails as a standalone development environment that hides all \
					configuration details or integrate your Java business logic. \
					Grails aims to make development as simple as possible and hence \
					should appeal to a wide range of developers not just those from the Java community.
homepage			http://www.grails.org/
conflicts			grails
platforms			darwin
distname			grails-${version}
master_sites		http://dist.codehaus.org/grails
checksums 			md5 8169725046fb2e7bf1e0bc8a30a465df \
					sha1 57c1568ac5b3392d77b1682d76b090e73b401137 \
					rmd160 c36e73f209f4b36d8e247e99c58c74657b2c93e2

worksrcdir			grails-${version}
set workTarget		""

extract.suffix	   	.zip
extract.cmd       	unzip
extract.pre_args  	"-q -o"
extract.post_args 	"-d ${portpath}/work"

use_configure 		no

build.cmd 			true

pre-destroot {
	# Remove extraneous bat files
	foreach f [glob -directory ${worksrcpath}${workTarget}/bin *.bat] {
		file delete $f
	}
}

destroot	{
	# Create the target java directory
	xinstall -m 755 -d ${destroot}${prefix}/share/java/grails

	# Copy over the needed elements of our directory tree
	file copy ${worksrcpath}/bin     						\
			  ${worksrcpath}/dist 							\
			  ${worksrcpath}/conf 							\
			  ${worksrcpath}/lib 							\
			  ${worksrcpath}/media 							\
			  ${worksrcpath}/scripts						\
			  ${worksrcpath}/src						    \
			  ${worksrcpath}/build.properties 				\
			  ${destroot}${prefix}/share/java/grails

	# Symlink grails into the bin directory
	system "cd ${destroot}${prefix}/bin && ln -s ${prefix}/share/java/grails/bin/grails"
	system "cd ${destroot}${prefix}/bin && ln -s ${prefix}/share/java/grails/bin/startGrails"
}

post-activate {
 	        ui_msg "****************************************************************************"
 	        ui_msg "* Remember to set the environment variable GRAILS_HOME to the path to"
 	        ui_msg "* the grails distribution: ${prefix}/share/java/grails"
 	        ui_msg "****************************************************************************"
 }
