text: 'use strict';
  
  var _herokuCliUtil = require('heroku-cli-util');
  
  var _herokuCliUtil2 = _interopRequireDefault(_herokuCliUtil);
  
  var _co = require('co');
  
  var _co2 = _interopRequireDefault(_co);
  
  var _push = require('../../../push');
  
  var _push2 = _interopRequireDefault(_push);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function map(stack) {
    return stack === 'cedar-10' ? 'cedar' : stack;
  }
  
  function* run(context, heroku) {
    let stack = map(context.args.stack);
    yield heroku.request({
      method: 'PATCH',
      path: `/apps/${context.app}`,
      body: { build_stack: stack }
    });
    _herokuCliUtil2.default.log(`Stack set. Next release on ${_herokuCliUtil2.default.color.app(context.app)} will use ${_herokuCliUtil2.default.color.green(stack)}.`);
    _herokuCliUtil2.default.log(`Run ${_herokuCliUtil2.default.color.cmd((0, _push2.default)(context.flags.remote))} to create a new release on ${_herokuCliUtil2.default.color.app(context.app)}.`);
  }
  
  let cmd = {
    needsApp: true,
    needsAuth: true,
    description: 'set the stack of an app',
    help: `
  Example:
  
      $ heroku stack:set cedar-14 -a myapp
      Stack set. Next release on myapp will use cedar-14.
      Run git push heroku master to create a new release on myapp.`,
    args: [{ name: 'stack' }],
    run: _herokuCliUtil2.default.command(_co2.default.wrap(run))
  };
  
  module.exports = [Object.assign({ topic: 'apps', command: 'stacks:set' }, cmd), Object.assign({ topic: 'stack', command: 'set', hidden: true }, cmd)];