-
-
Save lucastex/217491 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import java.util.zip.* | |
import org.tmatesoft.svn.core.internal.io.dav.* | |
import org.tmatesoft.svn.core.wc.* | |
import org.tmatesoft.svn.core.* | |
@Grab(group='com.svnkit', module='svnkit', version='1.1.0') | |
def setup(projectName) { | |
File.metaClass.plus = { String c -> new File(delegate, c) } | |
DAVRepositoryFactory.setup(); | |
def dest = new File("./$projectName"); | |
def svnUrl = SVNURL.parseURIEncoded('http://gcrnagoya.googlecode.com/svn/trunk/gaelyk-eclipse-addon') | |
def client = SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true), null, null).getUpdateClient() | |
client.doExport(svnUrl, dest, SVNRevision.HEAD, SVNRevision.HEAD, null, false, true) | |
def zip = new ZipInputStream("http://cloud.github.com/downloads/glaforge/gaelyk/gaelyk-template-project-0.2.zip".toURL().openStream()) | |
def entry | |
while (entry = zip.nextEntry) { | |
if (entry.directory) (dest + entry.name).mkdirs() | |
else dest + entry.name << zip | |
} | |
def replaceToProjectName = { file, word -> file.text = file.text.replaceAll(word, projectName) } | |
replaceToProjectName(dest + '.project', 'gaelyk-project') | |
replaceToProjectName(dest + 'war/WEB-INF/appengine-web.xml', 'myappid') | |
(dest + '.project-e').delete() | |
(dest + 'war/WEB-INF/appengine-web.xml-e').delete() | |
} | |
setup(args[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment