From d6c0f8802a2fd3a07e14418de7744ae04ae4499e Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Sun, 28 Sep 2008 17:52:33 -0700 Subject: [PATCH] Updated bake to support svn and local or remote rsync. Updated example bakefile. --- Tools/bake/bake.j | 30 +++++++++++++++++++++++------- Tools/bake/example.bakefile | 18 ++++++++++++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Tools/bake/bake.j b/Tools/bake/bake.j index bcb790a9c..906dd90f3 100644 --- a/Tools/bake/bake.j +++ b/Tools/bake/bake.j @@ -38,22 +38,39 @@ function update() for (var i = 0; i < options.sources.length; i++) { var source = options.sources[i]; - var sourcePath = checkoutsPath + "/" + source.path.match(new RegExp("[^\\/]+$"))[0]; + + source.localSourcePath = checkoutsPath + "/" + source.path.replace(/\W+/g, "_"); switch (source.type) { case "git": - if (new File(sourcePath).isDirectory()) + if (new File(source.localSourcePath).isDirectory()) { - CPLog.debug("git pull (" + sourcePath + ")"); - exec("git pull", null, new File(sourcePath)); + CPLog.debug("git pull (" + source.localSourcePath + ")"); + exec("git pull", null, new File(source.localSourcePath)); } else { CPLog.debug("git clone (" + source.path + ")"); - exec(["git", "clone", source.path, sourcePath]); + exec(["git", "clone", source.path, source.localSourcePath]); } break; + case "svn": + if (new File(source.localSourcePath).isDirectory()) + { + CPLog.debug("svn up (" + source.localSourcePath + ")"); + exec("svn up", null, new File(source.localSourcePath)); + } + else + { + CPLog.debug("svn co (" + source.path + ")"); + exec(["svn", "co", source.path, source.localSourcePath]); + } + break; + case "rsync": + CPLog.debug("rsync (" + source.localSourcePath + ")"); + exec(["rsync", "-avz", source.path + "/", source.localSourcePath]); + break; default : CPLog.error("Unimplemented: " + source.type); } @@ -69,12 +86,11 @@ function build() for (var i = 0; i < options.sources.length; i++) { var source = options.sources[i]; - var sourcePath = checkoutsPath + "/" + source.path.match(/[^\/]+$/)[0]; for (var j = 0; j < source.parts.length; j++) { var part = source.parts[j]; - var fromPath = sourcePath + "/" + part.src; + var fromPath = source.localSourcePath + "/" + part.src; var toPath = versionedPath + "/" + part.dst; if (part.build) diff --git a/Tools/bake/example.bakefile b/Tools/bake/example.bakefile index 180f1414f..e87955c35 100644 --- a/Tools/bake/example.bakefile +++ b/Tools/bake/example.bakefile @@ -25,12 +25,22 @@ ] }, { - "type" : "git", - "server" : "ssh://git@git.myserver.com/home/git/myapp.git", + "type" : "rsync", + "path" : "/Users/username/projects/NewApplication", "parts" : [ { - "src" : "Editor/Server", - "dst" : "Server" + "src" : "", + "dst" : "Blah" + } + ] + }, + { + "type" : "svn", + "path" : "https://svn.youserver.com/Project/trunk", + "parts" : [ + { + "src" : "subdirectory", + "dst" : "Something" } ] }