Skip to content

Commit

Permalink
Included templates in package and fixed topics descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
l0rd committed Dec 9, 2018
1 parent ab8d28b commit f91cce1
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 59 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.4

## `chectl server:start`

Start Eclipse Che Server
start Eclipse Che Server

```
USAGE
$ chectl server:start
OPTIONS
-d, --debug Starts chectl in debug mode
-h, --help show CLI help
-i, --cheimage=cheimage [default: eclipse/che-server:nightly] Che server container image
-n, --chenamespace=chenamespace [default: kube-che] Kubernetes namespace where Che resources will be deployed
Expand All @@ -85,7 +86,7 @@ _See code: [src/commands/server/start.ts](https://github.com/l0rd/chectl/blob/v0

## `chectl server:stop`

Stop Eclipse Che Server
stop Eclipse Che Server

```
USAGE
Expand All @@ -100,7 +101,7 @@ _See code: [src/commands/server/stop.ts](https://github.com/l0rd/chectl/blob/v0.

## `chectl server:update`

Update Eclipse Che Server
update Eclipse Che Server

```
USAGE
Expand All @@ -115,7 +116,7 @@ _See code: [src/commands/server/update.ts](https://github.com/l0rd/chectl/blob/v

## `chectl workspace:list`

List Che workspaces
list Che workspaces

```
USAGE
Expand All @@ -130,7 +131,7 @@ _See code: [src/commands/workspace/list.ts](https://github.com/l0rd/chectl/blob/

## `chectl workspace:start`

Create and start a Che workspace
create and start a Che workspace

```
USAGE
Expand All @@ -145,7 +146,7 @@ _See code: [src/commands/workspace/start.ts](https://github.com/l0rd/chectl/blob

## `chectl workspace:stop`

Stop a running Che workspace
stop a running Che workspace

```
USAGE
Expand Down
3 changes: 2 additions & 1 deletion ambient.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module 'command-exists';
declare module 'command-exists'
declare module 'listr-verbose-renderer'
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"execa": "^1.0.0",
"fancy-test": "^1.4.1",
"listr": "^0.14.3",
"listr-verbose-renderer": "^0.5.0",
"nock": "^10.0.2",
"node-notifier": "^5.3.0",
"proxyquire": "^2.1.0",
Expand Down Expand Up @@ -70,11 +71,19 @@
},
"plugins": [
"@oclif/plugin-help"
]
],

"topics": {
"server": { "description": "control Che server" },
"workspace": { "description": "control Che workspaces" }
}
},
"pkg": {
"scripts": [
"lib/**/*.js"
],
"assets": [
"src/templates/kubernetes/helm/che/**/*"
]
},
"repository": "l0rd/chectl",
Expand Down
15 changes: 11 additions & 4 deletions src/commands/server/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { Command, flags } from '@oclif/command'
import { string } from '@oclif/parser/lib/flags'
import { cli } from 'cli-ux';
import * as commandExists from 'command-exists'
import * as execa from 'execa'
import * as Listr from 'listr'
Expand All @@ -14,7 +13,7 @@ import { HelmHelper } from '../../helpers/helm'
import { MinikubeHelper } from '../../helpers/minikube'
const workingDir = path.resolve('.')
export default class Start extends Command {
static description = 'Start Eclipse Che Server'
static description = 'start Eclipse Che Server'

static flags = {
help: flags.help({ char: 'h' }),
Expand Down Expand Up @@ -42,6 +41,11 @@ export default class Start extends Command {
default: '40000',
required: true,
env: 'CHE_SERVER_BOOT_TIMEOUT'
}),
debug: flags.boolean({
char: 'd',
description: 'Starts chectl in debug mode',
default: false
})
}

Expand All @@ -51,6 +55,7 @@ export default class Start extends Command {
const mh = new MinikubeHelper()
const helm = new HelmHelper()
const che = new CheHelper()
const listr_renderer = (flags.debug) ? 'verbose' : 'default'
const tasks = new Listr([
{ title: 'Verify if kubectl is installed', task: async () => { if (!await commandExists('kubectl')) { this.error('E_REQUISITE_NOT_FOUND') } } },
{ title: 'Verify if minikube is installed', task: async () => { if (!await this.checkIfInstalled('minikube')) { this.error('E_REQUISITE_NOT_FOUND', {code: 'E_REQUISITE_NOT_FOUND'}) } } },
Expand All @@ -75,8 +80,10 @@ export default class Start extends Command {
{ title: 'Waiting for Che Server pod to be created', skip: () => 'Not implemented yet', task: () => {}},
{ title: 'Waiting for Che Server to start and respond', skip: (ctx: any) => { if (ctx.isCheRunning) { return 'Che is already running.' } }, task: () => che.isCheServerReady(flags.chenamespace, bootTimeout)},
{ title: 'Retrieving Che Server URL', task: async (ctx: any, task: any) => { ctx.cheURL = await che.cheURL(flags.chenamespace); task.title = await `${task.title}...${ctx.cheURL}` } },
{ title: 'Open Che Server Dashboard in browser', task: async (ctx: any) => { process.platform === 'linux' ? await cli.open(ctx.cheURL, { app: 'xdg-open' }) : await cli.open(ctx.cheURL) }},
])
// { title: 'Open Che Server Dashboard in browser', enable: () => false /* Doesn\'t work when chectl is packaged with zeit/pkg */, task: async (ctx: any) => { process.platform === 'linux' ? await cli.open(ctx.cheURL, { app: 'xdg-open' }) : await cli.open(ctx.cheURL, { app: 'open' }) }}
], {
renderer: listr_renderer
})

try {
await tasks.run()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/server/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as execa from 'execa'
import { CheHelper } from '../../helpers/che'

export default class Stop extends Command {
static description = 'Stop Eclipse Che Server'
static description = 'stop Eclipse Che Server'

static flags = {
help: flags.help({ char: 'h' }),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/server/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Command, flags } from '@oclif/command'
import { string } from '@oclif/parser/lib/flags'

export default class Update extends Command {
static description = 'Update Eclipse Che Server'
static description = 'update Eclipse Che Server'

static flags = {
help: flags.help({ char: 'h' }),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/workspace/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Command, flags } from '@oclif/command'
import { string } from '@oclif/parser/lib/flags'

export default class List extends Command {
static description = 'List Che workspaces'
static description = 'list Che workspaces'

static flags = {
help: flags.help({ char: 'h' }),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/workspace/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Command, flags } from '@oclif/command'
import { string } from '@oclif/parser/lib/flags'

export default class Start extends Command {
static description = 'Create and start a Che workspace'
static description = 'create and start a Che workspace'

static flags = {
help: flags.help({ char: 'h' }),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/workspace/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Command, flags } from '@oclif/command'
import { string } from '@oclif/parser/lib/flags'

export default class Stop extends Command {
static description = 'Stop a running Che workspace'
static description = 'stop a running Che workspace'

static flags = {
help: flags.help({ char: 'h' }),
Expand Down
Loading

0 comments on commit f91cce1

Please sign in to comment.