Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var parts = fs.split(entry.getName());
parts.shift(); // name-project-comment ref dirname
var path = targetPath.join(fs.join.apply(null, parts));
path.dirname().mkdirs();
notes[name].files.push(path);
print(" + " + path);
path.write(entry.read('b'), 'b');
});
}
// write package.json if it was not in the
// archive
var packageJson = targetPath.join('package.json');
if (!packageJson.isFile())
packageJson.write(
json.encode(catalog.packages[name], null, 4),
{'charset': 'UTF-8'}
);
// make bins executable and make symlinks
// in $SEA/bin
var bin = targetPath.join('bin');
if (bin.isDirectory())
bin.list().forEach(function (name) {
var target = targetPath.join('bin', name);
target.chmod(0755);
var sea = tusk.getDirectory().join('bin');
var source = sea.join(name);
var relative = sea.to(target);
if (!source.linkExists() && !source.exists()) {
target.symlink(source);
}
var parts = fs.split(entry.getName());
parts.shift(); // name-project-comment ref dirname
var path = targetPath.join(fs.join.apply(null, parts));
path.dirname().mkdirs();
notes[name].files.push(path);
print(" + " + path);
path.write(entry.read('b'), 'b');
});
}
// write package.json if it was not in the
// archive
var packageJson = targetPath.join('package.json');
if (!packageJson.isFile())
packageJson.write(
json.encode(catalog.packages[name], null, 4),
{'charset': 'UTF-8'}
);
// make bins executable and make symlinks
// in $SEA/bin
var bin = targetPath.join('bin');
if (bin.isDirectory())
bin.list().forEach(function (name) {
var target = targetPath.join('bin', name);
target.chmod(0755);
var sea = tusk.getDirectory().join('bin');
var source = sea.join(name);
var relative = sea.to(target);
if (!source.linkExists() && !source.exists()) {
target.symlink(source);
}
_saveMetadata: function() {
// Note: there should be some kind of file locking here!
var rawdata = json.encode(this.metadata);
rawdata = rawdata.toBinary();
this.metadataFile.write(rawdata);
}
}
var process = require('process');
var json = require('json');
console.log(json.encode(process.argv));
process.exitCode = 2;
var process = require('process');
var json = require('json');
console.log(json.encode(process.execArgv));
process.exitCode = 3;
exports.writeCatalog = function (catalog) {
var catalogPath = exports.getCatalogPath();
print('Writing ' + catalogPath);
return catalogPath.write(
json.encode(catalog, null, 4),
{charset: 'utf-8'}
);
};
exports.writeSources = function (sources) {
return exports.getSourcesPath().write(
json.encode(sources, null, 4),
{charset: 'utf-8'}
);
};
if (entry.name == "package.json") {
destination = packagesDir.join(pack.name + ".json");
} else {
destination = root.join(entry.name);
}
filelist.push(root.to(destination));
zf.saveFile(entry, destination);
}
zf.close();
var fl = packagesDir.join(pack.name + ".filelist");
filelist.push(root.to(fl));
fl.write(json.encode(filelist));
}
};
var activate = path.join('bin', 'activate.bash');
fs.path(system.prefix).join('bin', 'activate.bash')
.copy(activate);
activate.relative().symlink(activate.resolve('activate'));
path.join('README').touch();
path.join('narwhal.conf')
.write('NARWHAL_DEFAULT_ENGINE=' + system.engine);
var packagePath = path.join('package.json');
if (packagePath.isFile())
util.complete(
packageInfo,
json.decode(packagePath.read({charset:'utf-8'}))
);
packagePath.write(
json.encode(packageInfo, null, 4),
{charset:'utf-8'}
);
});
exports.writeNotes = function (notes) {
return exports.getNotesPath().write(
json.encode(notes, null, 4),
{charset: 'utf-8'}
);
};