Giter Club home page Giter Club logo

uonline

A browser-based MMORPG in a fantasy world.

Build Status Coverage Status Dependency Status devDependency Status Planned tasks

Issue Stats PR Stats

Requirements

  • Node.js 0.10 or higher with npm;
  • CoffeeScript;
  • Gulp;
  • Bower;
  • PostgreSQL 9.1 or higher.

uonline expects environment variables DATABASE_URL and DATABASE_URL_TEST to be set. If they are not, it will use following default credentials. You'll probably find it convinient to make the dev environment match them.

  • Hostname localhost;
  • DB user anonymous with password nopassword;
  • Databases: uonline and uonline_test.

How to set up

  • Clone the repo.
  • Run script/setup. Please note that it expects database credentials to be set. Also, it will try to create databases if they don't exist.

By the way, running script/update will update the stuff like dependencies and DB revisions. You typically use it after every pull.

How to run

Run script/run.

There are also some alternatives:

  • foreman start if you want to simulate Heroku environment.
  • ./main.coffee for plain run.
  • make monitor to automatically restart server on changes.

The following environment variables are recognized:

  • IP, PORT — IP and port to listen;
  • DATABASE_URL, DATABASE_URL_TEST — database credentials;
  • SQLPROF=true — show SQL timings in console;
  • NOCSP — don't output CSP header;
  • NEW_RELIC_LICENSE_KEY — you don't need this.

Scripts

This project uses Scripts to Rule Them All for performing routine tasks. All scripts except console are supported.

Gulp hints

Run gulp to check and test your code. It will lint your code, run tests, show coverage stats and so on. Please run it before every commit.

Useful subtasks:

  • gulp check — only lint;
  • gulp build — build static assets;
  • gulp watch — same as gulp build, but works automagically.
  • gulp test — run unittests without additional checks.

Useful options:

  • gulp test --single health-check.coffee — run only one testsuite;
  • gulp test --reporter verbose — use other reporter.

Programmers' guidelines

  • Use tabs, not spaces. Don't mix them and don't use smarttabs.
  • Prefer single quotes. Use double quotes when you need to escape ' itself.
  • Place use strict in every file.
  • Don't omit extension while requiring: require('./utils.js');.
  • Sync is better than async. Async is better than callbacks.
  • Write tests for everything.
  • Write good assert comments: they should answer the question "What do this function should do?".
  • Keep things outside of main thread: use asynchronous API. And remember: fs.readFile.sync() is way better than fs.readFileSync().

CoffeeScript-specific

  • Use ? when checking for null or undefined: if error? then ....
  • Leave two empty lines between function definitions.
  • -> is preferred, () -> is acceptable.
  • Use interpolation instead of concatenation.
  • Use unless instead of if not. Don't use unless ... else at all.
  • Use is instead of == when you don't mean calculations.
  • Overall: don't try to make CS look like JS.

JS-specific

  • Use if (!!something) when checking for null or undefined.
  • Use semicolons even if they're optional.
  • Place figure brackets on the same line when you declare an anonymous function and on separate line otherwise.
exports.closeSession = function(dbConnection, sess, callback) {
	if (!sess)
	{
		callback(undefined, 'Not closing: empty sessid');
	}
	else
	{
		dbConnection.query(
			'UPDATE `uniusers` SET `sessexpire` = NOW() WHERE `sessid` = ?',
			[sess], callback);
	}
};
  • Use trailing commas. Place them even after last element — it allows you to swap lines easily.
var numbers = [
  1,
  2,
  3,
  4,
];

uonline's Projects

admiral icon admiral

A serious captain for serious people. Hubot.

debut icon debut

Текстовый квест во вселенной Project Universe

test_repo icon test_repo

We use it to test bots that work with GitHub API.

uonline icon uonline

Browser-based MMORPG in a fantasy world.

yoficator icon yoficator

The yoficator used which will be used by uonline. The task is to port it to CoffeeScript.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.