Skip to content

Commit

Permalink
Sails debug works, tweaks to grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed Feb 5, 2014
1 parent c0365f5 commit a0d7081
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
25 changes: 24 additions & 1 deletion bin/sails-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

var Sails = require('../lib/app')
, path = require('path')
, Womb = require('child_process')
, captains = require('captains-log');


Expand All @@ -18,6 +19,28 @@ node --debug `which sails` $@


module.exports = function () {
var config = {};
var log = captains();

// Use the app's local Sails in `node_modules` if one exists
// But first make sure it'll work...
var appPath = process.cwd();
var pathToSails = path.resolve(appPath, '/node_modules/sails');
if ( !Sails.isLocalSailsValid(pathToSails, appPath) ) {
// otherwise, use the currently-running instance of Sails
pathToSails = path.resolve(__dirname, './sails.js');
}

console.log();
log.info('Running node-inspector on this app...');
log.info('If you don\'t know what to do next, type `help`');
log.info('Or check out the docs:');
log.info('http://nodejs.org/api/debugger.html');
console.log();


log.info(('( to exit, type '+'<CTRL>+<C>'+' )').grey);
console.log();

// Spin up child process for Sails
Womb.spawn('node', ['debug', pathToSails, 'lift'], { stdio: 'inherit' });
};
3 changes: 2 additions & 1 deletion lib/hooks/grunt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = function (sails) {
*/

var Err = require('../../../errors'),
path = require('path'),
ChildProcess = require('child_process');


Expand Down Expand Up @@ -39,7 +40,7 @@ module.exports = function (sails) {
cb_afterTaskStarted = cb_afterTaskStarted || function () {};

var environment = sails.config.environment;
var pathToSails = __dirname.replace(' ', '\ ') + '/../../..';
var pathToSails = path.resolve(__dirname, '../../../'); //.replace(' ', '\ ') + '/../../..';

// Only relevant in a development environment:
// (unfortunately, cannot use sails.getBaseurl() because it is not calculatable yet)
Expand Down

0 comments on commit a0d7081

Please sign in to comment.