Groosh 0.3.0 released

View: New views
2 Messages — Rating Filter:   Alert me  

Groosh 0.3.0 released

by eggeral :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Version 0.3.0 of Groosh (http://groovy.codehaus.org/Groosh) has been released.

Groosh provides shell-like capability for handling external processes.

Version 0.3.0 comes with several bug fixes and new features like:

  * The error stream of a process is now usable the same way as the output stream (useError()).
 * A grep method was added which can be used to filter the lines returned by a process.
 * A to List method was added which creates a list out of the lines returned by a process.
 * A eachLine method was added which iterates over the lines returned by a process.
 * The exit values of a process are now accessible. (Thx to Bill Burdick)
 * left shift and right shift operators are overloaded for processes and stream sinks.
 * the pipe operator was overloaded to allow chaining of processes


Groosh
0.3.0 can be downloaded from

http://svn.codehaus.org/groovy-contrib/groosh/releases/

OpenSUSE RPM packages are available from

http://download.opensuse.org/repositories/home:/eggeral/openSUSE_10.3/
and
http://download.opensuse.org/repositories/home:/eggeral/openSUSE_10.2/

The following example shows Groovy and Groosh in action. It uploads images from a directory to Flickr using
the command line tool flickcurl and creates a photo set out of this images.

--

import static groosh.Groosh.groosh
import static org.codehaus.groovy.groosh.stream.DevNull.devnull

ids = [:]
shell = groosh()

//get all images in this folder and upload it to flickr
//remember the photo id we get from flickr
shell.ls().grep(~/.*jpg/).each {
  println "Uploading file $it to flickr"
  flickcurl = shell.flickcurl("upload",it,"friend","family").useError(true)
  id = flickcurl.grep(~/.*Photo ID.*/)[0].split(":")[1].trim()
  ids[it] = id
  println "Photo ID is: $id"
}
//we need to know the first photo id
firstKey = ids.keySet().toList()[0]

//create a set with the name of the directory we are in right now
//use the id of the first photo as set cover
setName = shell.pwd().text.split("/")[-1]
println "Creating set: $setName"
flickcurl = shell.flickcurl("photosets.create",setName,setName,ids[firstKey]).useError(true)
id = flickcurl.grep(~/.*Photoset.*/)[0].split(" ")[2].trim()
println "Photoset ID is: $id"

//make a backup of the ids in a file for later reference
println "Writing ids to a file"
file = new File(shell.pwd().text.trim() + "/.flickrset")
file << "Photoset:" << id << "\n"
ids.each {
  file << it.key << ":" << it.value << "\n"   
}

//the first photo is allready part of the photo set so lets remove it
ids.remove(firstKey)

//add the remaining photos to the photo set
ids.each {
  println "Adding photo to set at flickr: $it"
  shell.flickcurl("photosets.addPhoto",id,it.value) | devnull()
}

println "DONE"


--
Dr. Alexander Egger, Studiengang IT & IT-Marketing
CAMPUS 02 Fachhochschule der Wirtschaft GmbH
Körblergasse 126, 8021 Graz, Austria/EUROPE
T:+43 316 6002 395 M:+43 699 14102026

Re: Groosh 0.3.0 released

by glaforge :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Congratulations!

You could also post this announcement in the Groovy news?

On Wed, Mar 26, 2008 at 10:34 PM, Alexander Egger
<alexander.egger@...> wrote:

> Version 0.3.0 of Groosh (http://groovy.codehaus.org/Groosh) has been
> released.
>
>  Groosh provides shell-like capability for handling external processes.
>
>  Version 0.3.0 comes with several bug fixes and new features like:
>
>   * The error stream of a process is now usable the same way as the output
> stream (useError()).
>  * A grep method was added which can be used to filter the lines returned by
> a process.
>  * A to List method was added which creates a list out of the lines returned
> by a process.
>   * A eachLine method was added which iterates over the lines returned by a
> process.
>  * The exit values of a process are now accessible. (Thx to Bill Burdick)
>  * left shift and right shift operators are overloaded for processes and
> stream sinks.
>   * the pipe operator was overloaded to allow chaining of processes
>
>
> Groosh 0.3.0 can be downloaded from
>
>  http://svn.codehaus.org/groovy-contrib/groosh/releases/
>
>  OpenSUSE RPM packages are available from
>
>  http://download.opensuse.org/repositories/home:/eggeral/openSUSE_10.3/
>  and
>  http://download.opensuse.org/repositories/home:/eggeral/openSUSE_10.2/
>
> The following example shows Groovy and Groosh in action. It uploads images
> from a directory to Flickr using
> the command line tool flickcurl and creates a photo set out of this images.
>
> --
>
> import static groosh.Groosh.groosh
> import static org.codehaus.groovy.groosh.stream.DevNull.devnull
>
> ids = [:]
> shell = groosh()
>
> //get all images in this folder and upload it to flickr
>  //remember the photo id we get from flickr
> shell.ls().grep(~/.*jpg/).each {
>   println "Uploading file $it to flickr"
>   flickcurl = shell.flickcurl("upload",it,"friend","family").useError(true)
>    id = flickcurl.grep(~/.*Photo ID.*/)[0].split(":")[1].trim()
>   ids[it] = id
>   println "Photo ID is: $id"
> }
> //we need to know the first photo id
> firstKey = ids.keySet().toList()[0]
>
>  //create a set with the name of the directory we are in right now
> //use the id of the first photo as set cover
> setName = shell.pwd().text.split("/")[-1]
> println "Creating set: $setName"
> flickcurl =
> shell.flickcurl("photosets.create",setName,setName,ids[firstKey]).useError(true)
>  id = flickcurl.grep(~/.*Photoset.*/)[0].split(" ")[2].trim()
> println "Photoset ID is: $id"
>
> //make a backup of the ids in a file for later reference
> println "Writing ids to a file"
>  file = new File(shell.pwd().text.trim() + "/.flickrset")
> file << "Photoset:" << id << "\n"
> ids.each {
>   file << it.key << ":" << it.value << "\n"
>  }
>
> //the first photo is allready part of the photo set so lets remove it
> ids.remove(firstKey)
>
> //add the remaining photos to the photo set
> ids.each {
>   println "Adding photo to set at flickr: $it"
>    shell.flickcurl("photosets.addPhoto",id,it.value) | devnull()
> }
>
> println "DONE"
>
>
> --
> Dr. Alexander Egger, Studiengang IT & IT-Marketing
> CAMPUS 02 Fachhochschule der Wirtschaft GmbH
>  Körblergasse 126, 8021 Graz, Austria/EUROPE
> T:+43 316 6002 395 M:+43 699 14102026



--
Guillaume Laforge
Groovy Project Manager
G2One, Inc. Vice-President Technology
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email