mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #549 from sharelatex/hof-replace-grunt-init
Replace grunt service initialisation with bash script
This commit is contained in:
commit
a1b40b3663
2 changed files with 32 additions and 31 deletions
|
@ -87,9 +87,11 @@ module.exports = (grunt) ->
|
||||||
grunt.registerTask 'install:all', "Download and set up all ShareLaTeX services",
|
grunt.registerTask 'install:all', "Download and set up all ShareLaTeX services",
|
||||||
[].concat(
|
[].concat(
|
||||||
("install:#{service.name}" for service in SERVICES)
|
("install:#{service.name}" for service in SERVICES)
|
||||||
)
|
).concat(['postinstall'])
|
||||||
|
|
||||||
grunt.registerTask 'install', 'install:all'
|
grunt.registerTask 'install', 'install:all'
|
||||||
|
grunt.registerTask 'postinstall', 'Explain postinstall steps', () ->
|
||||||
|
Helpers.postinstallMessage @async()
|
||||||
|
|
||||||
grunt.registerTask 'update:all', "Checkout and update all ShareLaTeX services",
|
grunt.registerTask 'update:all', "Checkout and update all ShareLaTeX services",
|
||||||
["check:make"].concat(
|
["check:make"].concat(
|
||||||
|
@ -120,16 +122,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,26 +149,16 @@ module.exports = (grunt) ->
|
||||||
proc.on "close", () ->
|
proc.on "close", () ->
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
|
postinstallMessage: (callback = (error) ->) ->
|
||||||
installNpmModules: (service, callback = (error) ->) ->
|
grunt.log.write """
|
||||||
dir = service.name
|
Services cloned:
|
||||||
proc = spawn "npm", ["install"], stdio: "inherit", cwd: dir
|
#{service.name for service in SERVICES}
|
||||||
proc.on "close", () ->
|
To install services run:
|
||||||
callback()
|
$ source bin/install-services
|
||||||
|
This will install the required node versions and run `npm install` for each service.
|
||||||
# work around for https://github.com/npm/npm/issues/5400
|
See https://github.com/sharelatex/sharelatex/pull/549 for more info.
|
||||||
# where binary modules are not built due to bug in npm
|
"""
|
||||||
rebuildNpmModules: (service, callback = (error) ->) ->
|
callback()
|
||||||
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... "
|
||||||
|
|
15
server-ce/bin/install-services
Normal file
15
server-ce/bin/install-services
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#! env bash
|
||||||
|
|
||||||
|
grep 'name:' config/services.js | \
|
||||||
|
sed 's/.*name: "\(.*\)",/\1/' | \
|
||||||
|
while read service
|
||||||
|
do
|
||||||
|
pushd $service &&
|
||||||
|
echo "Installing Service $service" &&
|
||||||
|
echo ' installing Node' &&
|
||||||
|
nvm install &&
|
||||||
|
nvm use &&
|
||||||
|
echo ' installing Dependencies' &&
|
||||||
|
npm install
|
||||||
|
popd
|
||||||
|
done
|
Loading…
Reference in a new issue