2015-06-28 02:20:07 +00:00
|
|
|
require('shelljs/global');
|
|
|
|
|
2015-07-13 02:11:59 +00:00
|
|
|
ipfs = function(build_dir) {
|
2016-01-11 14:54:02 +00:00
|
|
|
ipfs_bin = exec('which ipfs').output.split("\n")[0]
|
2015-06-28 02:20:07 +00:00
|
|
|
|
2016-01-11 14:54:02 +00:00
|
|
|
if (ipfs_bin==='ipfs not found'){
|
|
|
|
console.log('=== WARNING: IPFS not in an executable path. Guessing ~/go/bin/ipfs for path')
|
|
|
|
ipfs_bin = "~/go/bin/ipfs";
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd = ipfs_bin + " add -r " + build_dir;
|
2015-06-28 02:20:07 +00:00
|
|
|
|
2015-07-04 02:27:17 +00:00
|
|
|
console.log("=== adding " + cmd + " to ipfs");
|
2015-06-28 02:20:07 +00:00
|
|
|
|
|
|
|
result = exec(cmd);
|
|
|
|
|
|
|
|
rows = result.output.split("\n");
|
|
|
|
|
|
|
|
dir_row = rows[rows.length - 2];
|
|
|
|
|
|
|
|
dir_hash = dir_row.split(" ")[1];
|
|
|
|
|
|
|
|
console.log("=== DApp available at http://localhost:8080/ipfs/" + dir_hash + "/");
|
|
|
|
|
|
|
|
console.log("=== DApp available at http://gateway.ipfs.io/ipfs/" + dir_hash + "/");
|
|
|
|
}
|
|
|
|
|
|
|
|
Release = {
|
|
|
|
ipfs: ipfs
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Release
|
|
|
|
|