3 /*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
4 regexp:true, undef:true, strict:true, trailing:true, white:true */
8 // This file really just parses the arguments, and sends the real work
9 // off to scripts/lib/build_all.js.
15 var fs = require("fs"),
16 program = require("commander"),
17 path = require("path"),
18 buildDatabaseUtil = require("./lib/build_database_util");
21 .option('-m, --manifest [/path/to/manifest.js]', 'Location of manifest file.')
22 .option('-n, --name [inventory_upgrade.sql]', 'Name of destination file.')
25 // the path is not relative if it starts with a slash
26 var manifestPath = program.manifest.substring(0, 1) === '/' ?
28 path.join(process.cwd(), program.manifest);
30 buildDatabaseUtil.explodeManifest(manifestPath, {}, function (err, contents) {
33 console.log("error: ", err);
36 if (!fs.existsSync(path.join(__dirname, "output"))) {
37 fs.mkdirSync(path.join(__dirname, "output"));
40 outputFile = path.join(__dirname, "output", program.name);
41 fs.writeFile(outputFile, contents, function (err, res) {
43 console.log("error: ", err);
46 console.log("File successfully written as ", outputFile);