Skip to content

Commit

Permalink
Run command: save file first; add various project directories to the …
Browse files Browse the repository at this point in the history
…require.paths array
  • Loading branch information
drnic committed Dec 22, 2009
1 parent 3e26f9e commit 8d30163
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Commands/Run File or Spec.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<string>saveActiveFile</string>
<key>command</key>
<string>#!/usr/bin/env node
// NOTE: This original implementation has support for running node.js/express web application jspec test files. This will be extracted into a separate bundle + command at some stage.
var sys = require("sys");
if(process.ENV.TM_FILENAME.match(/spec\.(.*)\.js/)) {
var expressPath = process.ENV.TM_BUNDLE_SUPPORT + "/vendor/express/";
require.paths.unshift(expressPath + 'spec/lib', expressPath + 'lib');
if(process.ENV.TM_FILENAME.match(/(.*)spec\.js/)) {
require.paths.unshift(process.ENV.TM_BUNDLE_SUPPORT + '/spec/lib');
if (typeof process.ENV.TM_PROJECT_DIRECTORY != "undefined" &amp;&amp; process.ENV.TM_PROJECT_DIRECTORY != null &amp;&amp; process.ENV.TM_PROJECT_DIRECTORY != "") {
require.paths.unshift(process.ENV.TM_PROJECT_DIRECTORY + '/lib');
require.paths.unshift(process.ENV.TM_PROJECT_DIRECTORY + '/src');
require.paths.unshift(process.ENV.TM_PROJECT_DIRECTORY + '/spec');
}
require("jspec");
require("express");
require("express/spec");
quit = process.exit;
print = puts;
Expand Down

0 comments on commit 8d30163

Please sign in to comment.