Skip to content
Browse files

--link-program-to option

boot: false in program.json
  • Loading branch information...
1 parent 2a9f62e commit ab2748ee29600e848d71f9c82fbaae41075dd3cb @cadorn cadorn committed Aug 23, 2011
Showing with 36 additions and 1 deletion.
  1. +5 −0 lib/pinf-loader-js/descriptors.js
  2. +23 −0 lib/pinf-loader-js/loader.js
  3. +8 −1 lib/pinf-loader-js/program.js
View
5 lib/pinf-loader-js/descriptors.js
@@ -309,6 +309,11 @@ Program.prototype.walkBoot = function(callback)
{
if (typeof this.json.boot == "undefined")
throw this.validationError("Property 'boot' is not defined");
+ if (typeof this.json.boot == "boolean") {
+ if (this.json.boot !== false)
+ throw this.validationError("Property 'boot' must be set to a string or `false`");
+ callback(false);
+ } else
if (typeof this.json.boot == "string")
callback(this._validateBoot(this.json.boot));
else
View
23 lib/pinf-loader-js/loader.js
@@ -107,6 +107,7 @@ var boot = exports.boot = function(options)
optParser.option("--test-platform").set().help("Make sure a platform is working properly");
optParser.option("--sources").set().help("The path to a sources.json file to overlay source repositories");
optParser.option("--script").set().help("Call a script defined in the program boot package");
+ optParser.option("--link-program-to").set().help("Link the program package to the given directory");
optParser.option("--discover-packages").bool().help("Discover all packages and add to program.json");
optParser.option("--clean").bool().help("Removes all downloaded packages first");
optParser.option("--terminate").bool().help("Asks program to terminate if it was going to deamonize (primarily used for testing)");
@@ -287,6 +288,23 @@ var boot = exports.boot = function(options)
}
downloader.basePath = pinfPackagesPath;
+
+
+ if (cliOptions["link-program-to"])
+ {
+ if (!API.FILE.exists(cliOptions["link-program-to"]))
+ {
+ if (!API.FILE.exists(API.FILE.dirname(cliOptions["link-program-to"])))
+ API.FILE.mkdirs(API.FILE.dirname(cliOptions["link-program-to"]), 0775);
+
+ API.SYSTEM.exec("ln -s " + API.FILE.dirname(path) + " " + cliOptions["link-program-to"], function(stdout, stderr)
+ {
+ console.log(stdout);
+ console.log(stderr);
+ });
+ }
+ }
+
API.DEBUG.print("Using program cache directory: " + downloader.basePath);
@@ -379,6 +397,11 @@ var boot = exports.boot = function(options)
// TODO: Keep these references elsewhere so we can have nested sandboxes
API.ENV.program = program;
API.ENV.sandbox = sandbox;
+
+ if (!program.hasBootPackage())
+ {
+ return;
+ }
program.getBootPackages(assembler, function(dependencies)
{
View
9 lib/pinf-loader-js/program.js
@@ -27,7 +27,9 @@ Program.prototype.discoverPackages = function(fetcher, callback, options)
var self = this;
self.descriptor.walkBoot(function(id)
{
- DEBUG.indent(di).print("ID: " + id).indent(di+1);
+ DEBUG.indent(di).print("ID: " + id).indent(di+1);
+
+ if (id === false) return;
fetcher(self.descriptor.locatorForId(id, options), cbt.add(function(pkg, locator)
{
@@ -50,6 +52,11 @@ Program.prototype.discoverPackages = function(fetcher, callback, options)
cbt.done();
}
+Program.prototype.hasBootPackage = function()
+{
+ return (this.descriptor.json.boot!==false)?true:false;
+}
+
Program.prototype.getProviderPackages = function()
{
var self = this,

0 comments on commit ab2748e

Please sign in to comment.
Something went wrong with that request. Please try again.