mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Allow custom configs to be installed via git
This commit is contained in:
parent
b9a7cb6c30
commit
4625d7126f
3 changed files with 25 additions and 5 deletions
3
server-ce/.gitignore
vendored
3
server-ce/.gitignore
vendored
|
@ -1,4 +1,7 @@
|
|||
config
|
||||
config-local
|
||||
node_modules
|
||||
|
||||
web
|
||||
document-updater
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fs = require "fs"
|
||||
exec = require("child_process").exec
|
||||
spawn = require("child_process").spawn
|
||||
rimraf = require "rimraf"
|
||||
|
||||
SERVICES = [{
|
||||
name: "web"
|
||||
|
@ -51,8 +51,9 @@ module.exports = (grunt) ->
|
|||
"Misc": [
|
||||
"help"
|
||||
]
|
||||
"Install tasks": ("install:#{service.name}" for service in SERVICES).concat("install:all")
|
||||
"Update tasks": ("update:#{service.name}" for service in SERVICES).concat("update:all")
|
||||
"Install tasks": ("install:#{service.name}" for service in SERVICES).concat(["install:all", "install"])
|
||||
"Update tasks": ("update:#{service.name}" for service in SERVICES).concat(["update:all", "update"])
|
||||
"Config tasks": ["install:config"]
|
||||
|
||||
for service in SERVICES
|
||||
do (service) ->
|
||||
|
@ -62,7 +63,7 @@ module.exports = (grunt) ->
|
|||
grunt.registerTask "update:#{service.name}", "Checkout and update the #{service.name} service", () ->
|
||||
done = @async()
|
||||
Helpers.updateService(service.name, done)
|
||||
grunt.registerTask 'run:#{service.name}', "Run the ShareLaTeX #{service.name} service", ["bunyan", "execute:web"]
|
||||
grunt.registerTask "run:#{service.name}", "Run the ShareLaTeX #{service.name} service", ["bunyan", "execute:web"]
|
||||
|
||||
grunt.registerTask 'install:all', "Download and set up all ShareLaTeX services", ("install:#{service.name}" for service in SERVICES)
|
||||
grunt.registerTask 'install', 'install:all'
|
||||
|
@ -71,6 +72,9 @@ module.exports = (grunt) ->
|
|||
grunt.registerTask 'run', "Run all of the sharelatex processes", ['concurrent:all']
|
||||
grunt.registerTask 'run:all', 'run'
|
||||
|
||||
grunt.registerTask 'install:config', "Install a custom config from a git repository (set SHARELATEX_CONFIG_REPO to the repository location)", () ->
|
||||
Helpers.installCustomConfig @async()
|
||||
|
||||
grunt.registerTask 'help', 'Display this help list', 'availabletasks'
|
||||
grunt.registerTask 'default', 'run'
|
||||
|
||||
|
@ -118,3 +122,15 @@ Helpers =
|
|||
proc = spawn "grunt", ["install"], stdio: "inherit", cwd: dir
|
||||
proc.on "close", () ->
|
||||
callback()
|
||||
|
||||
installCustomConfig: (callback = (error) ->) ->
|
||||
if !process.env.SHARELATEX_CONFIG_REPO?
|
||||
return callback(new Error("Please set the SHARELATEX_CONFIG_REPO enviroment variable to point to a git repository."))
|
||||
|
||||
rimraf "config-local", (error) ->
|
||||
Helpers.cloneGitRepo process.env.SHARELATEX_CONFIG_REPO, "config-local", (error) ->
|
||||
return callback(error) if error?
|
||||
for file in fs.readdirSync("config-local")
|
||||
unless file == ".git"
|
||||
fs.symlinkSync("config-local/#{file}", "config/#{file}")
|
||||
callback()
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"dependencies": {
|
||||
"logger-sharelatex": "git+ssh://git@bitbucket.org:sharelatex/logger-sharelatex.git#bunyan",
|
||||
"settings-sharelatex": "git+ssh://git@bitbucket.org:sharelatex/settings-sharelatex.git#master",
|
||||
"coffee-script": "~1.7.1"
|
||||
"coffee-script": "~1.7.1",
|
||||
"rimraf": "~2.2.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.2",
|
||||
|
|
Loading…
Reference in a new issue