Created
February 21, 2012 07:52
-
-
Save gAmUssA/1874976 to your computer and use it in GitHub Desktop.
Install new version of groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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