Comparing version 0.2.2 to 0.2.3
@@ -124,28 +124,1 @@ var utils = require('./utils'); | ||
} | ||
prototype.string = function(file, key){ | ||
if(!this.context.getObject("strings", file)){ | ||
var stringsDir = this.context.get("appDir")+"/strings/"+file; | ||
var data = fs.readFileSync(stringsDir); | ||
if(data){ | ||
var object = {}; | ||
var strings = data.toString().split('\n'); | ||
for(var i in strings){ | ||
var string = strings[i]; | ||
var key = string.split('=')[0]; | ||
var val = string.split('=')[1]; | ||
object[key] = val; | ||
} | ||
this.context.setObject("strings", file, object); | ||
} | ||
} | ||
var strings = this.context.getObject("strings", file); | ||
return strings[key]; | ||
} | ||
prototype.load = function(file, options){ | ||
var Library = this.context.getObject("libraries", file); | ||
if(Library){ | ||
return new Library(options); | ||
} | ||
} |
@@ -10,3 +10,6 @@ var path = require('path'); | ||
var wrench = require('wrench'); | ||
var log4js = require('log4js'); | ||
var logger = log4js.getLogger(); | ||
var icecream = module.exports = { | ||
@@ -29,6 +32,2 @@ version : JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version | ||
for(var i in this.options){ | ||
this.set(i, this.options[i]); | ||
} | ||
this.set('defaultEngine', 'ejs'); | ||
@@ -45,3 +44,12 @@ this.set('sysDir', __dirname); | ||
for(var i in this.options){ | ||
this.set(i, this.options[i]); | ||
} | ||
this.dispatcher = new Dispatcher(); | ||
this.loadLibraries(); | ||
this.loadHelpers(); | ||
this.loadLanguages(); | ||
} | ||
@@ -56,6 +64,3 @@ | ||
var self = this; | ||
self.loadLibraries(); | ||
self.loadHelpers(); | ||
self.loadLanguages(); | ||
this.server.use(connect.query()); | ||
@@ -69,3 +74,3 @@ this.server.use(connect.bodyParser()); | ||
if (this.get("cluster")==true && cluster.isMaster) { | ||
console.log("cluster enabled..."); | ||
logger.info("cluster enabled..."); | ||
cluster.on('exit', function(worker, code, signal) { | ||
@@ -139,3 +144,3 @@ cluster.fork(); | ||
self.setObject("libraries", file, sysLibrary); | ||
console.log("load sys library : " + file); | ||
logger.info("load sys library : " + file); | ||
} | ||
@@ -152,3 +157,3 @@ }); | ||
self.setObject("libraries", file, appLibrary); | ||
console.log("load app library : " + file); | ||
logger.info("load app library : " + file); | ||
} | ||
@@ -168,3 +173,3 @@ }); | ||
} | ||
console.log("load sys helpers : " + file); | ||
logger.info("load sys helpers : " + file); | ||
} | ||
@@ -182,3 +187,3 @@ }); | ||
} | ||
console.log("load app helpers : " + file); | ||
logger.info("load app helpers : " + file); | ||
} | ||
@@ -198,3 +203,3 @@ }); | ||
self.setObject("languages", file, sysLanguages); | ||
console.log("load sys languages : " + file); | ||
logger.info("load sys languages : " + file); | ||
} | ||
@@ -213,3 +218,3 @@ }); | ||
self.setObject("languages", file, languages); | ||
console.log("load app languages : " + file); | ||
logger.info("load app languages : " + file); | ||
} | ||
@@ -216,0 +221,0 @@ }); |
@@ -10,3 +10,3 @@ var Validator = module.exports = function(){} | ||
prototype.match = function(valid){ | ||
prototype.match = function(validate){ | ||
var object; | ||
@@ -16,3 +16,3 @@ if(this.type() === Array){ | ||
object = this.objects[i]; | ||
if(!valid(object)){ | ||
if(!validate(object+"")){ | ||
return false; | ||
@@ -23,3 +23,3 @@ } | ||
object = this.objects | ||
if(!valid(object)) | ||
if(!validate(object+"")) | ||
return false; | ||
@@ -32,3 +32,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^-?[0-9]+$/); | ||
return object.search(/^-?[0-9]+$/)==-1?false:true; | ||
}); | ||
@@ -39,3 +39,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^(?:-?(?:0|[1-9][0-9]*))$/); | ||
return object.search(/^(?:-?(?:0|[1-9][0-9]*))$/)==-1?false:true; | ||
}); | ||
@@ -46,3 +46,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^(?:-?(?:0|[1-9][0-9]*))?(?:\.[0-9]*)?$/); | ||
return object.search(/^(?:-?(?:0|[1-9][0-9]*))?(?:\.[0-9]*)?$/)==-1?false:true; | ||
}); | ||
@@ -57,3 +57,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/); | ||
return object.search(/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/)==-1?false:true; | ||
}); | ||
@@ -64,3 +64,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^(?!mailto:)(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))|localhost)(?::\d{2,5})?(?:\/[^\s]*)?$/i); | ||
return object.search(/^(?!mailto:)(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))|localhost)(?::\d{2,5})?(?:\/[^\s]*)?$/i)==-1?false:true; | ||
}); | ||
@@ -71,3 +71,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/); | ||
return object.search(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)==-1?false:true; | ||
}); | ||
@@ -78,3 +78,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^[a-zA-Z]+$/); | ||
return object.search(/^[a-zA-Z]+$/)==-1?false:true; | ||
}); | ||
@@ -85,3 +85,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^[a-zA-Z0-9]+$/); | ||
return object.search(/^[a-zA-Z0-9]+$/)==-1?false:true; | ||
}); | ||
@@ -92,3 +92,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^[a-z0-9]+$/); | ||
return object.search(/^[a-z0-9]+$/)==-1?false:true; | ||
}); | ||
@@ -99,3 +99,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^[A-Z0-9]+$/); | ||
return object.search(/^[A-Z0-9]+$/)==-1?false:true; | ||
}); | ||
@@ -106,3 +106,3 @@ } | ||
return this.match(function(object){ | ||
return object.match(/^[\s\t\r\n]*$/); | ||
return object.search(/^[\s\t\r\n]*$/)==-1?true:false; | ||
}); | ||
@@ -109,0 +109,0 @@ } |
{ | ||
"name": "icecream", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "rapid web framework for nodejs", | ||
@@ -27,3 +27,4 @@ "homepage": "http://github.com/nodengine/icecream", | ||
"ejs": "0.8.3", | ||
"wrench": "1.4.4" | ||
"wrench": "1.4.4", | ||
"log4js":"0.5.6" | ||
}, | ||
@@ -30,0 +31,0 @@ "devDependencies": {}, |
@@ -46,4 +46,5 @@ ##About## | ||
var icecream = require('icecream'); | ||
icecream.createServer(); | ||
icecream.set("appDir", __dirname +'/app'); | ||
icecream.createServer({ | ||
appDir:__dirname +'/app' | ||
}); | ||
icecream.listen(3000); | ||
@@ -50,0 +51,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29294
725
93
5
11
+ Addedlog4js@0.5.6
+ Addedasync@0.1.15(transitive)
+ Addedlog4js@0.5.6(transitive)