Skip to content

Commit

Permalink
Merge branch 'master' of github.com:balderdashy/sails into csrf-config-2
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG.md
  • Loading branch information
konstantinzolotarev committed Mar 17, 2015
2 parents 5ef54bd + 9b9837d commit a6a00b2
Show file tree
Hide file tree
Showing 23 changed files with 116 additions and 35 deletions.
3 changes: 3 additions & 0 deletions 0.11-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ The "firehose" feature for testing with sockets has been deprecated. If you don
It has always been the intention that files in the Sails `config` folder have no precedence over each other, and that the filenames and subfolders (with the exception of `local.js` and the `env` and `locale` subfolders) be used merely for organization. However, in previous Sails versions, saving config files in subfolders would have the effect that the filename would be added as a key in `sails.config`, so that if you saved some config in `config/foo/bar.js`, then that config would be namespaced under `sails.config.bar`. This was unintentional and potentially confusing as 1) the directory name is ignored, and 2) moving the file would change the config key. This has been fixed in v0.11.x: config files in subfolders will be treated the same as those in the root `config` folder. If you are for some reason relying on the old behavior, you may set `dontFlattenConfig` to `true` in your `.sailsrc` file, but we would strongly recommend that you instead just namespace the config yourself by setting the desired key on `module.exports`; for example `module.exports.foo = {...}`. See [issue #2544](https://github.com/balderdashy/sails/issues/2544) for more details.
#### Waterline now uses Bluebird
As of v0.11, Waterline now supports Bluebird (instead of q) for promises. If you are using `.exec()` you won't be affected-- only if you are using `.then()`. See https://github.com/balderdashy/sails/issues/1186 for more information.
## New features
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### master

* [ENHANCEMENT] Support CSRF hook route configuration [#2366](https://github.com/balderdashy/sails/issues/2366)
* [BUGFIX] Fix [RangeError: Maximum call stack size exceeded] error in PubSub hook
* [ENHANCEMENT] Support layout for Ractive template engine


Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
--

Copyright © 2012-2014 Mike McNeil & Balderdash Design Co.
Copyright © 2012-2015 Mike McNeil & Balderdash Design Co.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
1 change: 1 addition & 0 deletions MODULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Below, you'll find an overview of the modules maintained by the core team and co
| [sails-generate-gulpfile](https://github.com/Karnith/sails-generate-gulpfile) | |
| [sails-generate-bower-gulp](https://github.com/Karnith/sails-generate-bower-gulp) | |
| [sails-generate-angular-gulp](https://github.com/Karnith/sails-generate-angular-gulp) | |
| [sails-generate-ember-blueprints](https://github.com/mphasize/sails-generate-ember-blueprints) | |


#### Socket Client SDKs
Expand Down
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<a href="http://sailsjs.org"><img alt="Sails.js logo" src="http://balderdashy.github.io/sails/images/logo.png" title="Sails.js"/></a>
</h1>

### [Website](http://sailsjs.org/) &nbsp; [Getting Started](http://sailsjs.org/#!getStarted) &nbsp; [Docs](http://sailsjs.org/#!documentation) &nbsp; [Submit Issue](https://github.com/balderdashy/sails/blob/master/README.md#issue-submission)
### [Website](http://sailsjs.org/) &nbsp; [Getting Started](http://sailsjs.org/#!/getStarted) &nbsp; [Docs](http://sailsjs.org/#!/documentation) &nbsp; [Submit Issue](https://github.com/balderdashy/sails/blob/master/README.md#issue-submission)

[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/balderdashy/sails?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Expand All @@ -19,14 +19,7 @@ $ sudo npm install sails -g
```

> ######New release available
> The v0.11 release of Sails (with support for Socket.io v1.0) is nearly here. You can preview the v0.11 upgrading guide [here](http://sailsjs.org/#/documentation/concepts/Upgrading). To install the beta, run:
> ```
> sudo npm install -g sails@beta
> ```
> ######Upgrading from v0.9?
> Be sure and check out the [v0.10 upgrading guide](http://sailsjs.org/#/documentation/concepts/Upgrading).
> The v0.11 release of Sails (with support for Socket.io v1.0) is here! To read the v0.11 migration guide, click [here](http://sailsjs.org/#!/documentation/concepts/Upgrading).

## Your First Sails Project
Expand Down Expand Up @@ -59,7 +52,7 @@ Sails [controllers](http://sailsjs.org/#!documentation/controllers) are compatib


The ORM, [Waterline](https://github.com/balderdashy/waterline), has a well-defined adapter system for supporting all kinds of datastores. Officially supported databases include [MySQL](https://github.com/balderdashy/sails-mysql), [PostgreSQL](https://github.com/balderdashy/sails-postgresql), [MongoDB](https://github.com/balderdashy/sails-mongo), [Redis](https://github.com/balderdashy/sails-redis), local [disk](https://github.com/balderdashy/sails-disk), and local [memory](https://github.com/balderdashy/sails-memory). [Community adapters](https://github.com/balderdashy/sails-docs/blob/master/intro-to-custom-adapters.md#notable-community-adapters) exist for [CouchDB](https://github.com/search?q=sails+couch&nwo=codeswarm%2Fsails-couchdb-orm&search_target=global&ref=cmdform), [neDB](https://github.com/adityamukho/sails-nedb), [TingoDB](https://github.com/andyhu/sails-tingo), [SQLite](https://github.com/AndrewJo/sails-sqlite3/tree/0.10), [Oracle](https://github.com/search?q=sails+oracle&type=Repositories&ref=searchresults), [MSSQL](https://github.com/cnect/sails-mssql), [DB2](https://github.com/search?q=sails+db2&type=Repositories&ref=searchresults), [ElasticSearch](https://github.com/search?q=%28elasticsearch+AND+sails%29+OR+%28elasticsearch+AND+waterline%29+&type=Repositories&ref=searchresults), [Riak](https://github.com/search?q=sails+riak&type=Repositories&ref=searchresults),
[neo4j](https://www.npmjs.org/package/sails-neo4j),
[neo4j](https://www.npmjs.org/package/sails-neo4j), [OrientDB](https://github.com/vjsrinath/sails-orientdb),
[Amazon RDS](https://github.com/TakenPilot/sails-rds), [DynamoDB](https://github.com/TakenPilot/sails-dynamodb), [Azure Tables](https://github.com/azuqua/sails-azuretables), and [RethinkDB](https://github.com/search?q=%28%28sails+rethinkdb+in%3Aname%29+OR+%28waterline+rethinkdb+in%3Aname%29%29&type=Repositories&ref=searchresults); for various 3rd-party REST APIs like Quickbooks, Yelp, and Twitter, including a configurable generic [REST API adapter](https://github.com/zohararad/sails-rest); plus some [eclectic projects](https://www.youtube.com/watch?v=OmcQZD_LIAE).

<!-- Core adapter logos -->
Expand Down Expand Up @@ -89,7 +82,7 @@ Need help or have a question?

- [Tutorials](https://github.com/balderdashy/sails-docs/blob/master/FAQ.md#where-do-i-get-help)
- [Stackoverflow](http://stackoverflow.com/questions/tagged/sails.js)
- [#sailsjs on Freenode](http://webchat.freenode.net/) (IRC channel)
- [#sailsjs on Freenode](https://webchat.freenode.net/?channels=sailsjs) (IRC channel)
- [Professional/Enterprise Options](https://github.com/balderdashy/sails-docs/blob/master/FAQ.md#are-there-professional-support-options)

_Please don't use the issue tracker for support/questions._
Expand All @@ -108,21 +101,21 @@ _Please don't use the issue tracker for support/questions._
## Team
Sails is actively built and maintained by [Balderdash](http://balderdash.co) ([@balderdashy](http://twitter.com/balderdashy)), a realtime web & mobile studio, with the help of these [contributors](https://github.com/balderdashy/sails/graphs/contributors):

[![Mike McNeil](http://gravatar.com/avatar/199046437b76e6ca73e00b4cc182a1c5?s=144)](http://michaelmcneil.com) | [![Cody Stoltman](https://1.gravatar.com/avatar/368567acca0c5dfb9a4ff512c5c0c3fa?s=144)](http://particlebanana.com) | [![Scott Gress](https://0.gravatar.com/avatar/b74e07aa543552709bf546ca279c9c67?s=144)](http://www.pigandcow.com/) | [![Greg Thornton](https://2.gravatar.com/avatar/b7c50edb558d5289331440f45ff600b0?s=144)](http://xdissent.com) | [![Zoli Kahan](http://gravatar.com/avatar/55dbeca986f875e1d1cb4d51e2fc42e4?s=144)](http://www.zolmeister.com/)
[![Mike McNeil](http://gravatar.com/avatar/199046437b76e6ca73e00b4cc182a1c5?s=144)](http://michaelmcneil.com) | [![Cody Stoltman](https://1.gravatar.com/avatar/368567acca0c5dfb9a4ff512c5c0c3fa?s=144)](http://particlebanana.com) | [![Scott Gress](https://0.gravatar.com/avatar/b74e07aa543552709bf546ca279c9c67?s=144)](http://www.pigandcow.com/) | [![Irl Nathan](https://avatars0.githubusercontent.com/u/1598650?v=3&s=144)](http://irlnathan.github.io/sailscasts/) | [![Rachael Shaw](https://avatars0.githubusercontent.com/u/3065949?v=3&s=144)](http://twitter.com/fancydoilies)
:---:|:---:|:---:|:---:|:---:
[Mike McNeil](http://michaelmcneil.com) | [Cody Stoltman](https://github.com/particlebanana) | [Scott Gress](https://github.com/sgress454) | [Greg Thornton](https://github.com/xdissent) | [Zoli Kahan](https://github.com/Zolmeister)
[Mike McNeil](http://michaelmcneil.com) | [Cody Stoltman](https://github.com/particlebanana) | [Scott Gress](https://github.com/sgress454) | [Irl Nathan](https://github.com/irlnathan) | [Rachael Shaw](https://github.com/rachaelshaw)

[Balderdash](http://balderdash.co) designs/builds scalable Node.js apps for startups and enterprise customers. After building a few apps and taking them into production, we realized that the Node.js development landscape was very much still the Wild West. Over time, after trying lots of different methodologies, we decided to crystallize all of our best practices into this framework. [I](http://twitter.com/mikermcneil) hope it saves you some time :)


## License

[MIT License](http://sails.mit-license.org/) Copyright © 2012-2014 Mike McNeil
[MIT License](http://sails.mit-license.org/) Copyright © 2012-2015 Mike McNeil

> Sails is built around so many great open-source technologies that it would never have crossed our minds to keep it proprietary. We owe huge gratitude and props to TJ Holowaychuk ([@visionmedia](https://github.com/visionmedia)) and Guillermo Rauch ([@guille](https://github.com/guille)) for the work they did, as well as the stewards of all the other open-source modules we use. Sails could never have been developed without your tremendous contributions to the node community.
> Sails is built around so many great open-source technologies that it would never have crossed our minds to keep it proprietary. We owe huge gratitude and props to TJ Holowaychuk ([@visionmedia](https://github.com/visionmedia)) and Guillermo Rauch ([@rauchg](https://github.com/rauchg)) for the work they did, as well as the stewards of all the other open-source modules we use. Sails could never have been developed without your tremendous contributions to the node community.


![[email protected]](http://sailsjs.org/images/bkgd_squid@2x.png)
![[email protected]](http://sailsjs.org/images/bkgd_squiddy.png)

[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/8acf2fc2ca0aca8a3018e355ad776ed7 "githalytics.com")](http://githalytics.com/balderdashy/sails)
3 changes: 2 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Our short-to-medium-term roadmap items, in order of descending priority:

Feature | Owner | Details
:------------------------------------------------------- | :------------------------------------------------------------------------------- | :------
Log key configuration info on lift | [@mikermcneil](https://github.com/mikermcneil) | For example, if `config/local.js` is present, log a message explaining that it will be used. See also https://github.com/dominictarr/rc/issues/23#issuecomment-33875197
Lock + unlock app in dev env | [@mikermcneil](https://github.com/mikermcneil) | Capability for a hook to "lock" and/or "unlock" the app (in a development env only). When "locked" all requests are intercepted by an endpoint which responds with either a page or JSON payload communicating a custom message. e.g. so the grunt hook can let us know as it syncs. e.g. `sails.emit('lock')`
Hook dependency/load order mgmt | [@mikermcneil](https://github.com/mikermcneil) | rebase the hook dependency+optional depenency system originally proposed by @ragulka
Standalone router | [@mikermcneil](https://github.com/mikermcneil) | replace express dependency in `lib/router` with standalone router- either routification or @dougwilson's new project. See https://github.com/balderdashy/sails/pull/2351#issuecomment-71855236 for more information.
Expand All @@ -45,7 +46,7 @@ _(feel free to suggest things)_

Feature | Owner | Details
:---------------------------------------------- | :------------------------------------------------- | :------
SPDY protocol support | [@mikermcneil](https://github.com/mikermcneil) | https://github.com/balderdashy/sails/issues/80
SPDY/HTTP2 protocol support | [@mikermcneil](https://github.com/mikermcneil) | https://github.com/balderdashy/sails/issues/80
Have a `sails migrate` or `sails create-db` command | [@globegitter](https://github.com/Globegitter) | For production environments it would be nice to have a save/secure command that creates the db automatically for you
`sails generate test` | [@jedd-ahyoung](https://github.com/jedd-ahyoung) | Generate *.test.js following [Sails recommended directory structure](http://sailsjs.org/#/documentation/concepts/Testing). Example usage: `sails generate test User:Model` creates prepopulated file '/test/unit/models/UserModel.test.js'. See https://github.com/balderdashy/sails/pull/2499 for discussion |
Wildcard action policies | [@ProLoser](https://github.com/ProLoser)| Instead of only having one global action policy `'*'` it would be nice if we could define policies for a specific action in all controllers: `'*/destroy': ['isOwner']` or something similar.
46 changes: 46 additions & 0 deletions bin/sails-deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env node


/**
* Module dependencies
*/

var _ = require('lodash');
var util = require('util');
var path = require('path');
var rconf = require('../lib/app/configuration/rc');

/**
* `sails deploy`
*
* Deploy the Sails app in the current directory to a hosting provider.
*/

module.exports = function() {

var commands = rconf.commands;
var deploy = commands && commands.deploy;
var modulePath = deploy && deploy.module;
var module;

// If no module path was specified, bail out
if (!modulePath) {
console.error("No module specified for the `deploy` command.");
console.error("To use `sails deploy`, set a `commands.deploy.module` setting in your .sailsrc file");
return;
}

// Attempt to require the specified module from the project node_modules folder
try {
module = require(path.resolve(process.cwd(), 'node_modules', modulePath));
}

// If the module couldn't be required, bail out
catch (e) {
console.error("Could not require module at path: " + modulePath + ". Please check the path and try again.");
}

module({config: {}}, console.log);


};
7 changes: 7 additions & 0 deletions bin/sails.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ cmd.description('');
cmd.usage('[something]');
cmd.action(require('./sails-generate'));

// $ sails deploy
cmd = program.command('deploy');
// cmd.option('--dry');
cmd.unknownOption = NOOP;
cmd.description('');
cmd.usage('');
cmd.action(require('./sails-deploy'));


// $ sails console
Expand Down
2 changes: 1 addition & 1 deletion errors/fatal.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ module.exports = {
probableAdapterModuleName = 'sails-' + probableAdapterModuleName;
}
log.error('Otherwise, if you\'re trying to use an adapter named `' + adapterId + '`, please run ' +
'`npm install ' + probableAdapterModuleName + '@' + sailsMajorV + '.' + sailsMinorV + '.x`');
'`npm install ' + probableAdapterModuleName + ' --save'/*'@' + sailsMajorV + '.' + sailsMinorV + '.x`'*/);
return _terminateProcess(1);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ If you need a special event in your hook, you *will* want to namespace it. For

In my hook's initialize method, I might have the following:

```javscript
```javascript

// Wait until all the middleware from this app's controllers have loaded
sails.after('hook:controllers:loaded', function () {
Expand Down
2 changes: 1 addition & 1 deletion lib/app/private/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = function runBootstrap(cb) {
var timeoutMs = sails.config.bootstrapTimeout || 2000;
var timer = setTimeout(function bootstrapTookTooLong() {
sails.log.warn(util.format(
'Bootstrap is taking unusually long to execute its callback (%d miliseconds).\n'+
'Bootstrap is taking unusually long to execute its callback (%d milliseconds).\n'+
'Perhaps you forgot to call it? The callback is the first argument of the function, `cb`.',
timeoutMs));
}, timeoutMs);
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/cors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function(sails) {
*/

var _ = require('lodash'),
util = require('sails-util')
util = require('sails-util');

/**
* Expose hook definition
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/csrf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function(sails) {

defaults: {

// CSRF middleware protection, all non-GET requests must send '_csrf' parmeter
// CSRF middleware protection, all non-GET requests must send '_csrf' parameter
// _csrf is a parameter for views, and is also available via GET at /csrfToken
// TODO: move into csrf hook
csrf: false
Expand Down
3 changes: 1 addition & 2 deletions lib/hooks/http/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ module.exports = function(sails) {
var express = require('express');



// Create express server
var app = sails.hooks.http.app = express();

app.disable('x-powered-by');
// (required by Express 3.x)
var usingSSL = sails.config.ssl.key && sails.config.ssl.cert;

Expand Down
1 change: 0 additions & 1 deletion lib/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

var _ = require('lodash');
var defaultsDeep = require('merge-defaults');
var async = require('async');


Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/orm/backwards-compatibility/upgrade-datastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module.exports = function howto_normalizeDatastore(sails){
sails.log.warn('(it has a `registerCollection()` method.)');
sails.log.warn('Since you\'re running Sails v0.10.x, it probably isn\'t going to work.');
sails.log.warn('To attempt to install the updated version of this adapter, run:');
sails.log.warn('npm install ' + connectionObject.adapter + '@0.10.x');
sails.log.warn('npm install ' + connectionObject.adapter + ' --force --save');
return Err.fatal.__InvalidAdapter__(moduleName, 'Adapter is not compatible with the current version of Sails.');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/policies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ module.exports = function(sails) {

// Bind policy function to route
var fn = this.lookupFn(event.target.policy, 'config.routes');
sails.router.bind(event.path, fn, event.verb);
sails.router.bind(event.path, fn, event.verb, _.merge(event.options, event.target));
},


Expand Down
6 changes: 5 additions & 1 deletion lib/hooks/pubsub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ module.exports = function(sails) {
var id = record[this.primaryKey] || record;
// Get the socket room to publish to
var room = this.room(id, "message");

// Ensure that we're working with a clean, unencumbered object
data = _.cloneDeep(data);

// Create the payload
var payload = {
verb: "messaged",
Expand Down Expand Up @@ -537,7 +541,7 @@ module.exports = function(sails) {
options = options || {};

// Ensure that we're working with a clean, unencumbered object
changes = _.clone(changes);
changes = _.cloneDeep(changes);

// Enforce valid usage
var validId = _.isString(id) || _.isFinite(id);
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/session/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function(app) {
defaults: {
session: {
adapter: 'memory',
key: "sails.sid"
key: 'sails.sid'
}
},

Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/views/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ module.exports = function(sailsAppPath) {
} catch (err) {
fn(err);
}
}
};

/**
* Underscore support.
Expand Down
Loading

0 comments on commit a6a00b2

Please sign in to comment.