Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AndzejMac committed Jun 20, 2015
1 parent 490dfb8 commit 6ca2311
Show file tree
Hide file tree
Showing 36 changed files with 13,129 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "src/public/libs"
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

src/public/libs/*
38 changes: 38 additions & 0 deletions .settings/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch app.ts",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "src/Global.ts",
// Automatically stop program after launch.
"stopOnEntry": true,
// Command line arguments passed to the program.
"args": [],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"cwd": ".",
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
"runtimeExecutable": null,
// Optional arguments passed to the runtime executable.
"runtimeArguments": [],
// Environment variables passed to the program.
"env": { },
// Use JavaScript source maps (if they exist).
"sourceMaps": false
},
{
"name": "Attach",
"type": "node",
// TCP/IP address. Default is "localhost".
"address": "localhost",
// Port to attach to.
"port": 5858,
"sourceMaps": false
}
]
}
4 changes: 4 additions & 0 deletions .settings/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Place your settings in this file to overwrite default and user settings.
{
"editor.tabSize": 3
}
19 changes: 19 additions & 0 deletions .settings/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.1.0",

// The command is tsc.
"command": "tsc",

// The tsc is a cmd / bash file. It must be executed in a shell
"isShellCommand": true,

// Show the output window only if unrecognized errors occur.
"showOutput": "silent",

// args is the HelloWorld program to compile.
"args": [],

// Use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Anjmao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

15 changes: 15 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "candy-crust",
"version": "0.0.1",
"homepage": "https://github.com/Anjmao/candy-crust",
"authors": [
"Andzej <andzej.maciusovic@outlook.com>"
],
"license": "MIT",
"dependencies": {
"bootstrap": "~3.3.5",
"jquery": "~2.1.4",
"phaser": "~2.3.0",
"angular": "~1.4.1"
}
}
23 changes: 23 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var destServer = 'src/';

var srcServer = 'src/',
srcPublic = 'src/public/',
srcAngular = srcPublic + 'app/';

var config = {
tsCompiler : { module: 'commonjs'},
tsServerSrc : [
srcServer + '**/*.ts',
'!'+srcPublic+'**/*.ts'
],
tsPublicSrc : [
srcAngular + '**/*.ts',
'!'+srcAngular + 'typings**/*.ts'
],
mainFile : destServer + 'app.js',
destServer : destServer,
destPublic : srcAngular,
srcServer : srcServer
};

module.exports = config;
57 changes: 57 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
ts = require('gulp-typescript'),
sourcemaps = require('gulp-sourcemaps'),
browserify = require('gulp-browserify');

var config = require('./config');

gulp.task('compile-server', function () {

var tsResult = gulp.src(config.tsServerSrc)
.pipe(sourcemaps.init())
.pipe(ts(config.tsCompiler));

return tsResult.js
//.pipe(concat('output.js'))
//.pipe(sourcemaps.write())
.pipe(gulp.dest(config.destServer));
});

gulp.task('compile-public', function () {

var tsResult = gulp.src(config.tsPublicSrc)
.pipe(sourcemaps.init())
.pipe(ts(config.tsCompiler));

return tsResult.js
//.pipe(concat('output.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.destPublic));
});

gulp.task('watch-server', function () {
gulp.watch(config.tsServerSrc, ['compile-server']);
});

gulp.task('watch-public', function () {
gulp.watch(config.tsPublicSrc, ['compile-public']);
});

gulp.task('start',['compile-server','compile-public','watch-server','watch-public'],
function () {
nodemon({
script: config.mainFile,
ext: 'js',
}).on('restart', function () {
console.log('reload');
});
});


gulp.task('deploy', ['build'], function () {
return gulp.src(['package.json'])
.pipe(gulp.dest('./deploy'));
});

//gulp.task('default', ['deploy']);
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "candy-crust",
"version": "1.0.0",
"description": "Payments system for gaming",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Anjmao/candy-crust.git"
},
"author": "Andzej Maciusovic, Evaldas Sciuka",
"license": "ISC",
"bugs": {
"url": "https://github.com/Anjmao/candy-crust/issues"
},
"homepage": "https://github.com/Anjmao/candy-crust#readme",
"devDependencies": {
"bower": "^1.4.1",
"gulp": "^3.9.0",
"gulp-browserify": "^0.5.1",
"gulp-nodemon": "^2.0.3",
"gulp-sourcemaps": "^1.5.2",
"gulp-typescript": "^2.7.6",
"merge2": "^0.3.5"
},
"dependencies": {
"body-parser": "^1.12.4",
"errorhandler": "^1.4.0",
"express": "^4.12.4",
"lodash": "^3.9.3",
"method-override": "^2.3.3",
"sequelize": "^3.2.0",
"sqlite3": "^3.0.8",
"vash": "^0.8.7"
}
}
4 changes: 4 additions & 0 deletions src/_references.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*-------GLOBAL-------*/
/// <reference path='../typings/tsd.d.ts' />
/*----CONTROLLERS--*/
/// <reference path="controllers/IndexController.ts"/>
7 changes: 7 additions & 0 deletions src/_references.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*-------GLOBAL-------*/
/// <reference path='../typings/tsd.d.ts' />


/*----CONTROLLERS--*/
/// <reference path="controllers/IndexController.ts"/>

29 changes: 29 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var express = require("express");
var bodyParser = require("body-parser");
//import methodOverride = require("method-override");
var errorHandler = require("errorhandler");
var path = require('path');
var routes = require('./routes');
var app = express();
// Configuration
app.set('views', path.join(__dirname, '/views')); // critical to use path.join on windows
app.set('view engine', 'vash');
app.set('view options', { layout: false });
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//app.use(methodOverride());
app.use(express.static(path.join(__dirname, '/public')));
var env = process.env.NODE_ENV || 'development';
if (env === 'development') {
app.use(errorHandler({ dumpExceptions: true, showStack: true }));
}
else if (env === 'production') {
app.use(errorHandler());
}
// Routes
//app.get('/', routes.index);
app.use('/', routes);
app.listen(3000, function () {
console.log("Demo Express server listening on port %d in %s mode", 3000, app.settings.env);
});
exports.App = app;
43 changes: 43 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/// <reference path='_references.ts' />
import http = require("http");
import url = require("url");
import express = require("express");
import bodyParser = require("body-parser");
//import methodOverride = require("method-override");
import errorHandler = require("errorhandler");
import path = require('path');

import routes = require('./routes');

var app = express();

// Configuration

app.set('views', path.join( __dirname, '/views') ); // critical to use path.join on windows
app.set('view engine', 'vash');
app.set('view options', { layout: false });
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//app.use(methodOverride());
app.use(express.static(path.join( __dirname, '/public')));

var env = process.env.NODE_ENV || 'development';
if (env === 'development') {
app.use(errorHandler({ dumpExceptions: true, showStack: true }));
}
else if (env === 'production') {
app.use(errorHandler());
}


// Routes

//app.get('/', routes.index);
app.use('/', routes);


app.listen(3000, function(){
console.log("Demo Express server listening on port %d in %s mode", 3000, app.settings.env);
});

export var App = app;
25 changes: 25 additions & 0 deletions src/controllers/IndexController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// <reference path='../../typings/tsd.d.ts' />
var IndexController = (function () {
function IndexController() {
}
IndexController.index = function (req, res) {
var model = {
channel: 'channel name',
items: [
{
nick: 'nick 222',
date: 'some date'
}
]
};
res.render('index', model);
};
IndexController.aboutUs = function (req, res) {
res.render('about');
};
IndexController.game = function (req, res) {
res.render('game');
};
return IndexController;
})();
module.exports = IndexController;
38 changes: 38 additions & 0 deletions src/controllers/IndexController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <reference path='../../typings/tsd.d.ts' />

import express = require('express');

interface IndexViewModel {
channel: string;
items: ItemViewModel[];
}
interface ItemViewModel {
nick: string;
date: string;
}

class IndexController {

static index(req: express.Request, res: express.Response) {
var model: IndexViewModel = {
channel: 'channel name',
items: [
{
nick: 'nick 222', date: 'some date'
}
]
}

res.render('index', model);
}

static aboutUs(req: express.Request, res: express.Response) {
res.render('about');
}

static game(req: express.Request, res: express.Response) {
res.render('game');
}
}

export = IndexController;
Loading

0 comments on commit 6ca2311

Please sign in to comment.