-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (40 loc) · 1.19 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const emoji = require('node-emoji')
const fs = require('fs')
const config = require('./config')
const command = require('./lib_node/command')
inquirer.prompt([{
type: 'confirm',
name: 'packages',
message: 'Do you want to install packages from config.js?',
default: false
}]).then(function (answers) {
if(!answers.packages){
return console.log('skipping package installs')
}
const tasks = [];
['brew', 'cask', 'npm', 'gem', 'mas'].forEach( type => {
if(config[type] && config[type].length){
tasks.push((cb)=>{
console.info(emoji.get('coffee'), ' installing '+type+' packages')
cb()
})
config[type].forEach((item)=>{
tasks.push((cb)=>{
console.info(type+':', item)
command('. lib_sh/echos.sh && . lib_sh/requirers.sh && require_'+type+' ' + item, __dirname, function(err, stdout, stderr) {
if(err) console.error(emoji.get('fire'), err, stderr)
cb()
})
})
})
}else{
tasks.push((cb)=>{
console.info(emoji.get('coffee'), type+' has no packages')
cb()
})
}
})
series(tasks, function(err, results) {
console.log('package install complete')
})
})