Example #1
0
  run: cli.command(co.wrap(function* (context, heroku) {
    const pipeline = yield disambiguate(heroku, context.flags.pipeline)
    const newOwner = yield getOwner(heroku, context.args.owner)
    const apps = yield api.listPipelineApps(heroku, pipeline.id)
    const displayType = { team: 'team', user: '******' }[newOwner.type]
    let confirmName = context.flags.confirm

    if (!confirmName) {
      yield renderPipeline(heroku, pipeline, apps)
      cli.log('')
      cli.warn(`This will transfer ${cli.color.pipeline(pipeline.name)} and all of the listed apps to the ${context.args.owner} ${displayType}`)
      cli.warn(`to proceed, type ${cli.color.red(pipeline.name)} or re-run this command with ${cli.color.red('--confirm')} ${pipeline.name}`)
      confirmName = yield cli.prompt('', {})
    }

    if (confirmName !== pipeline.name) {
      cli.warn(`Confirmation did not match ${cli.color.red(pipeline.name)}. Aborted.`)
      return
    }

    const promise = heroku.request({
      method: 'POST',
      path: '/pipeline-transfers',
      body: { pipeline: { id: pipeline.id }, new_owner: newOwner },
      headers: {'Accept': 'application/vnd.heroku+json; version=3.pipelines'}
    })

    yield cli.action(
      `Transferring ${cli.color.pipeline(pipeline.name)} pipeline to the ${context.args.owner} ${displayType}`,
      promise
    )
  }))
Example #2
0
  run: cli.command(co.wrap(function* (context, heroku) {
    const pipeline = yield disambiguate(heroku, context.args.pipeline)

    const promise = heroku.request({
      method: 'PATCH',
      path: `/pipelines/${pipeline.id}`,
      body: {name: context.args.name},
      headers: {'Accept': 'application/vnd.heroku+json; version=3'}
    }) // heroku.pipelines(pipeline).update(body);

    yield cli.action(`Renaming ${cli.color.pipeline(pipeline.name)} pipeline to ${cli.color.pipeline(context.args.name)}`, promise)
  }))
Example #3
0
  run: cli.command(co.wrap(function* (context, heroku) {
    const app = context.app

    var stage
    let guesses = infer(context.app)
    let questions = []

    let pipeline = yield disambiguate(heroku, context.args.pipeline)

    if (context.flags.stage) {
      stage = context.flags.stage
    } else {
      questions.push({
        type: 'list',
        name: 'stage',
        message: `Stage of ${app}`,
        choices: stageNames,
        default: guesses[1]
      })
    }
    let answers = yield prompt(questions)
    if (answers.stage) stage = answers.stage

    yield cli.action(`Adding ${cli.color.app(app)} to ${cli.color.pipeline(pipeline.name)} pipeline as ${stage}`,
      createCoupling(heroku, pipeline, app, stage))
  }))