Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = binwrap({
binaries: [
"myapp-cli"
],
binariesPath: 'in case your binaries are nested inside the unpacked folder'
urls: {
"darwin-x64": root + "/mac-x64.tgz",
"linux-x64": root + "/linux-x64.tgz",
Expand Down
2 changes: 1 addition & 1 deletion binstub.js.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (os == "win32") {
binExt = ".exe";
}

var unpackedBinPath = path.join(__dirname, "..", "unpacked_bin");
var unpackedBinPath = path.join(__dirname, "..", "unpacked_bin", "{{ binariesPath }}");
var binPath = path.join(unpackedBinPath, "{{ binName }}" + binExt);

function execBin() {
Expand Down
5 changes: 5 additions & 0 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ module.exports = function install(config, unpackedBinPath, os, arch) {

var buildId = os + "-" + arch;
var url = config.urls[buildId];

if (!url) {
throw new Error("No binaries are available for your platform: " + buildId);
}
return binstall(url, unpackedBinPath).then(function() {
config.binaries.forEach(function(bin) {
if (config.binariesPath) {
unpackedBinPath = path.join(unpackedBinPath, config.binariesPath);
}

fs.chmodSync(path.join(unpackedBinPath, bin + binExt), "755");
});
});
Expand Down
2 changes: 1 addition & 1 deletion prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function prepare(config) {

config.binaries.forEach(function(bin) {
var binPath = path.join("bin", bin);
var content = mustache.render(binstubTemplate, { binName: bin });
var content = mustache.render(binstubTemplate, { binName: bin, binariesPath: config.binariesPath });
fs.writeFileSync(binPath, content);
fs.chmodSync(binPath, "755");
});
Expand Down