Permalink
Browse files

load coffeescript if the ./lib folder doesnt exist

  • Loading branch information...
1 parent 5a61e36 commit 2396a8696480c260a0bbe7724b60049fbfcb1561 @lancejpollard lancejpollard committed Oct 5, 2012
Showing with 12 additions and 11 deletions.
  1. +1 −1 bin/tower
  2. +11 −10 index.js
View
2 bin/tower
@@ -7,7 +7,7 @@ var path = require('path');
var script = path.join(process.cwd(), 'scripts' , 'tower');
if (process.env.TOWER_COMMAND == '-v')
- process.env.TOWER_COMMAND = 'new'
+ process.env.TOWER_COMMAND = 'new';
if (fs.existsSync(script)) {
require(script);
View
21 index.js
@@ -1,7 +1,16 @@
var fs = require('fs');
var path = require('path');
-if (process.env.TOWER_COMMAND != 'new') {
+// require tower
+var root = path.join(__dirname, 'lib/tower.js');
+var rootExists = fs.existsSync(root);
+
+// node path resolution was broken before
+if (process.platform == 'win32' && process.version <= 'v0.8.5') {
+ require('./path')
+}
+
+if (!rootExists || process.env.TOWER_COMMAND != 'new') {
try {
require('./coffee-inheritance.js');
} catch (e) {
@@ -10,15 +19,7 @@ if (process.env.TOWER_COMMAND != 'new') {
}
}
-// node path resolution was broken before
-if (process.platform == 'win32' && process.version <= 'v0.8.5') {
- require('./path')
-}
-
-// require tower
-var root = path.join(__dirname, 'lib/tower.js');
-
-if (fs.existsSync(root))
+if (rootExists)
module.exports = require(root);
else
module.exports = require(path.join(__dirname, 'packages/tower.coffee'));

0 comments on commit 2396a86

Please sign in to comment.