@heroku/skynet 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,15 +13,36 @@ heroku plugins:install heroku-skynet-cli
13
13
  - Change directories into the cloned repository
14
14
  - Link the plugin with `heroku plugins:link .`
15
15
 
16
+ ### Manual testing
17
+
18
+ 1. Make sure your staging account is setup: https://github.com/heroku/engineering-docs/blob/master/guides/staging-account-setup.md
19
+ 1. Get someone to add you to the `heroku-security` team/org in staging.
20
+ 1. Make sure you have the latest ion-client installed:
21
+
22
+ ```
23
+ gem install ion-client
24
+ ```
25
+
26
+ If you get permissions errors against packagecloud, visit https://gemgate-heroku-internal-gems.herokuapp.com/setup-instructions
27
+
28
+
29
+ In skynet-cli directory, use the following:
30
+
31
+ ```
32
+ heroku plugins:link .
33
+ export SKYNET_HOST=https://heroku-skynet-staging.herokuapp.com
34
+ cloud staging
35
+ heroku login # login to the staging cloud via the cli
36
+ heroku skynet:<cmd>
37
+ ```
38
+
16
39
  ### Publishing to `npm`
17
40
  1. Send an email to `heroku-help@salesforce.com` requesting access to @heroku on npm. Include your npm username (https://www.npmjs.com/)
18
41
 
19
- 1. Install by running `npm install np`
20
-
21
42
  1. Publish the package:
22
43
 
23
44
  1. cd into the root of the plugin
24
- 1. Run `np`
45
+ 1. Run `npm run release`
25
46
  Note: You will get an error because np attempts to commit to master the
26
47
  updated version in the package.json
27
48
  Open a pr manually on a separate branch to resolve
@@ -1,12 +1,12 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../lib/command')
3
3
  let sudo = require('../lib/sudo')
4
4
  let SkynetAPI = require('../lib/skynet')
5
5
 
6
- function * run (context) {
6
+ async function run (context) {
7
7
  sudo()
8
8
  const skynet = new SkynetAPI(context.auth.password)
9
- let response = yield skynet.categories()
9
+ let response = await skynet.categories()
10
10
  response = JSON.parse(response)
11
11
  cli.table(response, {
12
12
  columns: [
@@ -23,5 +23,5 @@ module.exports = {
23
23
  help: `Examples:
24
24
  $ heroku skynet:categories`,
25
25
  flags: [],
26
- run: cli.command(co.wrap(run))
26
+ run: command(run)
27
27
  }
@@ -1,5 +1,5 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../lib/command')
3
3
  let sudo = require('../lib/sudo')
4
4
  let SkynetAPI = require('../lib/skynet')
5
5
 
@@ -26,7 +26,7 @@ function readlines (file) {
26
26
  })
27
27
  }
28
28
 
29
- function * run (context) {
29
+ async function run (context) {
30
30
  sudo()
31
31
  const skynet = new SkynetAPI(context.auth.password)
32
32
  let user = context.flags.user || process.env.HEROKU_USER
@@ -40,14 +40,14 @@ function * run (context) {
40
40
  }
41
41
 
42
42
  if (file) {
43
- let users = yield readlines(file)
44
- yield cli.action(`bulk deprovisioning for ${cli.color.cyan(users.length)} users`, skynet.bulkDeprovision(users.join(), notes, category))
43
+ let users = await readlines(file)
44
+ await cli.action(`bulk deprovisioning for ${cli.color.cyan(users.length)} users`, skynet.bulkDeprovision(users.join(), notes, category))
45
45
  } else {
46
46
  if (!user) {
47
47
  throw new Error('Required flag: --user USER or --infile FILE')
48
48
  }
49
49
 
50
- let response = yield cli.action(`deprovisioning ${cli.color.cyan(user)}`, skynet.deprovision(user, notes, category, force))
50
+ let response = await cli.action(`deprovisioning ${cli.color.cyan(user)}`, skynet.deprovision(user, notes, category, force))
51
51
  response = JSON.parse(response)
52
52
  cli.log(`${response.status}. ${response.message}`)
53
53
  }
@@ -66,5 +66,5 @@ module.exports = {
66
66
  { name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
67
67
  { name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false }
68
68
  ],
69
- run: cli.command(co.wrap(run))
69
+ run: command(run)
70
70
  }
@@ -1,5 +1,5 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let sudo = require('../../lib/sudo')
4
4
  let SkynetAPI = require('../../lib/skynet')
5
5
 
@@ -26,7 +26,7 @@ function readlines (file) {
26
26
  })
27
27
  }
28
28
 
29
- function * run (context) {
29
+ async function run (context) {
30
30
  sudo()
31
31
  const skynet = new SkynetAPI(context.auth.password)
32
32
  let app = context.flags.app
@@ -40,14 +40,14 @@ function * run (context) {
40
40
  }
41
41
 
42
42
  if (file) {
43
- let apps = yield readlines(file)
44
- yield cli.action(`bulk app-owner suspension for ${cli.color.cyan(apps.length)} apps.`, skynet.bulkSuspendAppOwner(apps.join(), notes, category))
43
+ let apps = await readlines(file)
44
+ await cli.action(`bulk app-owner suspension for ${cli.color.cyan(apps.length)} apps.`, skynet.bulkSuspendAppOwner(apps.join(), notes, category))
45
45
  } else {
46
46
  if (!app) {
47
47
  throw new Error('Required flag: --owner OWNER or --infile FILE')
48
48
  }
49
49
 
50
- let response = yield cli.action(`suspending the owner of ${cli.color.cyan(app)}`, skynet.suspendAppOwner(app, notes, category, force))
50
+ let response = await cli.action(`suspending the owner of ${cli.color.cyan(app)}`, skynet.suspendAppOwner(app, notes, category, force))
51
51
  response = JSON.parse(response)
52
52
  cli.log(`${response.status}. ${response.message}`)
53
53
  }
@@ -66,5 +66,5 @@ module.exports = {
66
66
  { name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
67
67
  { name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false }
68
68
  ],
69
- run: cli.command(co.wrap(run))
69
+ run: command(run)
70
70
  }
@@ -1,12 +1,12 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let sudo = require('../../lib/sudo')
4
4
  let SkynetAPI = require('../../lib/skynet')
5
5
 
6
- function * run (context) {
6
+ async function run (context) {
7
7
  sudo()
8
8
  const skynet = new SkynetAPI(context.auth.password)
9
- let response = yield skynet.suspendApp(
9
+ let response = await skynet.suspendApp(
10
10
  context.flags.app,
11
11
  context.flags.notes,
12
12
  context.flags.category,
@@ -53,5 +53,5 @@ module.exports = {
53
53
  required: false
54
54
  }
55
55
  ],
56
- run: cli.command(co.wrap(run))
56
+ run: command(run)
57
57
  }
@@ -1,5 +1,5 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let sudo = require('../../lib/sudo')
4
4
  let SkynetAPI = require('../../lib/skynet')
5
5
 
@@ -26,7 +26,7 @@ function readlines (file) {
26
26
  })
27
27
  }
28
28
 
29
- function * run (context) {
29
+ async function run (context) {
30
30
  sudo()
31
31
  const skynet = new SkynetAPI(context.auth.password)
32
32
  let user = context.flags.user || process.env.HEROKU_USER
@@ -41,14 +41,14 @@ function * run (context) {
41
41
  }
42
42
 
43
43
  if (file) {
44
- let users = yield readlines(file)
45
- yield cli.action(`bulk user suspension for ${cli.color.cyan(users.length)} users.`, skynet.bulkSuspendUsers(users.join(), notes, category))
44
+ let users = await readlines(file)
45
+ await cli.action(`bulk user suspension for ${cli.color.cyan(users.length)} users.`, skynet.bulkSuspendUsers(users.join(), notes, category))
46
46
  } else {
47
47
  if (!user) {
48
48
  throw new Error('Required flag: --user USER or --infile FILE')
49
49
  }
50
50
 
51
- let response = yield cli.action(`suspending ${cli.color.cyan(user)}`, skynet.suspendUser(user, notes, category, notify, force))
51
+ let response = await cli.action(`suspending ${cli.color.cyan(user)}`, skynet.suspendUser(user, notes, category, notify, force))
52
52
  response = JSON.parse(response)
53
53
  cli.log(`${response.status}. ${response.message}`)
54
54
  }
@@ -68,5 +68,5 @@ module.exports = {
68
68
  { name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false },
69
69
  { name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false }
70
70
  ],
71
- run: cli.command(co.wrap(run))
71
+ run: command(run)
72
72
  }
@@ -1,12 +1,12 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let sudo = require('../../lib/sudo')
4
4
  let SkynetAPI = require('../../lib/skynet')
5
5
 
6
- function * run (context) {
6
+ async function run (context) {
7
7
  sudo()
8
8
  const skynet = new SkynetAPI(context.auth.password)
9
- let response = yield skynet.unsuspendApp(context.flags.app, context.flags.notes)
9
+ let response = await skynet.unsuspendApp(context.flags.app, context.flags.notes)
10
10
  response = JSON.parse(response)
11
11
  cli.log(`suspending...${cli.color.cyan(response.status)}.\n${response.message}`)
12
12
  }
@@ -20,5 +20,5 @@ module.exports = {
20
20
  flags: [
21
21
  { name: 'app', char: 'a', description: 'app to unsuspend', hasValue: true, required: true }
22
22
  ],
23
- run: cli.command(co.wrap(run))
23
+ run: command(run)
24
24
  }
@@ -1,14 +1,14 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let sudo = require('../../lib/sudo')
4
4
  let SkynetAPI = require('../../lib/skynet')
5
5
 
6
- function * run (context) {
6
+ async function run (context) {
7
7
  sudo()
8
8
  const skynet = new SkynetAPI(context.auth.password)
9
9
  let user = context.flags.user || process.env.HEROKU_USER
10
10
 
11
- let response = yield cli.action(`unsuspending ${cli.color.cyan(user)}`, skynet.unsuspendUser(user))
11
+ let response = await cli.action(`unsuspending ${cli.color.cyan(user)}`, skynet.unsuspendUser(user))
12
12
  response = JSON.parse(response)
13
13
  cli.log(`${response.status}. ${response.message}`)
14
14
  }
@@ -22,5 +22,5 @@ module.exports = {
22
22
  flags: [
23
23
  { name: 'user', char: 'u', description: 'user to unsuspend', hasValue: true }
24
24
  ],
25
- run: cli.command(co.wrap(run))
25
+ run: command(run)
26
26
  }
@@ -1,10 +1,10 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let SkynetAPI = require('../../lib/skynet')
4
4
 
5
- function * run (context) {
5
+ async function run (context) {
6
6
  const skynet = new SkynetAPI(context.auth.password)
7
- yield cli.action(`adding ${cli.color.cyan(context.flags.userpass)} to ${cli.color.cyan(context.flags.user)}`, skynet.addUserpass(context.flags.user, context.flags.flag))
7
+ await cli.action(`adding ${cli.color.cyan(context.flags.userpass)} to ${cli.color.cyan(context.flags.user)}`, skynet.addUserpass(context.flags.user, context.flags.flag))
8
8
  }
9
9
 
10
10
  module.exports = {
@@ -17,5 +17,5 @@ module.exports = {
17
17
  { name: 'user', char: 'u', description: 'user to apply userpass flag to', hasValue: true, required: true },
18
18
  { name: 'flag', char: 'f', description: 'flag to add to the given user', hasValue: true, required: true }
19
19
  ],
20
- run: cli.command(co.wrap(run))
20
+ run: command(run)
21
21
  }
@@ -1,10 +1,10 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let SkynetAPI = require('../../lib/skynet')
4
4
 
5
- function * run (context) {
5
+ async function run (context) {
6
6
  const skynet = new SkynetAPI(context.auth.password)
7
- yield cli.action(`removing ${cli.color.cyan(context.flags.userpass)} from ${cli.color.cyan(context.flags.user)}`, skynet.removeUserpass(context.flags.user, context.flags.flag))
7
+ await cli.action(`removing ${cli.color.cyan(context.flags.userpass)} from ${cli.color.cyan(context.flags.user)}`, skynet.removeUserpass(context.flags.user, context.flags.flag))
8
8
  }
9
9
 
10
10
  module.exports = {
@@ -17,5 +17,5 @@ module.exports = {
17
17
  { name: 'user', char: 'u', description: 'user to remove user_pass from', hasValue: true, required: true },
18
18
  { name: 'flag', char: 'f', description: 'flag to remove from given user', hasValue: true, required: true }
19
19
  ],
20
- run: cli.command(co.wrap(run))
20
+ run: command(run)
21
21
  }
@@ -1,10 +1,10 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let SkynetAPI = require('../../lib/skynet')
4
4
 
5
- function * run (context) {
5
+ async function run (context) {
6
6
  const skynet = new SkynetAPI(context.auth.password)
7
- yield cli.action(
7
+ await cli.action(
8
8
  `adding ${cli.color.cyan(
9
9
  context.flags.value
10
10
  )} to whitelist with ${cli.color.cyan(context.flags.notes)}`,
@@ -34,5 +34,5 @@ module.exports = {
34
34
  required: false
35
35
  }
36
36
  ],
37
- run: cli.command(co.wrap(run))
37
+ run: command(run)
38
38
  }
@@ -1,10 +1,10 @@
1
1
  let cli = require('heroku-cli-util')
2
- let co = require('co')
2
+ let command = require('../../lib/command')
3
3
  let SkynetAPI = require('../../lib/skynet')
4
4
 
5
- function * run (context) {
5
+ async function run (context) {
6
6
  const skynet = new SkynetAPI(context.auth.password)
7
- yield cli.action(
7
+ await cli.action(
8
8
  `removing ${cli.color.cyan(context.flags.value)} from whitelist`,
9
9
  skynet.removeWhitelist(context.flags.value)
10
10
  )
@@ -25,5 +25,5 @@ module.exports = {
25
25
  required: true
26
26
  }
27
27
  ],
28
- run: cli.command(co.wrap(run))
28
+ run: command(run)
29
29
  }
package/lib/command.js ADDED
@@ -0,0 +1,13 @@
1
+ let cli = require('heroku-cli-util')
2
+
3
+ module.exports = fn =>
4
+ cli.command((context, client) =>
5
+ fn(context, client).catch(err => {
6
+ if (err.body) {
7
+ console.log(JSON.stringify(err.body))
8
+ } else {
9
+ console.log(err)
10
+ }
11
+ throw err
12
+ })
13
+ )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/skynet",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "use Skynet from Heroku CLI",
5
5
  "main": "index.js",
6
6
  "author": "Bob Argenbright @byt3smith",
@@ -17,18 +17,19 @@
17
17
  "/commands"
18
18
  ],
19
19
  "dependencies": {
20
- "co": "^4.6.0",
21
20
  "heroku-cli-util": "~6.2.12",
22
21
  "split": "^1.0.0"
23
22
  },
24
23
  "devDependencies": {
25
24
  "mocha": "^3.4.2",
26
25
  "mockdate": "^2.0.1",
27
- "nock": "^9.0.13",
26
+ "nock": "~9.0.13",
27
+ "np": "^3.1.0",
28
28
  "standard": "^12.0.1",
29
29
  "unexpected": "^10.29.0"
30
30
  },
31
31
  "scripts": {
32
- "test": "mocha && standard"
32
+ "test": "mocha && standard",
33
+ "release": "np --no-yarn"
33
34
  }
34
35
  }