UNPKG

796 BJavaScriptView Raw
1'use strict'
2
3let cli = require('heroku-cli-util')
4let co = require('co')
5
6function * run (context, heroku) {
7 let app = yield heroku.get(`/organizations/apps/${context.app}`)
8 if (!app.locked) {
9 throw new Error(`Error: cannot unlock ${cli.color.cyan(app.name)}
10This app is not locked.`)
11 }
12 let request = heroku.request({
13 method: 'PATCH',
14 path: `/organizations/apps/${app.name}`,
15 body: {locked: false}
16 })
17 yield cli.action(`Unlocking ${cli.color.cyan(app.name)}`, request)
18}
19
20let cmd = {
21 topic: 'apps',
22 command: 'unlock',
23 description: 'unlock an app so any organization member can join',
24 needsAuth: true,
25 needsApp: true,
26 run: cli.command(co.wrap(run))
27}
28
29module.exports.apps = cmd
30module.exports.root = Object.assign({}, cmd, {topic: 'unlock', command: null})