From 31b41e156d4f71760fa698e5140f695f16984432 Mon Sep 17 00:00:00 2001 From: James Allen Date: Sun, 23 Feb 2014 11:53:46 +0000 Subject: [PATCH] Check that make is installed before installing modules that need compiling --- Gruntfile.coffee | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index de115a234f..ed81cea32e 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -62,10 +62,10 @@ module.exports = (grunt) -> "Misc": [ "help" ] - "Install tasks": ("install:#{service.name}" for service in SERVICES).concat(["install:all", "install"]) + "Install tasks": ("install:#{service.name}" for service in SERVICES).concat(["install:all", "install", "install:config"]) "Update tasks": ("update:#{service.name}" for service in SERVICES).concat(["update:all", "update"]) "Config tasks": ["install:config"] - "Checks": ["check", "check:redis", "check:latexmk"] + "Checks": ["check", "check:redis", "check:latexmk", "check:s3", "check:make"] for service in SERVICES do (service) -> @@ -80,10 +80,14 @@ module.exports = (grunt) -> grunt.registerTask 'install:config', "Copy the example config into the real config", () -> Helpers.installConfig @async() grunt.registerTask 'install:all', "Download and set up all ShareLaTeX services", - ("install:#{service.name}" for service in SERVICES).concat(["install:config"]) + ["check:make"].concat( + ("install:#{service.name}" for service in SERVICES) + ).concat(["install:config"]) grunt.registerTask 'install', 'install:all' grunt.registerTask 'update:all', "Checkout and update all ShareLaTeX services", - ("update:#{service.name}" for service in SERVICES) + ["check:make"].concat( + ("update:#{service.name}" for service in SERVICES) + ) grunt.registerTask 'update', 'update:all' grunt.registerTask 'run', "Run all of the sharelatex processes", ['concurrent:all'] grunt.registerTask 'run:all', 'run' @@ -97,6 +101,8 @@ module.exports = (grunt) -> Helpers.checkLatexmk @async() grunt.registerTask "check:s3", "Check that Amazon S3 credentials are configured", () -> Helpers.checkS3 @async() + grunt.registerTask "check:make", "Check that make is installed", () -> + Helpers.checkMake @async() grunt.registerTask "check", "Check that you have the required dependencies installed", ["check:redis", "check:latexmk", "check:s3"] Helpers = @@ -244,4 +250,26 @@ module.exports = (grunt) -> grunt.log.write "OK." callback() + checkMake: (callback = (error) ->) -> + grunt.log.write "Checking make is installed... " + exec "make --version", (error, stdout, stderr) -> + if error? and error.message.match("command not found") + grunt.log.error "FAIL." + grunt.log.errorlns """ + Either make is not installed or is not in your path. + + On Ubuntu you can install make with: + + sudo apt-get install build-essential + + """ + return callback(error) + else if error? + return callback(error) + else + grunt.log.write "OK." + return callback() + + +