Skip to content

Commit

Permalink
Merge pull request #192 from PhyrexTsai/master
Browse files Browse the repository at this point in the history
v0.0.51
  • Loading branch information
PhyrexTsai authored Oct 3, 2019
2 parents af0ec9e + d4dbdac commit a8ec8ae
Show file tree
Hide file tree
Showing 18 changed files with 224 additions and 27 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The KAIZEN Platform is currently in experimental alpha.
- [Bluzelle](https://www.npmjs.com/package/bluzelle)
- [NKN](https://www.npmjs.com/package/nkn-client)
- [ICON](https://www.npmjs.com/package/icon-sdk-js)
- [Orbit](https://www.npmjs.com/package/orbit-db)
- NOIA

## <a name="faucet"></a>🚰 Faucet
Expand All @@ -104,5 +105,8 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to help out.

*Quick Start*: Check out [help wanted](https://github.com/PortalNetwork/kaizen-cli/labels/help%20wanted) or [good first issue](https://github.com/PortalNetwork/kaizen-cli/labels/good%20first%20issue) labels to find issues we want to move forward on with your help.

## <a name="contact"></a>📧 Contact
For any questions, please contact [email protected] or join telegram: [http://bit.ly/2XjhQV2](http://bit.ly/2XjhQV2)

## <a name="licence"></a>🗒 Licence
See [LICENSE](./LICENSE) for details.
4 changes: 4 additions & 0 deletions README_KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The KAIZEN Platform is currently in experimental alpha.
- [Bluzelle](https://www.npmjs.com/package/bluzelle)
- [NKN](https://www.npmjs.com/package/nkn-client)
- [ICON](https://www.npmjs.com/package/icon-sdk-js)
- [Orbit](https://www.npmjs.com/package/orbit-db)
- NOIA

## <a name="faucet"></a>🚰 水龍頭
Expand All @@ -104,5 +105,8 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to help out.

*Quick Start*: Check out [help wanted](https://github.com/PortalNetwork/kaizen-cli/labels/help%20wanted) or [good first issue](https://github.com/PortalNetwork/kaizen-cli/labels/good%20first%20issue) labels to find issues we want to move forward on with your help.

## <a name="contact"></a>📧 Contact
For any questions, please contact [email protected] or join telegram: [http://bit.ly/2XjhQV2](http://bit.ly/2XjhQV2)

## <a name="licence"></a>🗒 라이센스
[LICENSE](./LICENSE) 참조하기
4 changes: 4 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ KAIZEN Platform 目前正在 Alpha 階段
- [Bluzelle](https://www.npmjs.com/package/bluzelle)
- [NKN](https://www.npmjs.com/package/nkn-client)
- [ICON](https://www.npmjs.com/package/icon-sdk-js)
- [Orbit](https://www.npmjs.com/package/orbit-db)
- NOIA

## <a name="faucet"></a>🚰 水龍頭
Expand All @@ -104,5 +105,8 @@ KAIZEN Faucet 支援下列區塊鏈測試網路的代幣

*快速開始:您可以透過 [help wanted](https://github.com/PortalNetwork/kaizen-cli/labels/help%20wanted) 或者 [good first issue](https://github.com/PortalNetwork/kaizen-cli/labels/good%20first%20issue) 標籤找到可以參與貢獻的任務。

## <a name="contact"></a>📧 聯絡
如果您有任何問題請聯繫 [email protected] 或者加入我們的 Telegram: [http://bit.ly/2XjhQV2](http://bit.ly/2XjhQV2)

## <a name="licence"></a>🗒 許可證
詳細內容請參考 [LICENSE](./LICENSE)
35 changes: 24 additions & 11 deletions build/components/Plugins/Install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var nknHandler = require('./nkn.js');

var iconHandler = require('./icon.js');

var orbitHandler = require('./orbit.js');

function builder(yargs) {
return yargs.positional('plugin', {
alias: 'p',
Expand Down Expand Up @@ -64,7 +66,7 @@ function _handler() {

case 8:
_context.t0 = plugin;
_context.next = _context.t0 === 'bluzelle' ? 11 : _context.t0 === 'nkn' ? 18 : _context.t0 === 'noia' ? 25 : _context.t0 === 'icon' ? 32 : 39;
_context.next = _context.t0 === 'bluzelle' ? 11 : _context.t0 === 'nkn' ? 18 : _context.t0 === 'noia' ? 25 : _context.t0 === 'icon' ? 32 : _context.t0 === 'orbit' ? 39 : 46;
break;

case 11:
Expand All @@ -76,7 +78,7 @@ function _handler() {
case 15:
Spinner.stop();
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 40);
return _context.abrupt("break", 47);

case 18:
Log.NormalLog('Installing plugin, please wait a second...');
Expand All @@ -87,7 +89,7 @@ function _handler() {
case 22:
Spinner.stop();
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 40);
return _context.abrupt("break", 47);

case 25:
Log.NormalLog('Installing plugin, please wait a second...');
Expand All @@ -98,7 +100,7 @@ function _handler() {
case 29:
Spinner.stop();
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 40);
return _context.abrupt("break", 47);

case 32:
Log.NormalLog('Installing plugin, please wait a second...');
Expand All @@ -109,28 +111,39 @@ function _handler() {
case 36:
Spinner.stop();
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 40);
return _context.abrupt("break", 47);

case 39:
Log.NormalLog('Installing plugin, please wait a second...');
Spinner.start();
_context.next = 43;
return iconHandler();

case 43:
Spinner.stop();
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 47);

case 46:
Log.NormalLog('Plugin not support yet');

case 40:
_context.next = 47;
case 47:
_context.next = 54;
break;

case 42:
_context.prev = 42;
case 49:
_context.prev = 49;
_context.t1 = _context["catch"](0);
Spinner.stop();
Log.ErrorLog('something went wrong!');
console.error(_context.t1);

case 47:
case 54:
case "end":
return _context.stop();
}
}
}, _callee, this, [[0, 42]]);
}, _callee, this, [[0, 49]]);
}));
return _handler.apply(this, arguments);
}
Expand Down
47 changes: 47 additions & 0 deletions build/components/Plugins/Install/orbit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"use strict";

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

var path = require('path');

var fsx = require('fs-extra');

var ExecuteCommand = require('../../../lib/ExecuteCommand');

module.exports =
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var configPath, userConfig;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return ExecuteCommand('npm install orbit-db ipfs-http-client');

case 2:
// update user's kaizen config
configPath = path.resolve('./', 'kaizen.json');
userConfig = fsx.existsSync(configPath) ? fsx.readJsonSync(configPath) : {};

if (!userConfig.plugins) {
userConfig.plugins = [];
}

if (userConfig.plugins.includes('orbit') === false) {
userConfig.plugins.push('orbit');
}

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);

case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
3 changes: 2 additions & 1 deletion build/components/Plugins/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ function _handler() {
Log.NormalLog('nkn'.underline.yellow + ' - NKN information');
Log.NormalLog('noia'.underline.yellow + ' - NOIA information');
Log.NormalLog('icon'.underline.yellow + ' - ICON information');
Log.NormalLog('orbit'.underline.yellow + ' - Orbit information');
Log.NormalLog("\nTo install a plugin run " + "'kaizen plugins install <plugin-name-here>'".yellow);
Log.NormalLog("\nIt will be automatically downloaded and added to your " + "'package.json'".yellow + " and " + "'kaizen.json'".yellow + " file\n");

case 7:
case 8:
case "end":
return _context.stop();
}
Expand Down
34 changes: 23 additions & 11 deletions build/components/Plugins/Uninstall/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function _handler() {

case 11:
_context.t0 = plugin;
_context.next = _context.t0 === 'bluzelle' ? 14 : _context.t0 === 'nkn' ? 22 : _context.t0 === 'noia' ? 30 : _context.t0 === 'icon' ? 38 : 46;
_context.next = _context.t0 === 'bluzelle' ? 14 : _context.t0 === 'nkn' ? 22 : _context.t0 === 'noia' ? 30 : _context.t0 === 'icon' ? 38 : _context.t0 === 'orbit' ? 46 : 54;
break;

case 14:
Expand All @@ -88,7 +88,7 @@ function _handler() {
updateKaizenJson(kaizenJson, 'bluzelle');
Spinner.stop();
Log.SuccessLog("Remove plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 47);
return _context.abrupt("break", 55);

case 22:
Log.NormalLog('Uninstalling plugin, please wait a second...');
Expand All @@ -100,7 +100,7 @@ function _handler() {
updateKaizenJson(kaizenJson, 'nkn');
Spinner.stop();
Log.SuccessLog("Remove plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 47);
return _context.abrupt("break", 55);

case 30:
Log.NormalLog('Uninstalling plugin, please wait a second...');
Expand All @@ -112,7 +112,7 @@ function _handler() {
updateKaizenJson(kaizenJson, 'noia');
Spinner.stop();
Log.SuccessLog("Remove plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 47);
return _context.abrupt("break", 55);

case 38:
Log.NormalLog('Uninstalling plugin, please wait a second...');
Expand All @@ -124,28 +124,40 @@ function _handler() {
updateKaizenJson(kaizenJson, 'icon');
Spinner.stop();
Log.SuccessLog("Remove plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 47);
return _context.abrupt("break", 55);

case 46:
Log.NormalLog('Uninstalling plugin, please wait a second...');
Spinner.start();
_context.next = 50;
return iconHandler();

case 50:
updateKaizenJson(kaizenJson, 'orbit');
Spinner.stop();
Log.SuccessLog("Remove plugin ".concat(plugin, " Successfully"));
return _context.abrupt("break", 55);

case 54:
Log.NormalLog('Plugin not support yet');

case 47:
_context.next = 54;
case 55:
_context.next = 62;
break;

case 49:
_context.prev = 49;
case 57:
_context.prev = 57;
_context.t1 = _context["catch"](0);
Spinner.stop();
Log.ErrorLog('something went wrong!');
console.error(_context.t1);

case 54:
case 62:
case "end":
return _context.stop();
}
}
}, _callee, this, [[0, 49]]);
}, _callee, this, [[0, 57]]);
}));
return _handler.apply(this, arguments);
}
Expand Down
49 changes: 49 additions & 0 deletions build/components/Plugins/Uninstall/orbit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"use strict";

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

var path = require("path");

var fsx = require("fs-extra");

var ExecuteCommand = require('../../../lib/ExecuteCommand');

module.exports =
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var configPath, userConfig;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return ExecuteCommand('npm uninstall orbit-db');

case 2:
// update user's kaizen config
configPath = path.resolve('./', 'kaizen.json');
userConfig = fsx.existsSync(configPath) ? fsx.readJsonSync(configPath) : {};

if (!userConfig.plugins) {
userConfig.plugins = [];
}

if (userConfig.plugins.includes('orbit') === false) {
userConfig.plugins = userConfig.plugins.filter(function (element) {
return element != 'orbit';
});
}

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);

case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
2 changes: 1 addition & 1 deletion build/components/Plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function builder(yargs) {

require('./List')(yargs);

return yargs.example('kaizen plugins install').example('kaizen plugins uninstall').example('kaizen plugins list').demandCommand(1, '').epilogue('Available plugins:\n\n'.underline.yellow + 'bluzelle'.underline.yellow + ' - Decentralized database\n' + 'nkn'.underline.yellow + ' - Data transmisstion\n' + 'noia'.underline.yellow + ' - Decentralized CDN\n' + 'icon'.underline.yellow + ' - Blockchain\n' + '\nRun ' + '\'kaizen plugins <command>\''.yellow + ' to interact with plugins.\n');
return yargs.example('kaizen plugins install').example('kaizen plugins uninstall').example('kaizen plugins list').demandCommand(1, '').epilogue('Available plugins:\n\n'.underline.yellow + 'bluzelle'.underline.yellow + ' - Decentralized database\n' + 'nkn'.underline.yellow + ' - Data transmisstion\n' + 'noia'.underline.yellow + ' - Decentralized CDN\n' + 'icon'.underline.yellow + ' - Blockchain\n' + 'orbit'.underline.yellow + ' - Decentralized database\n' + '\nRun ' + '\'kaizen plugins <command>\''.yellow + ' to interact with plugins.\n');
}

function handler(_x) {
Expand Down
2 changes: 2 additions & 0 deletions commands/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ bluzelle - Decentralized database
nkn - Data transmisstion
noia - Decentralized CDN
icon - Blockchain
orbit - Decentralized database
Run 'kaizen plugins <command>' to interact with plugins.
```
Expand All @@ -48,6 +49,7 @@ bluzelle - Bluzelle information
nkn - NKN information
noia - NOIA information
icon - ICON information
orbit - Orbit information
To install a plugin run 'kaizen plugins install <plugin-name-here>'
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kaizen-cli",
"version": "0.0.50",
"version": "0.0.51",
"bin": {
"kaizen": "kaizen"
},
Expand Down
Loading

0 comments on commit a8ec8ae

Please sign in to comment.