不要怂,就是干,撸起袖子干!

Commit 341bb0fd by Sascha Depold

Cache the return value of supportCoffeeScript

1 parent 809ad7cf
Showing with 11 additions and 6 deletions
...@@ -7,6 +7,7 @@ var path = require("path") ...@@ -7,6 +7,7 @@ var path = require("path")
, moment = require("moment") , moment = require("moment")
, _ = Sequelize.Utils._ , _ = Sequelize.Utils._
, url = require("url") , url = require("url")
, supportCS = undefined
var configuration = { var configuration = {
configFile: process.cwd() + '/config/config.json', configFile: process.cwd() + '/config/config.json',
...@@ -170,14 +171,18 @@ if(typeof program.env === 'string') { ...@@ -170,14 +171,18 @@ if(typeof program.env === 'string') {
} }
var supportCoffeeScript = function() { var supportCoffeeScript = function() {
try { if (supportCS === undefined) {
config = readConfig() try {
} catch(e) { config = readConfig()
console.log(e.message) } catch(e) {
process.exit(1) console.log(e.message)
process.exit(1)
}
supportCS = program.coffee || config.coffee
} }
return program.coffee || config.coffee return supportCS
} }
if (program.migrate || program.undo) { if (program.migrate || program.undo) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!