Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Pre refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mxfli committed Dec 9, 2011
1 parent 1ecd0e3 commit 2d34a92
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 6 deletions.
14 changes: 14 additions & 0 deletions action/baseAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* FileName: baseAction.js
* Author: @mxfli
* CreateTime: 2011-12-09 22:06
* Description:
* Description of baseAction.js
*/
var ota = require("../module/ota.js");

exports.registerActions = function (app, templateEngine) {
app.get("/", function (req, res, next) {
next(new Error("method not implements."));
});
};
20 changes: 20 additions & 0 deletions appInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//show runtime info on console every 1 minute
var express = require('express');
(function appInfo() {
//print app info on the console
console.log("\n#############################################");
console.log("## ", config.appName, config.version);
console.log('## Running under "Express" middleware');
console.log('## Express version:', express.version);
console.log('## Node.js version:', process.version);
console.log("#############################################\n");

function sysInfo() {
console.log("System memory usage:", (process.memoryUsage().rss / (1024 * 1024)).toFixed(2), "Mb");
}

process.title = config.appName;
sysInfo();

setInterval(sysInfo, 1000 * 600);
})();
2 changes: 1 addition & 1 deletion start.sh → bin/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

baseDir=$(dirname $0)
baseDir=$(dirname $0)/..
appRunning=$(pstree | grep ota | wc -l)

if [ "$appRunning" -gt 0 ]; then
Expand Down
25 changes: 25 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* FileName: common.js
* Author: @mxfli
* CreateTime: 2010-08-15 00:52
* Description:
* Including common files, others should include this file.
*/

process.env['MONGO_NODE_DRIVER_HOST'] = "localhost";
process.env['MONGO_NODE_DRIVER_PORT'] = 27017;
process.env['MONGO_NODE_DATABASE_NAME'] = "wap_game";

var myUtil = require("./util.js");
var sysUtil = require("util");

//var util = Object.create(sysUtil, myUtil.prototype);
Object.keys(myUtil).forEach(function(key) {
sysUtil[key] = myUtil[key];
});

global.util = sysUtil; //merge node utils and custom utils.
global.config = require("./config/config.js");
global.assert = require("assert");
//load patchs
//util.loadPatch(__dirname + "/patch");
2 changes: 1 addition & 1 deletion config.template.js → config/config.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

var config = module.exports = {
appName : "OTAServer",
version : "v0.1.9 beta",
version : "v0.2.0",
debug : false,
user : {name:"admin",password:"admin"},
//run wap server behind the nginx proxy server
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

var express = require("express"),
config = require("./config.js"),
ota = require("./ota.js"),
ota = require("module/ota.js"),
path = require("path"),
url = require("url");

Expand Down
6 changes: 3 additions & 3 deletions ota.js → module/ota.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
var fs = require("fs"),
sys = require("sys"),
path = require("path"),
config = require("./config"),
config = require("../config"),
formidable = require("formidable"),
otaUtil = require("./util"),
templateEngine = require("./templatePlugin.js"),
otaUtil = require("../util.js"),
templateEngine = require("../templatePlugin.js"),
WML_MIME_TYPE = "text/vnd.wap.wml;charset=UTF-8";

var ota = function() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2d34a92

Please sign in to comment.