Comparing version 0.7.5-0 to 0.7.6-0
@@ -76,8 +76,17 @@ #!/usr/bin/env node | ||
// Create a new app | ||
// second argument == app name | ||
else if(argv._[0].match(/^n$|^ne$|^new$/) || argv.n || argv['new']) { | ||
sails.log.info("Generating Sails project..."); | ||
verifyArg(1, "Please specify the name of the new project directory as the first argument."); | ||
createNewApp(argv._[1]); | ||
} | ||
// If not an action, first argument == app name | ||
var appName = argv._[1]; | ||
// Unknown command, assume creating a new app w/ that name | ||
// First argument == app name | ||
else { | ||
verifyArg(0, "Please specify the name of the new project directory as the first argument."); | ||
createNewApp(argv._[0]); | ||
} | ||
function createNewApp (appName) { | ||
sails.log.info("Generating Sails project ("+appName+")..."); | ||
outputPath = outputPath + "/" + appName; | ||
@@ -164,7 +173,2 @@ verifyDoesntExist(outputPath, "A file or directory already exists at: " + outputPath); | ||
} | ||
// Unknown command | ||
else { | ||
sails.log.error("Unknown usage!"); | ||
sailsUsage(); | ||
} | ||
@@ -171,0 +175,0 @@ |
@@ -19,5 +19,2 @@ var _ = require('underscore'); | ||
// TODO: Change back to proper winston when jhurliman's pull request is accepted | ||
// Currently using fork: https://github.com/jhurliman/winston | ||
// See: https://github.com/flatiron/winston/issues/89 | ||
var winston = require('winston'); | ||
@@ -24,0 +21,0 @@ |
@@ -279,4 +279,4 @@ // route.js | ||
// View exists | ||
else if (matches && matches.length) { | ||
// View exists (and header is not 'application/json') | ||
else if (matches && matches.length && req.header('content-type') !== 'application/json') { | ||
fn = renderStaticView; | ||
@@ -283,0 +283,0 @@ } |
exports.definition = function(modelName) { | ||
var Model = sails.models[modelName]; | ||
return { | ||
var actions = { | ||
// Call findAll, unless this is a basic request, then render the index view | ||
index: function(req, res) { | ||
if(req.isAjax || req.isSocket) { | ||
if(req.param('id')) this.find(req, res); | ||
else this.findAll(req, res); | ||
if(req.isAjax || req.isSocket || req.header('content-type') === 'application/json') { | ||
if(req.param('id')) actions.find(req, res); | ||
else actions.findAll(req, res); | ||
} else res.view(); | ||
@@ -158,2 +158,4 @@ }, | ||
}; | ||
return actions; | ||
}; | ||
@@ -160,0 +162,0 @@ |
@@ -26,3 +26,3 @@ { | ||
], | ||
"version": "0.7.5-0", | ||
"version": "0.7.6-0", | ||
"description": "API-driven framework for building realtime apps, using MVC conventions (based on Express and Socket.io)", | ||
@@ -29,0 +29,0 @@ "homepage": "http://sailsjs.com", |
174820