Skip to content

Commit

Permalink
make gitshots optional
Browse files Browse the repository at this point in the history
  • Loading branch information
atomantic committed Feb 10, 2017
1 parent d173ff5 commit 5458409
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 34 deletions.
3 changes: 2 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
* disable vim YouCompleteMe Bundle (wasn't using it anyway and was causing installation problems on some machines)
* remove yo, generator-dockerize, box-sync from software installs
* install node stable (rather than old 4.x.x version)

* make gitshots optional (and only install `imagesnap` and `imagemagick` if this is on)

## v4.3.0
* vim installation fix
* Enable firewall
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ The following is the software that I have set as default:
* gnu-sed
* homebrew/dupes/grep
* httpie
* imagemagick
* imagesnap
* imagemagick (only if gitshots enabled)
* imagesnap (only if gitshots enabled)
* jq
* mas
* moreutils
Expand Down Expand Up @@ -361,14 +361,12 @@ The following is the software that I have set as default:
* antic
* buzzphrase
* eslint
* generator-dockerize
* gulp
* instant-markdown-d
* npm-check
* prettyjson
* trash
* vtop
* yo

## Ruby Gems
* git-up
Expand Down
2 changes: 0 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ module.exports = {
'homebrew/dupes/grep',
// https://github.com/jkbrzt/httpie
'httpie',
'imagemagick',
'imagesnap',
// jq is a sort of JSON grep
'jq',
// Mac App Store CLI: https://github.com/mas-cli/mas
Expand Down
70 changes: 43 additions & 27 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,50 @@
const emoji = require('node-emoji')
// const inquirer = require('inquirer')
const fs = require('fs')
const inquirer = require('inquirer')
const config = require('./config')
const command = require('./lib_node/command')

// inquirer.prompt([{
// type: 'confirm',
// name: 'gitshots',
// message: 'Do you want to use gitshots?',
// default: true
// }]).then(function (answers) {
// if(answers.gitshots){
// // ensure ~/.gitshots exists
// command('mkdir -p ~/.gitshots', __dirname, function(err, out) {
// if(err) console.error(err)
// });
// }
inquirer.prompt([{
type: 'confirm',
name: 'gitshots',
message: 'Do you want to use gitshots?',
default: true
}]).then(function (answers) {
if(answers.gitshots){

const installPackages = function(type){
console.info(emoji.get('coffee'), ' installing '+type+' packages')
config[type].map(function(item){
console.info(type+':', item);
command('. lib_sh/echos.sh && . lib_sh/requirers.sh && require_'+type+' ' + item, __dirname, function(err, out) {
if(err) console.error(emoji.get('fire'), err)
});
});
}
// additional brew packages needed to support gitshots
config.brew.push('imagemagick', 'imagesnap')
// ensure ~/.gitshots exists
command('mkdir -p ~/.gitshots', __dirname, function(err, out) {
if(err) throw err
})
// add post-commit hook
command('cp ./.git_template/hooks/gitshot-pc ./.git_template/hooks/post-commit', __dirname, function(err, out) {
if(err) throw err
})
}else{
if(fs.existsSync('./.git_template/hooks/post-commit')){
// disable post-commit (in case we are undoing the git-shots enable)
// TODO: examine and remove/comment out the file content with the git shots bit
command('mv ./.git_template/hooks/post-commit ./.git_template/hooks/disabled-pc', __dirname, function(err, out) {
if(err) throw err
})
}
}

installPackages('brew');
installPackages('cask');
installPackages('npm');
installPackages('gem');
const installPackages = function(type){
console.info(emoji.get('coffee'), ' installing '+type+' packages')
config[type].map(function(item){
console.info(type+':', item)
command('. lib_sh/echos.sh && . lib_sh/requirers.sh && require_'+type+' ' + item, __dirname, function(err, out) {
if(err) console.error(emoji.get('fire'), err)
})
})
}

// });
installPackages('brew')
installPackages('cask')
installPackages('npm')
installPackages('gem')

})

0 comments on commit 5458409

Please sign in to comment.