Skip to content

Commit

Permalink
Merge branch 'master' of github.com:heroku/heroku-cli-addons-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
amanmibra committed Aug 3, 2018
2 parents 70239b5 + bf33ac7 commit 96d5588
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 3 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Heroku CLI plugin to help Heroku add-on providers integrate their services with
# Usage
<!-- usage -->
```sh-session
$ npm install -g @heroku-cli/plugin-addons-admin
$ heroku COMMAND
running command...
$ heroku (-v|--version|version)
Expand All @@ -34,6 +33,7 @@ USAGE
* [`heroku addons:admin:manifest:generate`](#heroku-addonsadminmanifestgenerate)
* [`heroku addons:admin:manifest:pull [SLUG]`](#heroku-addonsadminmanifestpull-slug)
* [`heroku addons:admin:manifest:push`](#heroku-addonsadminmanifestpush)
* [`heroku addons:admin:open [SLUG]`](#heroku-addonsadminopen-slug)

## `heroku addons:admin:manifest:diff`

Expand Down Expand Up @@ -74,6 +74,9 @@ pull a manifest for a given slug
USAGE
$ heroku addons:admin:manifest:pull [SLUG]
ARGUMENTS
SLUG slug name of add-on
OPTIONS
-h, --help show CLI help
Expand Down Expand Up @@ -104,5 +107,24 @@ EXAMPLE
Updating addon_manifest.json... done
```

_See code: [src/commands/addons/admin/manifest/push.ts](https://github.com/heroku/heroku-cli-addons-admin/blob/v0.1.4/src/commands/addons/admin/manifest/push.ts)_
_See code: [src/commands/addons/admin/manifest/push.ts](https://github.com/heroku/heroku-cli-addons-admin/blob/v0.1.3/src/commands/addons/admin/manifest/push.ts)_

## `heroku addons:admin:open [SLUG]`

open add-on dashboard

```
USAGE
$ heroku addons:admin:open [SLUG]
ARGUMENTS
SLUG slug name of add-on
EXAMPLE
$ heroku addons:admin:open
Checking addon_manifest.json... done
Opening https://addons-next.heroku.com/addons/testing-123... done
```

_See code: [src/commands/addons/admin/open.ts](https://github.com/heroku/heroku-cli-addons-admin/blob/v0.1.3/src/commands/addons/admin/open.ts)_
<!-- commandsstop -->
14 changes: 14 additions & 0 deletions src/commands/addons/admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* tslint:disable */
import {Command, flags} from '@oclif/command'

export default class AddonsAdmin extends Command {
static description = 'create and manage add-ons'

static flags = {
help: flags.help({char: 'h'})
}

async run() {
this._help();
}
}
14 changes: 14 additions & 0 deletions src/commands/addons/admin/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* tslint:disable */
import {Command, flags} from '@oclif/command'

export default class AddonsAdminManifest extends Command {
static description = 'manage add-on manifests'

static flags = {
help: flags.help({char: 'h'})
}

async run() {
this._help();
}
}
2 changes: 1 addition & 1 deletion src/commands/addons/admin/manifest/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class Pull extends CommandExtension {
help: flags.help({char: 'h'}),
};

static args = [{name: 'slug'}];
static args = [{name: 'slug', description: 'slug name of add-on'}];

async run() {
const {args, flags} = this.parse(Pull);
Expand Down
45 changes: 45 additions & 0 deletions src/commands/addons/admin/open.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* tslint:disable */
// CommandExtension
import CommandExtension from '../../../CommandExtension';

// other packages
import cli from 'cli-ux';

// utilities
import { readManifest } from '../../../utils/manifest';

export default class Open extends CommandExtension {
static description = 'open add-on dashboard'

static args = [{name: 'slug', description: 'slug name of add-on'}];

static examples = [
`$ heroku addons:admin:open
Checking addon_manifest.json... done
Opening https://addons-next.heroku.com/addons/testing-123... done`, ];


async run() {
const {args} = this.parse(Open);

let slug: string;

// check if user gave slug argument
if (args.slug) {
slug = args.slug
} else {
// if not use slug specified in manifest
cli.action.start('Checking addon_manifest.json')
const manifest = await readManifest.apply(this)
cli.action.stop()

slug = JSON.parse(manifest).id;
}

const url = `https://addons-next.heroku.com/addons/${slug}`

cli.action.start(`Opening ${url}`)
cli.open(url)
cli.action.stop()
}
}
18 changes: 18 additions & 0 deletions test/commands/addons/admin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* tslint:disable */
// import {expect, test} from '@oclif/test'
//
// describe('addons:admin', () => {
// test
// .stdout()
// .command(['addons:admin'])
// .it('runs hello', ctx => {
// expect(ctx.stdout).to.contain('hello world')
// })
//
// test
// .stdout()
// .command(['addons:admin', '--name', 'jeff'])
// .it('runs hello --name jeff', ctx => {
// expect(ctx.stdout).to.contain('hello jeff')
// })
// })
18 changes: 18 additions & 0 deletions test/commands/addons/admin/manifest.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* tslint:disable */
// import {expect, test} from '@oclif/test'
//
// describe('addons:admin:manifest', () => {
// test
// .stdout()
// .command(['addons:admin:manifest'])
// .it('runs hello', ctx => {
// expect(ctx.stdout).to.contain('hello world')
// })
//
// test
// .stdout()
// .command(['addons:admin:manifest', '--name', 'jeff'])
// .it('runs hello --name jeff', ctx => {
// expect(ctx.stdout).to.contain('hello jeff')
// })
// })
18 changes: 18 additions & 0 deletions test/commands/addons/admin/open.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* tslint:disable */
// import {expect, test} from '@oclif/test'
//
// describe('addons:admin:open', () => {
// test
// .stdout()
// .command(['addons:admin:open'])
// .it('runs hello', ctx => {
// expect(ctx.stdout).to.contain('hello world')
// })
//
// test
// .stdout()
// .command(['addons:admin:open', '--name', 'jeff'])
// .it('runs hello --name jeff', ctx => {
// expect(ctx.stdout).to.contain('hello jeff')
// })
// })

0 comments on commit 96d5588

Please sign in to comment.