From 14e43ea5f74444483d4ee9abee9baa70beca480a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 5 Jun 2015 22:54:37 -0400 Subject: [PATCH] add ipfs release task --- tasks/ipfs.coffee | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tasks/ipfs.coffee diff --git a/tasks/ipfs.coffee b/tasks/ipfs.coffee new file mode 100644 index 000000000..25e13c2b3 --- /dev/null +++ b/tasks/ipfs.coffee @@ -0,0 +1,19 @@ +module.exports = (grunt) -> + require('shelljs/global') + + grunt.registerTask "ipfs", "distribute into ipfs", (env_) => + env = env_ || "development" + + ipfs_path = "~/go/bin" + build_dir = "dist/dapp/" + cmd = "#{ipfs_path}/ipfs add -r #{build_dir}" + + grunt.log.writeln("=== adding #{cmd} to ipfs") + result = exec(cmd) + + rows = result.output.split("\n") + dir_row = rows[rows.length - 2] + dir_hash = dir_row.split(" ")[1] + + grunt.log.writeln("=== DApp available at http://localhost:8080/ipfs/#{dir_hash}/") +