casiano@exthost:~$ cat $GROOVY_HOME/conf/groovy-starter.conf ############################################################################## ## ## ## Groovy Classloading Configuration ## ## ## ############################################################################## ## ## $Revision: 9225 $ $Date: 2007-11-15 21:17:45 +0100 (Do, 15. Nov 2007) $ ## ## Note: do not add classes from java.lang here. No rt.jar and on some ## platforms no tools.jar ## ## See http://groovy.codehaus.org/api/org/codehaus/groovy/tools/LoaderConfiguration.html ## for the file format # load required libraries load !{groovy.home}/lib/*.jar # load user specific libraries load !{user.home}/.groovy/lib/*.jar # tools.jar for ant tasks load ${tools.jar}
casiano@exthost:~/.groovy/lib$ wget http://kenai.com/projects/groovy-groosh/downloads/download/groovy-groosh-0.3.5.jar --2010-04-21 14:52:57-- http://kenai.com/projects/groovy-groosh/downloads/download/groovy-groosh-0.3.5.jar Resolviendo kenai.com... 64.79.150.44 Conectando a kenai.com|64.79.150.44|:80... conectado. Petición HTTP enviada, esperando respuesta... 302 Moved Temporarily Ubicación: http://kenai.com/downloads/groovy-groosh/groovy-groosh-0.3.5.jar [siguiente] --2010-04-21 14:52:58-- http://kenai.com/downloads/groovy-groosh/groovy-groosh-0.3.5.jar Reusando conexión existente a kenai.com:80. Petición HTTP enviada, esperando respuesta... 200 OK Longitud: 61284 (60K) [application/java-archive] Guardando: «groovy-groosh-0.3.5.jar» 100%[=====================================================================================>] 61.284 64,6K/s en 0,9s 2010-04-21 14:53:00 (64,6 KB/s) - `groovy-groosh-0.3.5.jar' guardado [61284/61284]
casiano@exthost:~/src/groovy/processes$ ls -ltr ~/.groovy/lib/ total 64 -rwxr--r-- 1 casiano Profesor 61284 2009-11-11 13:40 groovy-groosh-0.3.5.jar
casiano@exthost:~/src/groovy/processes$ pwd /home/casiano/src/groovy/processes casiano@exthost:~/src/groovy/processes$ cat grooshEx.groovy #!/usr/bin/env groovy def gsh = new groosh.Groosh(); if (args) { gsh.cat(args[0]).toStdOut(); } else { println 'Provide a file name' }
casiano@exthost:~/src/groovy/processes$ groovy grooshEx.groovy cat.groovy #!/usr/bin/env groovy def unixSlurp(fileName) { p = "cat -n $fileName".execute() } if (args) { println unixSlurp(args[0]) } else { println 'Provide a file name' } casiano@exthost:~/src/groovy/processes$