1 |
|
2 |
|
3 | class Server
|
4 | constructor: (@name, @host, config, mainConfig) ->
|
5 |
|
6 | if typeof config.start == "string" and not config.start
|
7 | @start = null
|
8 | else
|
9 | @start = config.start || mainConfig.getStart()
|
10 |
|
11 | @install = config.install || mainConfig.getInstall()
|
12 | cron = if config.cron then mainConfig.normalizeCron config.cron else null
|
13 | @cron = cron || mainConfig.getCron()
|
14 |
|
15 | getStart: ->
|
16 | if not @start
|
17 | console.log "no start specified, start, stop and restart commands disabled!"
|
18 | return
|
19 | else
|
20 | @start
|
21 |
|
22 | getInstall: ->
|
23 | @install || throw new Error "You must specify 'install:' in your config file"
|
24 |
|
25 | getCron: -> @cron
|
26 |
|
27 | getUser: -> @host.replace(/@.*$/, "")
|
28 |
|
29 | getHost: -> @host
|
30 |
|
31 | module.exports = Server
|