Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
JamiePrentice committed Nov 29, 2016
2 parents bb9027a + 7346339 commit 6245c10
Show file tree
Hide file tree
Showing 44 changed files with 298 additions and 200 deletions.
39 changes: 32 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
FROM mhart/alpine-node
### Base Container
FROM alpine:latest

# Create app directory
### Update base and Install node
RUN apk -qq update && apk -qq upgrade
RUN apk -qq add nodejs

### Install git - Required for some bower installs
RUN apk -qq add bash git openssh

### Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install
### Install app dependencies
ADD package.json /usr/src/app/
RUN cd /usr/src/app/ && npm install

### Install UI dependencies
RUN npm install -g bower
ADD bower.json /usr/src/app/
RUN cd /usr/src/app/
RUN bower install --allow-root

# Bundle app source
### Bundle app source
COPY . /usr/src/app

### Set node env to Production
ARG NODE=production
ENV NODE_ENV ${NODE}

CMD [ "npm", "start" ]
### Env Variables
ENV port=80
ENV DBConnectionString=mongodb://<dbuser>:<dbpassword>@<address.domain>:<port>/<collection>

### Run with forever!
RUN npm install forever -g
CMD [ "forever", "server.js" ]

# Commands to build & run
# docker build -t pool-cue .
# docker run -d -p 80:80 pool-cue
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Easy peasy? Checkout the start up with docker below.

---

#####Getting up and running with docker :sunglasses: :ok_hand:
#####Getting up and running with docker :whale: :sunglasses: :ok_hand:

- Clone or download the repository.
- Open a docker terminal window within the repository folder.
Expand Down
15 changes: 13 additions & 2 deletions app/public/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ a.queueDeleteGame {
margin-top: 2px;
}

/*------------------------------
Fill Width Container ---------
------------------------------*/
.container-fluid {
padding-right: 0px;
padding-left: 0px;
margin-right: auto;
margin-left: auto;
}
.navbar-brand ,.navbar-nav>li>a {
padding-left: 30px;
}

/*------------------------------
Sticky Footer Styles ---------
------------------------------*/
Expand Down Expand Up @@ -113,8 +126,6 @@ DC
text-align: center;
}



.text-copy {
fill: none;
stroke: white;
Expand Down
Binary file modified app/public/favicon/apple-icon-114x114.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-144x144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-57x57.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-72x72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon-precomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/favicon/apple-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion app/public/favicon/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"name": "App",
"name": "PoolCue",
"display": "standalone",
"background_color": "#ffffff",
"theme-color": "#008CBA",
"orientation": "portrait",
"description": "Pooltable Queueing App",
"icons": [
{
"src": "\/android-icon-36x36.png",
Expand Down
4 changes: 3 additions & 1 deletion app/viewmodels/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/viewmodels/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions app/viewmodels/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import gameData = require('../datamodels/gameData');
import SecurityService = require('../services/security');
import SocketService = require('../services/socketservice');
import router = require('plugins/router');

class IndexViewModel {
HasQueue: KnockoutObservable<boolean>;
HasWaiting: KnockoutObservable<boolean>;
security: SecurityService;
sockets: SocketService;
PlayerName: KnockoutObservable<string>;
/**
*
*/
constructor() {
this.security = new SecurityService();
this.sockets = new SocketService();
this.HasQueue = ko.computed(function () {
return gameData.Games().length > 1;
});
Expand All @@ -27,6 +30,7 @@ class IndexViewModel {
return true;
}
attached = function () {
this.sockets.Refresh();
}
SetNotifications(){
router.navigate("notifications");
Expand Down
17 changes: 10 additions & 7 deletions app/views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>EloEloElo</title>

<link href="bootswatch-dist/css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="jQuery-SlotMachine/dist/jquery.slotmachine.min.css" rel="stylesheet">
<link href="intl-tel-input/build/css/intlTelInput.css" rel="stylesheet">
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<link href="custom.css" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Lato:400,900,400italic,700italic" rel="stylesheet">

<!--Configure Webapp for Android-->
<link rel="manifest" href="favicon/manifest.json">

<!--Configure Webapp for iOS-->
<link rel="apple-touch-icon" sizes="57x57" href="favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="favicon/apple-icon-72x72.png">
Expand All @@ -21,15 +27,12 @@
<link rel="apple-touch-icon" sizes="144x144" href="favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png">
<link rel="manifest" href="favicon/manifest.json">
<link href="//fonts.googleapis.com/css?family=Lato:400,900,400italic,700italic" rel="stylesheet">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#008CBA">
<!--Configure Webapp for Windows Phone-->
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<meta name="theme-color" content="#008CBA">

<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion app/widgets/leaderboard/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h4>
<div data-bind="text:$index()+1" class="text-center"></div>
</td>
<td class="text-left">
<!-- ko if:$parent.IsLiberated($data) --><span class="fa fa-rocket fa-fw"></span>&nbsp;<span data-bind="text:name"></span> <!-- /ko -->
<!-- ko if:$parent.IsLiberated($data) --><del><span data-bind="text:name"></del> <!-- /ko -->
<!-- ko if:!$parent.IsLiberated($data) --><div data-bind="text:name"></div> <!-- /ko -->
</td>
<td class="text-center">
Expand Down
20 changes: 10 additions & 10 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
"tests"
],
"dependencies": {
"bootstrap": "^3.3.7",
"font-awesome": "^4.6.3",
"typeahead.js": "^0.11.1",
"form.validation": "*",
"bootswatch-dist": "yeti",
"jQuery-SlotMachine": "jquery-slotmachine#^3.0.1",
"knockout": "^3.4.0",
"Durandal": "durandal#^2.1.0",
"amplify": "^1.1.2",
"jquery": "^3.1.0",
"intl-tel-input": "^9.0.9",
"bootstrap-toggle": "^2.2.2",
"mocha": "^3.0.2"
"jquery": "^3.1.1",
"mocha": "^3.1.2",
"knockout": "^3.4.0",
"form.validation": "*",
"requirejs": "^2.3.2",
"Durandal": "durandal#^2.2.0",
"typeahead.js": "^0.11.1",
"bootstrap": "^3.3.7",
"jQuery-SlotMachine": "jquery-slotmachine#^3.0.1"
},
"resolutions": {
"jquery": "^3.1.0"
"jquery": "^3.1.1"
}
}
14 changes: 13 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@ version: '2'
services:

web-node:
container_name: nodeApp
build: .
depends_on:
- mongo-node
ports:
- "80:8080"
- 80:8080
environment:
- Port=80
- DBConnectionString=


mongo-node:
container_name: mongoDb
image: mongo
ports:
- 28017:28017
environment:
- MONGODB_USER=UserABC
- MONGODB_DATABASE=DatabaseABC
- MONGODB_PASS=PasswordABC
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
"dependencies": {
"azure-sb": "^0.10.4",
"body-parser": "^1.15.2",
"bower": "^1.7.9",
"bower": "^1.8.0",
"chalk": "^1.1.3",
"compression": "^1.6.2",
"ejs": "^2.5.2",
"elo-js": "^1.0.1",
"express": "^4.14.0",
"helmet": "^1.3.0",
"moment": "^2.15.0",
"mocha": "^3.2.0",
"mocha-junit-reporter": "^1.12.1",
"moment": "^2.17.0",
"mongoose": "4.4.0",
"socket.io": "^1.4.8",
"twilio": "^2.11.0",
"typings": "^1.3.2"
"socket.io": "^1.6.0",
"twilio": "^2.11.1",
"typings": "^1.5.0"
},
"devDependencies": {
"blanket": "^1.2.3",
Expand All @@ -33,7 +35,7 @@
},
"scripts": {
"start": "node server.js",
"postinstall": "bower install",
"postinstall": "npm install && bower install",
"test": "mocha"
},
"repository": {
Expand Down
20 changes: 10 additions & 10 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

/* NPM Packages*/

/* Imports */
require('./server/server').start(__dirname);

/* Global Variables */

/* Functions */
'use strict';

/* NPM Packages*/

/* Imports */
require('./server/server').start(__dirname);

/* Global Variables */

/* Functions */
4 changes: 2 additions & 2 deletions server/helpers/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function generateScoreFromGames() {
Player.find({name: {$in: [games[i].player1, games[i].player2]}}, function(error, players) {
if (players[0].name == game.winner) {
Helpers.updatePlayers(players[0], players[1], null);
}else if (players[1].name == game.winner) {
} else if (players[1].name == game.winner) {
Helpers.updatePlayers(players[1], players[0], null);
}
});
});
}
});
};
17 changes: 2 additions & 15 deletions server/helpers/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports.findOrCreatePlayer = function(game, playerName, io) {
return;
}


if (!player && !playerName.startsWith('Winner of')) {
player = new Player({name: playerName});
player.save();
Expand All @@ -30,7 +29,7 @@ exports.findOrCreatePlayer = function(game, playerName, io) {
if (!game.player1) {
game.player1 = playerName;
game.save();
}else {
} else {
game.player2 = playerName;
game.save();

Expand All @@ -52,7 +51,6 @@ exports.findOrCreateWaitingPlayer = function(waitingList, playerName, io) {
}
waitingList.player = player.name;
waitingList.save();
Query.pushDataToSockets(io);
});
};

Expand All @@ -67,10 +65,7 @@ exports.updatePlayers = function(winner, loser, io) {
loser.losses++;
loser.save();
Logger.info('End ' + winner.name + ' (' + winner.elo + ') vs. (' + loser.elo + ') ' + loser.name);

if (io) {
Query.pushDataToSockets(io);
}
Query.pushDataToSockets(io);
};

/* Removes player if 0 wins & 0 losses */
Expand All @@ -84,21 +79,13 @@ exports.removeInactivePlayer = function(playerName, io) {
Logger.info('Removing player: ' + playerName);
Player.find({name: playerName}).remove().exec();
});
if (io) {
Query.pushDataToSockets(io);
}
}
if (io) {
Query.pushDataToSockets(io);
}
});
};

exports.removePlayerFromWaitingList = function(playerName, io) {
WaitingList.find({player: playerName}).remove().exec(function(error, result) {
if (io) {
Query.pushDataToSockets(io);
}
});
};

Expand Down
Loading

0 comments on commit 6245c10

Please sign in to comment.