refactor deployments to upload command
This commit is contained in:
parent
15b8d9b33e
commit
c53d92baa5
26
lib/cmd.js
26
lib/cmd.js
|
@ -14,8 +14,7 @@ Cmd.prototype.process = function(args) {
|
||||||
this.blockchain();
|
this.blockchain();
|
||||||
this.simulator();
|
this.simulator();
|
||||||
this.test();
|
this.test();
|
||||||
this.ipfs();
|
this.upload();
|
||||||
this.swarm();
|
|
||||||
this.otherCommands();
|
this.otherCommands();
|
||||||
program.parse(args);
|
program.parse(args);
|
||||||
};
|
};
|
||||||
|
@ -138,24 +137,17 @@ Cmd.prototype.test = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: replace both of this with a deploy/upload command
|
Cmd.prototype.upload = function() {
|
||||||
Cmd.prototype.ipfs = function() {
|
|
||||||
var self = this;
|
var self = this;
|
||||||
program
|
program
|
||||||
.command('ipfs')
|
.command('upload [platform]')
|
||||||
.description('deploy to IPFS')
|
.description('upload your dapp to a decentralized storage. possible options: ipfs, swarm (e.g embark upload swarm)')
|
||||||
.action(function() {
|
.action(function(platform ,options) {
|
||||||
self.Embark.ipfs();
|
// TODO: get env in cmd line as well
|
||||||
|
self.Embark.initConfig('development', {
|
||||||
|
embarkConfig: 'embark.json'
|
||||||
});
|
});
|
||||||
};
|
self.Embark.upload(platform);
|
||||||
|
|
||||||
Cmd.prototype.swarm = function() {
|
|
||||||
var self = this;
|
|
||||||
program
|
|
||||||
.command('swarm')
|
|
||||||
.description('deploy to SWARM')
|
|
||||||
.action(function() {
|
|
||||||
self.Embark.swarm();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
12
lib/index.js
12
lib/index.js
|
@ -302,16 +302,18 @@ var Embark = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: should deploy if it hasn't already
|
// TODO: should deploy if it hasn't already
|
||||||
ipfs: function() {
|
upload: function(platform) {
|
||||||
|
if (platform === 'ipfs') {
|
||||||
var ipfs = new IPFS({buildDir: 'dist/'});
|
var ipfs = new IPFS({buildDir: 'dist/'});
|
||||||
ipfs.deploy();
|
ipfs.deploy();
|
||||||
},
|
} else if (platform === 'swarm') {
|
||||||
|
|
||||||
// TODO: should deploy if it hasn't already
|
|
||||||
swarm: function() {
|
|
||||||
var swarm = new Swarm({buildDir: 'dist/'});
|
var swarm = new Swarm({buildDir: 'dist/'});
|
||||||
swarm.deploy();
|
swarm.deploy();
|
||||||
|
} else {
|
||||||
|
console.log(("unknown platform: " + platform).red);
|
||||||
|
console.log('try "embark upload ipfs" or "embark upload swarm"'.green);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue