Skip to content

Instantly share code, notes, and snippets.

@gAmUssA
Created February 21, 2012 07:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gAmUssA/1874976 to your computer and use it in GitHub Desktop.
Save gAmUssA/1874976 to your computer and use it in GitHub Desktop.
Install new version of groovy
if(args.size()!=1){
println "start with sudo groovy install <version-number>"
System.exit 1
}
final version = args[0]
final installDir = "/usr/lib/"
final base = "http://dist.groovy.codehaus.org/distributions/"
final urls = [
"groovy-binary-${version}.zip",
"groovy-src-${version}.zip",
"groovy-docs-${version}.zip",
]
final ant=new AntBuilder()
for (file in urls){
ant.get src: base+file, dest: installDir+file, verbose: true
ant.unzip src: installDir+file, dest: installDir
ant.delete file: installDir+file
}
new File(installDir+"groovy-${version}/bin/").eachFile{
if (! it.name.contains(".")) {
ant.chmod file: it, perm: "775"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment