1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _cliEngineCommand = require('cli-engine-command');
|
8 |
|
9 | var _cliEngineCommand2 = _interopRequireDefault(_cliEngineCommand);
|
10 |
|
11 | var _plugins = require('../../plugins');
|
12 |
|
13 | var _plugins2 = _interopRequireDefault(_plugins);
|
14 |
|
15 | var _hooks = require('../../hooks');
|
16 |
|
17 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18 |
|
19 | let examplePlugin = 'heroku-production-status';
|
20 |
|
21 | let cli = 'heroku';
|
22 | if (global.config) {
|
23 | cli = global.config.bin;
|
24 | let pjson = global.config.pjson['cli-engine'];
|
25 | if (pjson['help'] && pjson['help']['plugins']) {
|
26 | examplePlugin = Object.keys(pjson['help']['plugins'])[0];
|
27 | }
|
28 | }
|
29 |
|
30 | class PluginsInstall extends _cliEngineCommand2.default {
|
31 |
|
32 | async run() {
|
33 | this.plugins = new _plugins2.default(this.config);
|
34 | const [plugin, tag = 'latest'] = this.argv[0].split('@');
|
35 | if (!this.config.debug) this.out.action.start(`Installing plugin ${plugin}${tag === 'latest' ? '' : '@' + tag}`);
|
36 | await this.plugins.install(plugin, tag);
|
37 | const hooks = new _hooks.Hooks({ config: this.config });
|
38 | await hooks.run('update');
|
39 | }
|
40 | }
|
41 | exports.default = PluginsInstall;
|
42 | PluginsInstall.topic = 'plugins';
|
43 | PluginsInstall.command = 'install';
|
44 | PluginsInstall.description = 'installs a plugin into the CLI';
|
45 | PluginsInstall.help = `
|
46 | Example:
|
47 | $ ${cli} plugins:install ${examplePlugin}
|
48 | `;
|
49 | PluginsInstall.args = [{ name: 'plugin', description: 'plugin to install' }]; |
\ | No newline at end of file |