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.simulator();
|
||||
this.test();
|
||||
this.ipfs();
|
||||
this.swarm();
|
||||
this.upload();
|
||||
this.otherCommands();
|
||||
program.parse(args);
|
||||
};
|
||||
|
@ -138,24 +137,17 @@ Cmd.prototype.test = function() {
|
|||
});
|
||||
};
|
||||
|
||||
// TODO: replace both of this with a deploy/upload command
|
||||
Cmd.prototype.ipfs = function() {
|
||||
Cmd.prototype.upload = function() {
|
||||
var self = this;
|
||||
program
|
||||
.command('ipfs')
|
||||
.description('deploy to IPFS')
|
||||
.action(function() {
|
||||
self.Embark.ipfs();
|
||||
.command('upload [platform]')
|
||||
.description('upload your dapp to a decentralized storage. possible options: ipfs, swarm (e.g embark upload swarm)')
|
||||
.action(function(platform ,options) {
|
||||
// TODO: get env in cmd line as well
|
||||
self.Embark.initConfig('development', {
|
||||
embarkConfig: 'embark.json'
|
||||
});
|
||||
};
|
||||
|
||||
Cmd.prototype.swarm = function() {
|
||||
var self = this;
|
||||
program
|
||||
.command('swarm')
|
||||
.description('deploy to SWARM')
|
||||
.action(function() {
|
||||
self.Embark.swarm();
|
||||
self.Embark.upload(platform);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
12
lib/index.js
12
lib/index.js
|
@ -302,16 +302,18 @@ var Embark = {
|
|||
},
|
||||
|
||||
// TODO: should deploy if it hasn't already
|
||||
ipfs: function() {
|
||||
upload: function(platform) {
|
||||
if (platform === 'ipfs') {
|
||||
var ipfs = new IPFS({buildDir: 'dist/'});
|
||||
ipfs.deploy();
|
||||
},
|
||||
|
||||
// TODO: should deploy if it hasn't already
|
||||
swarm: function() {
|
||||
} else if (platform === 'swarm') {
|
||||
var swarm = new Swarm({buildDir: 'dist/'});
|
||||
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