Skip to content

Commit

Permalink
--bundle-loader support
Browse files Browse the repository at this point in the history
  • Loading branch information
cadorn committed Oct 3, 2011
1 parent dcf7edb commit 313332e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/pinf-loader-js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,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("--bundle-loader").bool().help("Bundle the loader into one file for use on a specific platform. Arguments: <PlatformAlias> <TargetFilePath>");
optParser.option("--init-program").set().help("Path to root of program to initialize/create");
optParser.option("--init-package").set().help("Path to root of package to initialize/create");
optParser.option("--link-program-to").set().help("Link the program package to the given directory");
Expand Down Expand Up @@ -380,6 +381,26 @@ var boot = exports.boot = function(options)
API.SYSTEM.print("\0green(" + "Initialized package with UID '" + uid + "' at: " + initPath + "\0)\n");
return;
}

// TODO: Move `--bundle-loader` elsewhere to keep this module cleaner.
if (cliOptions["bundle-loader"])
{
if (cliOptions.args.length !== 2)
{
API.SYSTEM.print("\0red(" + "Invalid arguments. Must specify: <PlatformAlias> <TargetFilePath>" + "\0)\n");
return;
}

boot({
program: API.FILE.dirname(API.FILE.dirname(API.FILE.dirname(module.id))) + "/programs/bundle-loader/program.json",
args: [
"--adapter"
].concat(cliOptions.args),
platformRequire: API.ENV.platformRequire
});
return;
}


function run()
{
Expand Down
2 changes: 2 additions & 0 deletions programs/bundle-loader/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ exports.main = function(env)
if (outputPath.charAt(0) != "/")
outputPath = process.cwd() + "/" + outputPath;

outputPath = PATH.normalize(outputPath);

var files = SCANNER.scan(PATH.dirname(PATH.dirname(PATH.dirname(module.id))) + "/lib/pinf-loader-js", {
platform: platform,
textFiles: [
Expand Down

0 comments on commit 313332e

Please sign in to comment.