add reset cmd
This commit is contained in:
parent
3c8b10d597
commit
61c00819ec
14
lib/cmd.js
14
lib/cmd.js
|
@ -17,6 +17,7 @@ class Cmd {
|
||||||
this.blockchain();
|
this.blockchain();
|
||||||
this.simulator();
|
this.simulator();
|
||||||
this.test();
|
this.test();
|
||||||
|
this.reset();
|
||||||
this.upload();
|
this.upload();
|
||||||
this.versionCmd();
|
this.versionCmd();
|
||||||
this.otherCommands();
|
this.otherCommands();
|
||||||
|
@ -168,6 +169,19 @@ class Cmd {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
program
|
||||||
|
.command('reset')
|
||||||
|
.description('resets embarks state on this dapp including clearing cache')
|
||||||
|
.action(function (file) {
|
||||||
|
embark.initConfig('development', {
|
||||||
|
embarkConfig: 'embark.json', interceptLogs: false
|
||||||
|
});
|
||||||
|
embark.reset();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
versionCmd() {
|
versionCmd() {
|
||||||
program
|
program
|
||||||
.command('version')
|
.command('version')
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
var fs = require('../core/fs.js');
|
||||||
|
|
||||||
|
module.exports = function() {
|
||||||
|
fs.removeSync('./chains.json');
|
||||||
|
fs.removeSync('.embark/');
|
||||||
|
fs.removeSync('dist/');
|
||||||
|
console.log("reset done!".green);
|
||||||
|
};
|
|
@ -37,6 +37,10 @@ function existsSync() {
|
||||||
return fs.existsSync.apply(fs.existsSync, arguments);
|
return fs.existsSync.apply(fs.existsSync, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeSync() {
|
||||||
|
return fs.removeSync.apply(fs.removeSync, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
// returns embarks root directory
|
// returns embarks root directory
|
||||||
function embarkPath(fileOrDir) {
|
function embarkPath(fileOrDir) {
|
||||||
return utils.joinPath(__dirname, '/../../', fileOrDir);
|
return utils.joinPath(__dirname, '/../../', fileOrDir);
|
||||||
|
@ -54,6 +58,7 @@ module.exports = {
|
||||||
readJSONSync: readJSONSync,
|
readJSONSync: readJSONSync,
|
||||||
writeJSONSync: writeJSONSync,
|
writeJSONSync: writeJSONSync,
|
||||||
existsSync: existsSync,
|
existsSync: existsSync,
|
||||||
|
removeSync: removeSync,
|
||||||
embarkPath: embarkPath,
|
embarkPath: embarkPath,
|
||||||
dappPath: dappPath
|
dappPath: dappPath
|
||||||
};
|
};
|
||||||
|
|
|
@ -189,6 +189,11 @@ class Embark {
|
||||||
return new Test(options);
|
return new Test(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
let resetCmd = require('./cmds/reset.js');
|
||||||
|
resetCmd();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: should deploy if it hasn't already
|
// TODO: should deploy if it hasn't already
|
||||||
upload(platform) {
|
upload(platform) {
|
||||||
let options = {
|
let options = {
|
||||||
|
|
Loading…
Reference in New Issue