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.simulator();
|
||||
this.test();
|
||||
this.reset();
|
||||
this.upload();
|
||||
this.versionCmd();
|
||||
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() {
|
||||
program
|
||||
.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);
|
||||
}
|
||||
|
||||
function removeSync() {
|
||||
return fs.removeSync.apply(fs.removeSync, arguments);
|
||||
}
|
||||
|
||||
// returns embarks root directory
|
||||
function embarkPath(fileOrDir) {
|
||||
return utils.joinPath(__dirname, '/../../', fileOrDir);
|
||||
|
@ -54,6 +58,7 @@ module.exports = {
|
|||
readJSONSync: readJSONSync,
|
||||
writeJSONSync: writeJSONSync,
|
||||
existsSync: existsSync,
|
||||
removeSync: removeSync,
|
||||
embarkPath: embarkPath,
|
||||
dappPath: dappPath
|
||||
};
|
||||
|
|
|
@ -189,6 +189,11 @@ class Embark {
|
|||
return new Test(options);
|
||||
}
|
||||
|
||||
reset() {
|
||||
let resetCmd = require('./cmds/reset.js');
|
||||
resetCmd();
|
||||
}
|
||||
|
||||
// TODO: should deploy if it hasn't already
|
||||
upload(platform) {
|
||||
let options = {
|
||||
|
|
Loading…
Reference in New Issue