1 |
|
2 |
|
3 | gulp = require 'gulp'
|
4 |
|
5 | wizard = (done) ->
|
6 | path = require 'path'
|
7 | fs = require 'fs'
|
8 | bootstrap = require './bootstrap'
|
9 | pkg = require '../package'
|
10 |
|
11 | console.log "Adding layer to #{pkg.name} stack"
|
12 |
|
13 | bootstrap.wizard (err, {name, repo}) ->
|
14 | pkg.stack[name] = {repo}
|
15 |
|
16 | pkgJSON = JSON.stringify pkg, null, ' '
|
17 | pkgPath = path.join __dirname, '../package.json'
|
18 |
|
19 | fs.writeFileSync pkgPath, pkgJSON
|
20 |
|
21 | inquirer.prompt [
|
22 | name: 'more'
|
23 | type: 'confirm'
|
24 | message: "Add another one?"
|
25 | ], ({more}) ->
|
26 | if more
|
27 | wizard done
|
28 | else
|
29 | done()
|
30 |
|
31 | gulp.task "split:wizard", wizard
|
32 |
|
33 | module.exports = {wizard}
|