Updated bake to support svn and local or remote rsync. Updated example bakefile.

This commit is contained in:
Tom Robinson
2008-09-28 17:52:33 -07:00
parent c943eefec3
commit d6c0f8802a
2 changed files with 37 additions and 11 deletions
+23 -7
View File
@@ -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)
+14 -4
View File
@@ -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"
}
]
}