Comparing version 1.1.12 to 1.1.13
@@ -33,8 +33,10 @@ var fs = require('fs'), | ||
views: {}, | ||
helpers: {} | ||
helpers: {}, | ||
errors: {} | ||
}, | ||
controllers: {}, | ||
models: {}, | ||
views: {}, | ||
helpers: {}, | ||
views: {}, | ||
errors: {}, | ||
register: function() {} | ||
@@ -48,2 +50,3 @@ }; | ||
this.root = root || process.cwd(); | ||
this.errors = this.structure.errors; | ||
this.elements = []; | ||
@@ -192,3 +195,3 @@ | ||
fs.readdirSync(dir).forEach(function(file) { | ||
if (file.match(/^(Roco|environment|routes|autoload)\.(js|coffee|json|yml|yaml)$/)) { | ||
if (file[0] === '.' || file.match(/^(Roco|environment|routes|autoload)\.(js|coffee|json|yml|yaml)$/)) { | ||
return; | ||
@@ -195,0 +198,0 @@ } |
@@ -38,2 +38,3 @@ var fs = require('fs'); | ||
if (!file.cache || file.stat && file.stat.mtime < stat.mtime) { | ||
debug('reload ' + what + ' from ' + info.file); | ||
delete Module._cache[info.file]; | ||
@@ -80,3 +81,3 @@ file.cache = requireFile(info.file); | ||
function isRegisteredType(type) { | ||
return ['tools', 'controllers', 'views', 'models', 'helpers'].indexOf(type) !== -1; | ||
return ['errors', 'tools', 'controllers', 'views', 'models', 'helpers'].indexOf(type) !== -1; | ||
} | ||
@@ -138,3 +139,1 @@ | ||
}; | ||
@@ -124,50 +124,63 @@ var path = require('path'), | ||
function railwayConsole(compound, args) { | ||
var ctx = require('repl').start('compound> ').context; | ||
// Create a separate 'global' context for the repl console | ||
(function() { | ||
var self = this; | ||
var repl = require('repl').start( { | ||
prompt: 'compound> ', | ||
useGlobal: true | ||
}); | ||
ctx.reload = function() { | ||
// TODO: reload models | ||
ctx.app = compound.app; | ||
ctx.compound = compound; | ||
for (var model in compound.models) { | ||
ctx[model] = compound.models[model]; | ||
} | ||
repl.defineCommand('reload', { | ||
help: 'Reinitialize compound app', | ||
action: (this.reload = function() { | ||
// TODO: reload models | ||
this.app = compound.app; | ||
this.compound = compound; | ||
for (var model in compound.models) { | ||
this[model] = compound.models[model]; | ||
} | ||
if (args[0]) { | ||
eval('with(self) { ' + args[0] + ' }'); | ||
} | ||
}) | ||
}); | ||
if (args[0]) { | ||
eval('with(ctx) { ' + args[0] + ' }'); | ||
} | ||
}; | ||
ctx.c = function() { | ||
var l = arguments.length, | ||
message = 'Callback called with ' + l + | ||
this.c = function() { | ||
var l = arguments.length, | ||
message = 'Callback called with ' + l + | ||
' argument' + (l === 1 ? '' : 's') + (l > 0 ? ':\n' : ''); | ||
for (var i = 0; i < 10; i++) { | ||
if (i < arguments.length) { | ||
ctx['_' + i] = arguments[i]; | ||
message += 'var _' + i + ' = ' + inspect(arguments[i]) + '\n'; | ||
} else { | ||
if (ctx.hasOwnProperty('_' + i)) { | ||
delete ctx['_' + i]; | ||
for (var i = 0; i < 10; i++) { | ||
if (i < arguments.length) { | ||
self['_' + i] = arguments[i]; | ||
message += 'var _' + i + ' = ' + inspect(arguments[i]) + '\n'; | ||
} else { | ||
if (self.hasOwnProperty('_' + i)) { | ||
delete self['_' + i]; | ||
} | ||
} | ||
} | ||
} | ||
console.log(message); | ||
}; | ||
console.log(message); | ||
}; | ||
function inspect(obj) { | ||
if (obj instanceof Array) { | ||
return obj.length === 0 ? '[]' : '[' + obj[0].constructor.modelName + ']' + '{' + obj.length + '}'; | ||
} else { | ||
return String(obj); | ||
function inspect(obj) { | ||
if (obj instanceof Array) { | ||
return obj.length === 0 ? '[]' : '[' + obj[0].constructor.modelName + ']' + '{' + obj.length + '}'; | ||
} else { | ||
return String(obj); | ||
} | ||
} | ||
} | ||
ctx.exit = function() { | ||
process.exit(0); | ||
}; | ||
this.exit = function() { | ||
process.exit(0); | ||
}; | ||
process.nextTick(ctx.reload); | ||
process.nextTick(this.reload); | ||
repl.on('exit', function() { | ||
console.log('Bye'); | ||
process.exit(0); | ||
}); | ||
})(); | ||
return false; | ||
@@ -174,0 +187,0 @@ } |
{ | ||
"name": "compound", | ||
"version": "1.1.12", | ||
"version": "1.1.13", | ||
"author": "Anatoliy Chakkaev", | ||
@@ -37,7 +37,7 @@ "contributors": [ | ||
"yaml-js": ">= 0.0.2", | ||
"coffee-script": ">= 1.1.1", | ||
"coffee-script": ">= 1.6.x", | ||
"ejs-ext": ">= 0.1.4-2", | ||
"jade-ext": ">= 0.0.5", | ||
"railway-routes": ">= 0.0.10", | ||
"kontroller": ">= 0.0.10", | ||
"kontroller": ">= 0.0.11", | ||
"inflection": "~1.2.5" | ||
@@ -44,0 +44,0 @@ }, |
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
510869
13449
Updatedcoffee-script@>= 1.6.x
Updatedkontroller@>= 0.0.11