Added ApplicationTask#setFrameworks path. The default is local frameworks, you could also use ENV.CAPP_BUILD or pass capp to use the installed frameworks.

This commit is contained in:
Nicholas Small committed 2010-02-03 11:43:48 -05:00
1 parent 21ef259e1f
commit 972909902e
1 file changed
+37 -8
@@ -1,5 +1,6 @@
var FILE = require("file"),
OS = require("OS"),
Jake = require("jake"),
BundleTask = require("objective-j/jake/bundletask").BundleTask;
@@ -11,6 +12,11 @@ function ApplicationTask(aName)
this._indexFilePath = "index.html";
else
this._indexFilePath = null;
if (FILE.exists("Frameworks"))
this._frameworksPath = "Frameworks";
else
this._frameworksPath = null;
}
ApplicationTask.__proto__ = BundleTask;
@@ -39,21 +45,44 @@ ApplicationTask.prototype.indexFilePath = function()
return this._indexFilePath;
}
ApplicationTask.prototype.setFrameworksPath = function(aFrameworksPath)
{
// The default will use local app frameworks
// Pass in ENV["CAPP_BUILD"] to use your built frameworks
// Pass in "capp" to use installed frameworks
this._frameworksPath = aFrameworksPath;
}
ApplicationTask.prototype.frameworksPath = function()
{
return this._frameworksPath;
}
ApplicationTask.prototype.defineFrameworksTask = function()
{
// FIXME: platform requires...
if (this.environments().indexOf(require("objective-j/jake/environment").Browser) === -1)
if (!this._frameworksPath && this.environments().indexOf(require("objective-j/jake/environment").Browser) === -1)
return;
var frameworks = FILE.join(this.buildProductPath(), "Frameworks"),
var buildPath = this.buildProductPath(),
newFrameworks = FILE.join(buildPath, "Frameworks"),
thisTask = this;
Jake.fileCreate(frameworks, function()
Jake.fileCreate(newFrameworks, function()
{
OS.system("capp gen -f " + thisTask.buildProductPath());
if (thisTask._frameworksPath === "capp")
OS.system("capp gen -f --force " + buildPath);
else if (thisTask._frameworksPath)
{
if (FILE.exists(newFrameworks))
FILE.rmtree(newFrameworks);
FILE.copyTree(thisTask._frameworksPath, newFrameworks);
}
});
this.enhance([frameworks]);
this.enhance([newFrameworks]);
}
ApplicationTask.prototype.buildIndexFilePath = function()