Skip to content

Commit

Permalink
Program can handle local paths now.
Browse files Browse the repository at this point in the history
  • Loading branch information
vesln committed Feb 12, 2012
1 parent 05820a2 commit 8a13e94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/program.js
Expand Up @@ -38,7 +38,7 @@ Program.prototype.file = function() {
* @api public
*/
Program.prototype.exec = function() {
return this._ext === '.js' ? 'node' : 'coffee';
return this._ext !== '.js' ? 'coffee' : 'node';
};

/**
Expand All @@ -58,7 +58,10 @@ Program.prototype.path = function() {
* @api public
*/
Program.prototype.exists = function() {
return path.existsSync(this._full);
return path.existsSync(this._full)
|| path.existsSync(this._full + '.js')
|| path.existsSync(this._full + '.coffee')
|| path.existsSync(path.join(process.cwd(), this._full));
};

/**
Expand Down
6 changes: 6 additions & 0 deletions test/program.test.js
Expand Up @@ -50,6 +50,12 @@ describe('Program', function() {

var program = new Program(path.join(__dirname, 'app.test.js'));
program.exists().should.be.true;

var program = new Program('test/support/whiny.js');
program.exists().should.be.true;

var program = new Program('test/support/whiny');
program.exists().should.be.true;
});
});
});
Expand Down

0 comments on commit 8a13e94

Please sign in to comment.