mgebbe@0: # Copyright (C) 2014 by Intevation GmbH mgebbe@0: # Author: Mathias Gebbe mgebbe@0: # mgebbe@3: # This file is Free Software under the Apache License, Version 2.0; mgebbe@3: # and comes with NO WARRANTY! mgebbe@3: # See the documentation coming with pumpbridge for details. mgebbe@0: mgebbe@0: async = require 'async' mgebbe@0: databank = require 'databank' mgebbe@0: Databank = databank.Databank mgebbe@0: DatabankObject = databank.DatabankObject mgebbe@0: PumpIOClientApp = require 'pump.io-client-app' mgebbe@0: Sync = require('./sync') mgebbe@0: Config = require('./config') mgebbe@0: routes = require('./routes') mgebbe@0: config = Config.config mgebbe@0: mgebbe@0: async.waterfall [ mgebbe@0: (callback) -> mgebbe@0: # sets up the config mgebbe@0: app = new PumpIOClientApp(config) mgebbe@0: mgebbe@0: routes.addRoutes app mgebbe@0: mgebbe@0: # Start the app mgebbe@0: app.log.debug mgebbe@0: port: config.port mgebbe@0: address: config.address mgebbe@0: , 'Starting app listener' mgebbe@0: mgebbe@0: app.run (err) -> mgebbe@0: if err mgebbe@0: app.log.error err mgebbe@0: else mgebbe@0: console.log 'Express server is listening mgebbe@0: on address %s port %d', config.address, config.port mgebbe@0: mgebbe@0: # Start Deamon! mgebbe@21: # or comment to the next hashtag after ')' and use mgebbe@19: # Sync.sync() mgebbe@27: # or (best) start coffee syncALONE.coffee in a different shell mgebbe@19: exec = require("child_process").exec mgebbe@19: child = undefined mgebbe@19: child = exec("coffee syncALONE.coffee", (error, stdout, stderr) -> mgebbe@19: console.log "stdout: " + stdout mgebbe@19: console.log "stderr: " + stderr mgebbe@19: console.log "exec error: " + error if error isnt null mgebbe@19: return mgebbe@19: ) mgebbe@19: # mgebbe@0: mgebbe@0: return mgebbe@0: ], (err, result) ->