replace grunt service initialisation with bash script

This commit is contained in:
Hayden Faulds 2017-07-27 15:39:22 +01:00
parent 5f509a9413
commit 230fe00c48
2 changed files with 16 additions and 31 deletions

View file

@ -120,16 +120,10 @@ module.exports = (grunt) ->
installService: (service, callback = (error) ->) -> installService: (service, callback = (error) ->) ->
console.log "Installing #{service.name}" console.log "Installing #{service.name}"
Helpers.cloneGitRepo service, (error) -> Helpers.cloneGitRepo service, (error) ->
return callback(error) if error? if error?
Helpers.installNpmModules service, (error) -> callback(error)
return callback(error) if error? else
Helpers.rebuildNpmModules service, (error) -> callback()
return callback(error) if error?
Helpers.runGruntInstall service, (error) ->
return callback(error) if error?
console.log "Finished installing #{service.name}"
callback()
cloneGitRepo: (service, callback = (error) ->) -> cloneGitRepo: (service, callback = (error) ->) ->
repo_src = service.repo repo_src = service.repo
@ -153,27 +147,6 @@ module.exports = (grunt) ->
proc.on "close", () -> proc.on "close", () ->
callback() callback()
installNpmModules: (service, callback = (error) ->) ->
dir = service.name
proc = spawn "npm", ["install"], stdio: "inherit", cwd: dir
proc.on "close", () ->
callback()
# work around for https://github.com/npm/npm/issues/5400
# where binary modules are not built due to bug in npm
rebuildNpmModules: (service, callback = (error) ->) ->
dir = service.name
proc = spawn "npm", ["rebuild"], stdio: "inherit", cwd: dir
proc.on "close", () ->
callback()
runGruntInstall: (service, callback = (error) ->) ->
dir = service.name
proc = spawn "grunt", ["install"], stdio: "inherit", cwd: dir
proc.on "close", () ->
callback()
checkMake: (callback = (error) ->) -> checkMake: (callback = (error) ->) ->
grunt.log.write "Checking make is installed... " grunt.log.write "Checking make is installed... "
exec "make --version", (error, stdout, stderr) -> exec "make --version", (error, stdout, stderr) ->

View file

@ -0,0 +1,12 @@
#! env bash
grep 'name:' config/services.js | \
sed 's/.*name: "\(.*\)",/\1/' | \
while read service
do
pushd $service &&
nvm install &&
nvm use &&
npm install
popd
done