Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Redirect normal HTTP traffic to splash page

  • Loading branch information...
commit 1fbea6449ff077182810fec42fbb488333f563a6 1 parent 5691d95
@rudyjahchan rudyjahchan authored
View
2  .gitignore
@@ -1,3 +1,5 @@
+_site
+
lib-cov
*.seed
*.log
View
8 lib/server/index.js
@@ -74,7 +74,7 @@
Server.prototype.listen = function() {
var cb, collectedOptions, key, option, options, port, value, _i, _j, _len;
port = arguments[0], options = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), cb = arguments[_i++];
- this.port = port != null ? port : 8000;
+ this.port = port != null ? port : 8766;
if (cb == null) {
cb = (function() {});
}
@@ -122,8 +122,10 @@
};
Server.prototype.onRequest = function(request, response) {
- response.writeHead(200);
- return response.end('Hello, world!');
+ response.writeHead(303, {
+ 'Location': 'http://carbonfive.github.io/vimtronner'
+ });
+ return response.end();
};
Server.prototype.close = function(cb) {
View
8 src/server/index.coffee
@@ -31,7 +31,7 @@ class Server
socket.disconnect() for socket in @io.sockets.clients(game.name)
delete @games[game.name]
- listen: (@port=8000, options..., cb=(->))=>
+ listen: (@port=8766, options..., cb=(->))=>
@checkDeadGameInterval = setInterval @checkForDeadGames, 180000
collectedOptions = { log: false }
for option in options
@@ -50,8 +50,10 @@ class Server
new ClientSocket(socket, @)
onRequest: (request, response)=>
- response.writeHead 200
- response.end 'Hello, world!'
+ response.writeHead 303, {
+ 'Location': 'http://carbonfive.github.io/vimtronner'
+ }
+ response.end()
close: (cb=(->))->
clearInterval @checkDeadGameInterval
View
9 test/models/game_test.coffee
@@ -80,8 +80,6 @@ describe 'Game', ->
context 'when the game is waiting', ->
beforeEach ->
@game.state = Game.STATES.WAITING
- @emit = sinon.stub(@game, 'emit')
- @start = sinon.stub(@game, 'start')
@addedCycle = @game.addCycle()
it 'returns a new cycle', ->
@@ -89,7 +87,7 @@ describe 'Game', ->
expect(@addedCycle).to.be.instanceOf(Cycle)
it 'adds the cycle to list of cycles', ->
- expect(@game.cycles).to.include(@addedCycle)
+ expect(@game.cycles[0]).to.be.eq(@addedCycle)
describe '#removeCycle', ->
context 'given a cycle', ->
@@ -102,10 +100,11 @@ describe 'Game', ->
@removedCycle = @game.removeCycle(@firstCycle)
it 'removes the cycle from the list', ->
- expect(@game.cycles).to.not.include(@firstCycle)
+ expect(@game.cycles.length).to.eq(1)
+ expect(@game.cycles[0]).to.not.eq(@firstCycle)
it 'preserves the other cycle in the list', ->
- expect(@game.cycles).to.include(@secondCycle)
+ expect(@game.cycles[0]).to.eq(@secondCycle)
it 'checks for the winner', ->
expect(@winnerCheck).to.have.been.called
View
4 test/server_test.coffee
@@ -44,7 +44,7 @@ describe 'Server', ->
itBehavesLikeItStartsListeningOn = (portDescription, port)->
it "starts listening on #{portDescription}", (done)->
http.get "http://127.0.0.1:#{port}", (response)->
- expect(response.statusCode).to.eq 200
+ expect(response.statusCode).to.eq 303
done()
it 'responds to web socket connections', (done)->
@@ -62,4 +62,4 @@ describe 'Server', ->
beforeEach -> @server.listen()
afterEach -> @server.close()
- itBehavesLikeItStartsListeningOn('port 8000', 8000)
+ itBehavesLikeItStartsListeningOn('port 8766', 8766)
Please sign in to comment.
Something went wrong with that request. Please try again.