Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set_global( msg.current, function (){
if( msg.force_dev_log == '-d' ){
global.DEV_LOG = true;
}
var Migrate = Class.extend({
init : function ( migration, utils ){
var Flow = require( 'node.flow' );
this.migration = migration;
this.utils = utils;
this.model = require( CORE_DIR + '/model' );
this.flow = new Flow();
},
exit : function (){
process.send({ exit : true });
process.exit();
},
reset : function ( db, end ){
var fs = require( 'fs' );
var yaml = require( 'js-yaml' );
var aws = require( 'aws2js' );
var Class = require( 'node.class' );
var regex = UTILS.regex;
module.exports = Class.extend({
init : function (){
var source = fs.readFileSync( process.cwd() + '/config/prod/config.yml', 'utf8' );
var config = yaml.safeLoad( source ).aws;
if( config ){
var s3 = this.s3 = aws.load( 's3', config.key, config.secret );
s3.setBucket( config.s3.bucket );
}
},
create : function ( args, callback ){
var tgt = args.tgt_path;
var date = new Date();
var Class = require( 'node.class' );
module.exports = Class.extend({
index : function ( req, res ){
res.render( 'home/index' );
}
});
* We should have used express to handle this.
* However railway routes does not support it.
* We might need to write our own router class someday.
*/
/**
* Module dependencies.
* @private
*/
var Class = require( 'node.class' );
/**
* @public
* @class
*/
var Stack = Class.extend({
init : function ( instance, actions, handler_id, helpers, req, res, next ){
this.index = 0;
this.instance = instance;
this.stack = actions;
this.req = req;
this.res = res;
this.out = next;
res.locals.__handler_id = handler_id;
Object.keys( helpers ).forEach( function ( key ){
res.locals[ key ] = helpers[ key ];
});
},
var Class = require( 'node.class' );
module.exports = Class.extend({
index : function ( req, res, next ){
res.render( 'welcome/index' );
}
});
var Class = require( 'node.class' );
module.exports = Class.extend({
no_content : function ( err, req, res, next ){
if( err ){
LOG.error( 404, res, err );
if( req.accepts( 'html' )){
req.flash( 'flash-error', req.msg + ' not found' );
return res.redirect( 'back' );
}
if( req.accepts( 'json' )){
res.status( 404 );
return res.end();
}
}
_run_migration : function ( method, schema_name, cb ){
var flow = this.flow;
var self = this;
var migration_actions = self.migration[ method ]( Model );
var Runner = Class.extend( migration_actions );
var series = function ( action ){
self.series( action );
};
var parallel = function ( action ){
self.parallel( action );
};
var join = function (){
flow.join.apply( flow, slice.call( arguments ));
};
var end = function ( action ){
flow.end( function (){
var args = slice.call( arguments );
var Class = require( 'node.class' );
var Cache = Model( 'Cache' );
module.exports = Class.extend({
common_locals : function ( req, res, next ){
res.locals({
sidebar : req.sidebar,
sess_user : req.user,
path : req.path,
query : '?'
});
next();
},
no_content : function ( err, req, res, next ){
err && LOG.error( 204, res, err );
req.flash( 'flash-error', req.msg + ' not found' );
*
* @fileOverview
* Controller filters class.
*/
/**
* Module dependencies.
* @private
*/
var Class = require( 'node.class' );
/**
* @public
* @class
*/
var Filter = Class.extend({
/**
* Initialize before and after actions trunk.
* @constructor
* @this {Filter}
*/
init : function (){
this.before_actions = [];
this.after_actions = [];
},
/**
* Store before filters in the class prop.
* @public
* @this {Filter}
* @param {Function} handler Before filter action.