View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
@@ -0,0 +1,8 @@
dependencies:
override:
- make circle-install:
timeout: 600
test:
override:
- make test
View
@@ -71,47 +71,6 @@ module.exports = {
_terminateProcess(1);
},
// This doesn't technically _need_ to be a fatal error- it just is
// because certain grunt modules (e.g. grunt-contrib-watch) don't restart
// when an error occurs.
__GruntAborted__: function(consoleMsg, stackTrace) {
var gruntErr =
'\n------------------------------------------------------------------------\n' +
consoleMsg + '\n' + (stackTrace || '') +
'\n------------------------------------------------------------------------';
log.error(gruntErr);
log.blank();
log.error('Looks like a Grunt error occurred--');
log.error('Please fix it, then **restart Sails** to continue running tasks (e.g. watching for changes in assets)');
log.error('Or if you\'re stuck, check out the troubleshooting tips below.');
log.blank();
log.error('Troubleshooting tips:'.underline);
var relativePublicPath = (nodepath.resolve(process.cwd(), './.tmp'));
var uid = process.getuid && process.getuid() || 'YOUR_COMPUTER_USER_NAME';
log.error();
log.error(' *-> Are "grunt" and related grunt task modules installed locally? Run `npm install` if you\'re not sure.');
log.error();
log.error(' *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.');
log.error();
log.error(' *-> Or maybe you don\'t have permissions to access the `.tmp` directory?');
log.error(' e.g., `' + relativePublicPath + '`', '?');
log.error();
log.error(' If you think this might be the case, try running:');
log.error(' sudo chown -R', uid, relativePublicPath);
log.blank();
// See note above this function - for now, this will not
// actually terminate the process. The rest of Sails should
// continue to run.
// return _terminateProcess(1);
},
__UnknownPolicy__: function(policy, source, pathToPolicies) {
source = source || 'config.policies';
View
@@ -52,7 +52,7 @@ After all hooks have initialized, Sails exposes global variables
> This step does not run when `sails.load()` is used programmatically.
> To also run the initialization step, use `sails.lift()` instead.
+ Start attached servers (by default: Express and Socket.io)
+ Start attached servers (by default: Express)
+ Run the bootstrap function (`sails.config.bootstrap`)
@@ -64,5 +64,3 @@ After all hooks have initialized, Sails exposes global variables
+ `lift()` === `load()` + `initialize()`. It does everything `load()` does, plus it starts any attached servers (e.g. HTTP) and logs a picture of a boat.
> If you have a question that isn't covered here, please feel free to send a PR adding it to this section (even if you don't have the answer!)
View
@@ -7,7 +7,6 @@ var _ = require('lodash');
var util = require('util');
var loadSails = require('./load');
var mixinAfter = require('./private/after');
var __Router = require('../router');
var CaptainsLog = require('captains-log');
@@ -33,9 +32,6 @@ function Sails() {
// Ensure CaptainsLog exists
this.log = CaptainsLog();
// Build a Router instance (which will attach itself to the sails object)
__Router(this);
// Mixin `load()` method to load the pieces
// of a Sails app
this.load = loadSails(this);
@@ -45,24 +41,16 @@ function Sails() {
// Bind `this` context for all `Sails.prototype.*` methods
this.load = _.bind(this.load, this);
this.request = _.bind(this.request, this);
this.lift = _.bind(this.lift, this);
this.lower = _.bind(this.lower, this);
this.getBaseurl = _.bind(this.getBaseurl, this);
this.initialize = _.bind(this.initialize, this);
this.exposeGlobals = _.bind(this.exposeGlobals, this);
this.runBootstrap = _.bind(this.runBootstrap, this);
this.getHost = _.bind(this.getHost, this);
this.isLocalSailsValid = _.bind(this.isLocalSailsValid, this);
this.isSailsAppSync = _.bind(this.isSailsAppSync, this);
this.inspect = _.bind(this.inspect, this);
this.toString = _.bind(this.toString, this);
this.toJSON = _.bind(this.toJSON, this);
this.all = _.bind(this.all, this);
this.get = _.bind(this.get, this);
this.post = _.bind(this.post, this);
this.put = _.bind(this.put, this);
this['delete'] = _.bind(this['delete'], this);
}
@@ -77,30 +65,12 @@ Sails.prototype.lift = require('./lift');
Sails.prototype.lower = require('./lower');
Sails.prototype.getBaseurl = require('./getBaseurl');
Sails.prototype.getBaseURL = Sails.prototype.getBaseurl;
Sails.prototype.getBaseUrl = Sails.prototype.getBaseurl;
Sails.prototype.request = require('./request');
// Expose Express-esque synonyms for low-level usage of router
var _routerBindWrapper = function (path, action) {
this.router.bind(path, action);
return this;
};
Sails.prototype.all = _routerBindWrapper;
Sails.prototype.get = _routerBindWrapper;
Sails.prototype.post = _routerBindWrapper;
Sails.prototype.put = _routerBindWrapper;
Sails.prototype.del = Sails.prototype['delete'] = _routerBindWrapper;
// Private methods:
////////////////////////////////////////////////////////
Sails.prototype.initialize = require('./private/initialize');
Sails.prototype.exposeGlobals = require('./private/exposeGlobals');
Sails.prototype.runBootstrap = require('./private/bootstrap');
Sails.prototype.getHost = require('./private/getHost');
Sails.prototype.isLocalSailsValid = require('./private/isLocalSailsValid');
Sails.prototype.isSailsAppSync = require('./private/isSailsAppSync');
View
@@ -7,22 +7,6 @@
module.exports = [
'moduleloader',
'logger',
'request',
'orm',
'views',
'blueprints',
'responses',
'controllers',
'sockets',
'pubsub',
'policies',
'services',
'csrf',
'cors',
'i18n',
'userconfig',
'session',
'grunt',
'http',
'userhooks'
'userconfig'
];
View
@@ -66,8 +66,6 @@ module.exports = function(sails) {
tmp: path.resolve(appPath, '.tmp')
},
// Start off `routes` and `middleware` as empty objects
routes: {},
middleware: {}
};
View

This file was deleted.

Oops, something went wrong.
View
@@ -26,17 +26,9 @@ module.exports = function lift(configOverride, cb) {
if (err) return sails.log.error(err);
};
async.series([
function(cb) {
sails.load(configOverride, cb);
},
sails.initialize
], function sailsReady(err, async_data) {
sails.load(configOverride, function(err) {
if (err) {
return sails.lower(function (errorLoweringSails){
sails.lower(function (errorLoweringSails) {
cb(err);
@@ -46,10 +38,9 @@ module.exports = function lift(configOverride, cb) {
});
}
sails.initialize();
_printSuccessMsg(sails);
// try {console.timeEnd('core_lift');}catch(e){}
sails.emit('lifted');
sails.isLifted = true;
return cb(null, sails);
View
@@ -55,7 +55,7 @@ module.exports = function(sails) {
// and options that were passed in programmatically.
config: [Configuration.load],
// Load hooks into memory, with their middleware and routes
// Load hooks into memory
hooks: ['config', loadHooks],
// Populate the "registry"
@@ -88,10 +88,7 @@ module.exports = function(sails) {
cb();
}
],
// Load the router and bind routes in `sails.config.routes`
router: ['registry', sails.router.load]
]
}, ready__(cb));
View
@@ -50,35 +50,13 @@ module.exports = function lower(cb) {
});
// Shut down HTTP server
// TODO: defer this to the http and sockets hooks-- use sails.emit('lowering')
// Shut down Socket server
// TODO: defer this to the http hook-- use sails.emit('lowering')
// wait for all attached servers to stop
sails.emit('lower');
var log = sails.log.verbose;
async.series([
function shutdownSockets(cb) {
if (!sails.hooks.sockets) {
return cb();
}
try {
log('Shutting down socket server...');
var timeOut = setTimeout(cb, 100);
sails.io.server.unref();
sails.io.server.close();
sails.io.server.on('close', function() {
log('Socket server shut down successfully.');
clearTimeout(timeOut);
cb();
});
} catch (e) {
clearTimeout(timeOut);
cb();
}
},
function shutdownHTTP(cb) {
if (!sails.hooks.http) {
View

This file was deleted.

Oops, something went wrong.
View
@@ -12,44 +12,20 @@
* @api private
*/
module.exports = function initialize(cb) {
module.exports = function initialize() {
var sails = this;
// Callback is optional
cb = cb || function(err) {
if (err) sails.log.error(err);
};
// Indicate that server is starting
sails.log.verbose('Starting app at ' + sails.config.appPath + '...');
// Add "beforeShutdown" events
process.once('SIGUSR2', function() {
sails.lower(function() {
process.kill(process.pid, 'SIGUSR2');
});
});
process.on('SIGINT', function() {
sails.lower(process.exit);
});
process.on('SIGTERM', function() {
sails.lower(process.exit);
});
process.on('exit', function() {
if (!sails._exiting) sails.lower();
});
// Run the app bootstrap
sails.runBootstrap(function afterBootstrap(err) {
if (err) {
sails.log.error('Bootstrap encountered an error: (see below)');
return cb(err);
if (!sails._exiting) {
sails.lower();
}
// And fire the `ready` event
// This is listened to by attached servers, etc.
sails.emit('ready');
cb(null, sails);
});
// And fire the `ready` event
// This is listened to by attached servers, etc.
sails.emit('ready');
};
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.