Permalink
Browse files

* Re-indent to tab width 2 as per LiveScript guideline

  • Loading branch information...
1 parent 546220a commit b5bf03a7d0d213dfcb4d2d383106cde6f6595950 @audreyt committed Mar 31, 2013
Showing with 1,383 additions and 1,383 deletions.
  1. +5 −5 src/app.ls
  2. +79 −79 src/db.ls
  3. +12 −12 src/dotcloud.ls
  4. +183 −183 src/main.ls
  5. +71 −71 src/player-broadcast.ls
  6. +694 −694 src/player-graph.ls
  7. +191 −191 src/player.ls
  8. +148 −148 src/sc.ls
View
@@ -20,13 +20,13 @@ basepath = (argv.basepath or "") - // /$ //
transport = \http
if keyfile? and certfile?
- options = https:
- key: slurp keyfile
- cert: slurp certfile
- transport = \https
+ options = https:
+ key: slurp keyfile
+ cert: slurp certfile
+ transport = \https
console.log "Please connect to: #transport://#{
- if host is \0.0.0.0 then require \os .hostname! else host
+ if host is \0.0.0.0 then require \os .hostname! else host
}:#port/"
<- (require \zappajs) port, host, options
View
@@ -1,89 +1,89 @@
@__DB__ = null
@include = ->
- return @__DB__ if @__DB__
- env = process.env
- [redisPort, redisHost, redisPass, dataDir] = env<[ REDIS_PORT REDIS_HOST REDIS_PASS OPENSHIFT_DATA_DIR ]>
+ return @__DB__ if @__DB__
+ env = process.env
+ [redisPort, redisHost, redisPass, dataDir] = env<[ REDIS_PORT REDIS_HOST REDIS_PASS OPENSHIFT_DATA_DIR ]>
- services = JSON.parse do
- process.env.VCAP_SERVICES or '{}'
+ services = JSON.parse do
+ process.env.VCAP_SERVICES or '{}'
- for name, items of services
- | /^redis/.test name and items?length
- [redisPort, redisHost, redisPass] = items.0.credentials<[ port hostname password ]>
+ for name, items of services
+ | /^redis/.test name and items?length
+ [redisPort, redisHost, redisPass] = items.0.credentials<[ port hostname password ]>
- redisHost ?= \localhost
- redisPort ?= 6379
- dataDir ?= process.cwd!
+ redisHost ?= \localhost
+ redisPort ?= 6379
+ dataDir ?= process.cwd!
- require! \redis
- make-client = (cb) ->
- client = redis.createClient redisPort, redisHost
- if redisPass
- client.auth redisPass, -> console.log ...arguments
- client.on \connect cb if cb
- return client
+ require! \redis
+ make-client = (cb) ->
+ client = redis.createClient redisPort, redisHost
+ if redisPass
+ client.auth redisPass, -> console.log ...arguments
+ client.on \connect cb if cb
+ return client
- @io.configure ~>
- RedisStore = require \zappajs/node_modules/socket.io/lib/stores/redis
- redis-client = make-client ~>
- redis-pub = make-client!
- redis-sub = make-client!
- store = new RedisStore { redis, redis-pub, redis-sub, redis-client }
- @io.set \store store
- @io.enable 'browser client etag'
- @io.enable 'browser client gzip'
- @io.enable 'browser client minification'
- @io.set 'log level', 5
- redis-client.on \error ->
+ @io.configure ~>
+ RedisStore = require \zappajs/node_modules/socket.io/lib/stores/redis
+ redis-client = make-client ~>
+ redis-pub = make-client!
+ redis-sub = make-client!
+ store = new RedisStore { redis, redis-pub, redis-sub, redis-client }
+ @io.set \store store
+ @io.enable 'browser client etag'
+ @io.enable 'browser client gzip'
+ @io.enable 'browser client minification'
+ @io.set 'log level', 5
+ redis-client.on \error ->
- db = make-client ~>
- db.DB = true
- console.log "Connected to Redis Server: #redisHost:#redisPort"
+ db = make-client ~>
+ db.DB = true
+ console.log "Connected to Redis Server: #redisHost:#redisPort"
- db.on \error (err) ->
- | db.DB is true => return console.log """
- ==> Lost connection to Redis Server - attempting to reconnect...
- """
- | db.DB => return false
- | otherwise
- console.log err
- console.log "==> Falling back to JSON storage: #{ dataDir }/dump.json"
+ db.on \error (err) ->
+ | db.DB is true => return console.log """
+ ==> Lost connection to Redis Server - attempting to reconnect...
+ """
+ | db.DB => return false
+ | otherwise
+ console.log err
+ console.log "==> Falling back to JSON storage: #{ dataDir }/dump.json"
- fs = require \fs
- db.DB = {}
- try
- db.DB = JSON.parse do
- require \fs .readFileSync "#dataDir/dump.json" \utf8
- console.log "==> Restored previous session from JSON file"
- Commands =
- bgsave: (cb) ->
- fs.writeFileSync do
- "#dataDir/dump.json"
- JSON.stringify db.DB
- \utf8
- cb?!
- get: (key, cb) -> cb?(null, db.DB[key])
- set: (key, val, cb) -> db.DB[key] = val; cb?!
- rpush: (key, val, cb) -> (db.DB[key] ?= []).push val; cb?!
- lrange: (key, from, to, cb) -> cb?(null, db.DB[key] ?= [])
- hset: (key, idx, val) -> (db.DB[key] ?= [])[idx] = val; cb?!
- hgetall: (key, cb) -> cb?(null, db.DB[key] ?= {})
- del: (keys, cb) ->
- if Array.isArray keys => for key in keys => delete db.DB[key]
- else => delete db.DB[keys]
- cb?!
- db <<<< Commands
- db.multi = (...cmds) ->
- for name of Commands => let name
- cmds[name] = (...args) ->
- @push [name, args]; @
- cmds.results = []
- cmds.exec = !(cb) ->
- | @length
- [cmd, args] = @shift!
- _, result <~! db[cmd](...args)
- @results.push result
- @exec cb
- | otherwise => cb null, @results
- return cmds
- @__DB__ = db
+ fs = require \fs
+ db.DB = {}
+ try
+ db.DB = JSON.parse do
+ require \fs .readFileSync "#dataDir/dump.json" \utf8
+ console.log "==> Restored previous session from JSON file"
+ Commands =
+ bgsave: (cb) ->
+ fs.writeFileSync do
+ "#dataDir/dump.json"
+ JSON.stringify db.DB
+ \utf8
+ cb?!
+ get: (key, cb) -> cb?(null, db.DB[key])
+ set: (key, val, cb) -> db.DB[key] = val; cb?!
+ rpush: (key, val, cb) -> (db.DB[key] ?= []).push val; cb?!
+ lrange: (key, from, to, cb) -> cb?(null, db.DB[key] ?= [])
+ hset: (key, idx, val) -> (db.DB[key] ?= [])[idx] = val; cb?!
+ hgetall: (key, cb) -> cb?(null, db.DB[key] ?= {})
+ del: (keys, cb) ->
+ if Array.isArray keys => for key in keys => delete db.DB[key]
+ else => delete db.DB[keys]
+ cb?!
+ db <<<< Commands
+ db.multi = (...cmds) ->
+ for name of Commands => let name
+ cmds[name] = (...args) ->
+ @push [name, args]; @
+ cmds.results = []
+ cmds.exec = !(cb) ->
+ | @length
+ [cmd, args] = @shift!
+ _, result <~! db[cmd](...args)
+ @results.push result
+ @exec cb
+ | otherwise => cb null, @results
+ return cmds
+ @__DB__ = db
View
@@ -1,15 +1,15 @@
@include = -> try
- {env} = process
- @io.configure ~> @io.set \transports if @KEY or @POLLING
- then <[ jsonp-polling ]>
- else if env.SUBDOMAIN and env.NODE_ENV
- then <[ websocket xhr-polling jsonp-polling ]>
- else <[ websocket flashsocket xhr-polling jsonp-polling ]>
+ {env} = process
+ @io.configure ~> @io.set \transports if @KEY or @POLLING
+ then <[ jsonp-polling ]>
+ else if env.SUBDOMAIN and env.NODE_ENV
+ then <[ websocket xhr-polling jsonp-polling ]>
+ else <[ websocket flashsocket xhr-polling jsonp-polling ]>
- json = require \fs .readFileSync \/home/dotcloud/environment.json \utf8
+ json = require \fs .readFileSync \/home/dotcloud/environment.json \utf8
- {
- DOTCLOUD_DATA_REDIS_HOST: env.REDIS_HOST
- DOTCLOUD_DATA_REDIS_PORT: env.REDIS_PORT
- DOTCLOUD_DATA_REDIS_PASSWORD: env.REDIS_PASS
- } = JSON.parse json
+ {
+ DOTCLOUD_DATA_REDIS_HOST: env.REDIS_HOST
+ DOTCLOUD_DATA_REDIS_PORT: env.REDIS_PORT
+ DOTCLOUD_DATA_REDIS_PASSWORD: env.REDIS_PASS
+ } = JSON.parse json
Oops, something went wrong.

0 comments on commit b5bf03a

Please sign in to comment.