Comparing version 0.3.11 to 0.3.12
@@ -24,3 +24,3 @@ /** | ||
} | ||
for(var name in config){ | ||
for (var name in config) { | ||
if (global[name] === undefined) { | ||
@@ -34,3 +34,3 @@ global[name] = config[name]; | ||
*/ | ||
function load_runtime_files(){ | ||
function load_runtime_files() { | ||
require(THINK_PATH + "/Common/extend.js"); | ||
@@ -45,3 +45,3 @@ require(THINK_PATH + "/Common/common.js"); | ||
build_app_dir(); | ||
}else if(!fs.existsSync(CACHE_PATH)){ | ||
} else if (!fs.existsSync(CACHE_PATH)) { | ||
check_runtime(); | ||
@@ -54,6 +54,6 @@ } | ||
*/ | ||
function check_runtime(){ | ||
function check_runtime() { | ||
if (!fs.existsSync(RUNTIME_PATH)) { | ||
mkdir(RUNTIME_PATH); | ||
}else{ | ||
} else { | ||
if (!isWritable(RUNTIME_PATH)) { | ||
@@ -69,3 +69,3 @@ console.log(RUNTIME_PATH + " 目录不可写"); | ||
*/ | ||
function build_app_dir(){ | ||
function build_app_dir() { | ||
if (!isDir(APP_PATH)) { | ||
@@ -76,5 +76,5 @@ mkdir(APP_PATH); | ||
var dirs = [ | ||
LIB_PATH, RUNTIME_PATH, CONF_PATH, | ||
LIB_PATH, RUNTIME_PATH, CONF_PATH, | ||
COMMON_PATH, CACHE_PATH, | ||
LOG_PATH, TEMP_PATH, DATA_PATH, | ||
LOG_PATH, TEMP_PATH, DATA_PATH, | ||
LIB_PATH + '/Model', | ||
@@ -86,3 +86,3 @@ LIB_PATH + '/Controller/Home', | ||
]; | ||
dirs.forEach(function(dir){ | ||
dirs.forEach(function(dir) { | ||
if (!isDir(dir)) { | ||
@@ -93,3 +93,3 @@ mkdir(dir, "0755"); | ||
copyFiles(); | ||
}else{ | ||
} else { | ||
console.log(APP_PATH + " is not writable."); | ||
@@ -103,3 +103,3 @@ process.exit(0); | ||
*/ | ||
function copyFiles(){ | ||
function copyFiles() { | ||
var sourceFiles = [ | ||
@@ -119,3 +119,3 @@ THINK_PATH + "/Tpl/IndexController.class.js", | ||
]; | ||
dstFiles.forEach(function(file, i){ | ||
dstFiles.forEach(function(file, i) { | ||
if (!isFile(file)) { | ||
@@ -126,3 +126,3 @@ mkdir(path.dirname(file)); | ||
readStream.pipe(writeStream); | ||
readStream.on("end", function(){}); | ||
readStream.on("end", function() {}); | ||
}; | ||
@@ -129,0 +129,0 @@ }) |
@@ -7,16 +7,16 @@ /** | ||
module.exports = { | ||
"Controller": THINK_LIB_PATH + "/Core/Controller.class.js", | ||
"App": THINK_LIB_PATH + "/Core/App.class.js", | ||
"Behavior": THINK_LIB_PATH + "/Core/Behavior.class.js", | ||
"Cache": THINK_LIB_PATH + "/Core/Cache.class.js", | ||
"Db": THINK_LIB_PATH + "/Core/Db.class.js", | ||
"Dispatcher": THINK_LIB_PATH + "/Core/Dispatcher.class.js", | ||
"Filter": THINK_LIB_PATH + "/Core/Filter.class.js", | ||
"Http": THINK_LIB_PATH + "/Core/Http.class.js", | ||
"Log": THINK_LIB_PATH + "/Core/Log.class.js", | ||
"Model": THINK_LIB_PATH + "/Core/Model.class.js", | ||
"Session": THINK_LIB_PATH + "/Core/Session.class.js", | ||
"Think": THINK_LIB_PATH + "/Core/Think.class.js", | ||
"Valid": THINK_LIB_PATH + "/Core/Valid.class.js", | ||
"View": THINK_LIB_PATH + "/Core/View.class.js", | ||
Controller: THINK_LIB_PATH + "/Core/Controller.class.js", | ||
App: THINK_LIB_PATH + "/Core/App.class.js", | ||
Behavior: THINK_LIB_PATH + "/Core/Behavior.class.js", | ||
Cache: THINK_LIB_PATH + "/Core/Cache.class.js", | ||
Db: THINK_LIB_PATH + "/Core/Db.class.js", | ||
Dispatcher: THINK_LIB_PATH + "/Core/Dispatcher.class.js", | ||
Filter: THINK_LIB_PATH + "/Core/Filter.class.js", | ||
Http: THINK_LIB_PATH + "/Core/Http.class.js", | ||
Log: THINK_LIB_PATH + "/Core/Log.class.js", | ||
Model: THINK_LIB_PATH + "/Core/Model.class.js", | ||
Session: THINK_LIB_PATH + "/Core/Session.class.js", | ||
Think: THINK_LIB_PATH + "/Core/Think.class.js", | ||
Valid: THINK_LIB_PATH + "/Core/Valid.class.js", | ||
View: THINK_LIB_PATH + "/Core/View.class.js", | ||
} |
@@ -57,6 +57,14 @@ //自动加载进行识别的路径 | ||
if (APP_MODE) { | ||
var modeFile = CONF_PATH + "/" + APP_MODE + "_config.js"; | ||
if (isFile(modeFile)) { | ||
C(require(modeFile)); | ||
}; | ||
var modeFiles = [ | ||
THINK_PATH + "/Conf/mode.js", | ||
CONF_PATH + "/mode.js" | ||
]; | ||
modeFiles.forEach(function(file){ | ||
if (isFile(file)) { | ||
var conf = require(file); | ||
if (conf[APP_MODE]) { | ||
C(conf[APP_MODE]); | ||
}; | ||
}; | ||
}) | ||
}; | ||
@@ -123,6 +131,15 @@ //自定义路由 | ||
if (APP_MODE) { | ||
var modeDebugFile = THINK_PATH + "/Conf/" + APP_MODE + "_debug.js"; | ||
if (isFile(modeDebugFile)) { | ||
C(require(modeDebugFile)); | ||
}; | ||
var modeFiles = [ | ||
THINK_PATH + "/Conf/mode.js", | ||
CONF_PATH + "/mode.js" | ||
]; | ||
modeFiles.forEach(function(file){ | ||
if (isFile(file)) { | ||
var conf = require(file); | ||
var key = APP_MODE + "_key"; | ||
if (conf[key]) { | ||
C(conf[key]); | ||
}; | ||
}; | ||
}) | ||
}; | ||
@@ -129,0 +146,0 @@ //debug下自定义状态的配置 |
@@ -23,3 +23,5 @@ var path = require("path"); | ||
//执行模式,默认为WEB起服务模式 | ||
global.APP_MODE = ""; | ||
if (global.APP_MODE === undefined) { | ||
global.APP_MODE = ""; | ||
}; | ||
//可以传一个querystring数据,如: xxx=yyy&aaa=bbb | ||
@@ -26,0 +28,0 @@ if (process.argv[2]) { |
{ | ||
"name": "thinkjs", | ||
"description": "thinkphp web framework for nodejs", | ||
"version": "0.3.11", | ||
"version": "0.3.12", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "welefen", |
Sorry, the diff of this file is not supported yet
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
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
190094
5710