mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-30 14:17:40 +00:00
Updated bake to support svn and local or remote rsync. Updated example bakefile.
This commit is contained in:
+23
-7
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user