Merge pull request #354 from embark-framework/bug_fix/embark-upload-windows

Fix upload on Windows
This commit is contained in:
Jonathan Rainville 2018-04-10 16:40:47 -04:00 committed by GitHub
commit 6e87085cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -16,9 +16,9 @@ class IPFS {
let self = this; let self = this;
async.waterfall([ async.waterfall([
function findBinary(callback) { function findBinary(callback) {
let ipfs_bin = shelljs.exec('which ' + self.configIpfsBin).output.split("\n")[0]; let ipfs_bin = shelljs.which(self.configIpfsBin);
if (ipfs_bin === 'ipfs not found' || ipfs_bin === '') { if (ipfs_bin === 'ipfs not found' || !ipfs_bin) {
console.log(('=== WARNING: ' + self.configIpfsBin + ' not found or not in the path. Guessing ~/go/bin/ipfs for path').yellow); console.log(('=== WARNING: ' + self.configIpfsBin + ' not found or not in the path. Guessing ~/go/bin/ipfs for path').yellow);
ipfs_bin = "~/go/bin/ipfs"; ipfs_bin = "~/go/bin/ipfs";
} }
@ -26,7 +26,7 @@ class IPFS {
return callback(null, ipfs_bin); return callback(null, ipfs_bin);
}, },
function runCommand(ipfs_bin, callback) { function runCommand(ipfs_bin, callback) {
let cmd = ipfs_bin + " add -r " + self.buildDir; let cmd = `"${ipfs_bin}" add -r ${self.buildDir}`;
console.log(("=== adding " + self.buildDir + " to ipfs").green); console.log(("=== adding " + self.buildDir + " to ipfs").green);
console.log(cmd.green); console.log(cmd.green);
let result = shelljs.exec(cmd); let result = shelljs.exec(cmd);

View File

@ -12,9 +12,9 @@ class Swarm {
let self = this; let self = this;
async.waterfall([ async.waterfall([
function findBinary(callback) { function findBinary(callback) {
let swarm_bin = shelljs.exec('which swarm').output.split("\n")[0]; let swarm_bin = shelljs.which('swarm');
if (swarm_bin === 'swarm not found' || swarm_bin === '') { if (swarm_bin === 'swarm not found' || !swarm_bin) {
console.log('=== WARNING: Swarm not in an executable path. Guessing ~/go/bin/swarm for path'.yellow); console.log('=== WARNING: Swarm not in an executable path. Guessing ~/go/bin/swarm for path'.yellow);
swarm_bin = "~/go/bin/swarm"; swarm_bin = "~/go/bin/swarm";
} }
@ -22,7 +22,7 @@ class Swarm {
return callback(null, swarm_bin); return callback(null, swarm_bin);
}, },
function runCommand(swarm_bin, callback) { function runCommand(swarm_bin, callback) {
let cmd = swarm_bin + " --defaultpath " + self.buildDir + "index.html --recursive up " + self.buildDir; let cmd = `"${swarm_bin}" --defaultpath ${self.buildDir} index.html --recursive up ${self.buildDir}`;
console.log(("=== adding " + self.buildDir + " to swarm").green); console.log(("=== adding " + self.buildDir + " to swarm").green);
console.log(cmd.green); console.log(cmd.green);
let result = shelljs.exec(cmd); let result = shelljs.exec(cmd);