Permalink
Browse files

Merge remote-tracking branch '1602/master'

  • Loading branch information...
2 parents fb33d3d + 63cbfe4 commit 84b3233525f8e1ebd7d7a0da0d0d0c584cb2f592 @olalonde olalonde committed Oct 31, 2012
Showing with 19 additions and 3 deletions.
  1. +1 −0 .travis.yml
  2. +9 −1 lib/railway_routes.js
  3. +3 −2 package.json
  4. +1 −0 test/railway_routes_test.js
  5. +5 −0 test/spec_helper.js
View
1 .travis.yml
@@ -3,3 +3,4 @@ node_js:
- 0.4
- 0.6
- 0.7
+ - 0.8
View
10 lib/railway_routes.js
@@ -151,6 +151,8 @@ Map.prototype.root = function (handler, middleware, options) {
* Add path helper to `pathTo` collection
*/
Map.prototype.addPath = function (templatePath, action, helperName) {
+ var app = this.app;
+
if (templatePath instanceof RegExp) {
// TODO: think about adding to `path_to` routes by reg ex
return;
@@ -200,7 +202,13 @@ Map.prototype.addPath = function (templatePath, action, helperName) {
path = hook(path);
});
}
- return path;
+ var appprefix = '';
+ if (app.path) {
+ appprefix = app.path();
+ } else {
+ appprefix = app.set('basepath') || '';
+ }
+ return appprefix + path;
}.bind(this);
this.pathTo[helperName].toString = function () {
return this.pathTo[helperName]();
View
5 package.json
@@ -3,7 +3,7 @@
"name": "railway-routes",
"description": "Resourceful routing for ExpressJS, ruby-on-rails 2 style",
"tags": "express, routing, ror, rails, railway",
- "version": "0.0.7",
+ "version": "0.0.8",
"homepage": "http://railwajs.com/routing.html",
"repository": {
"type": "git",
@@ -20,6 +20,7 @@
"express": "3.x"
},
"devDependencies": {
- "nodeunit": "*"
+ "nodeunit": "*",
+ "semicov": "latest"
}
}
View
1 test/railway_routes_test.js
@@ -10,6 +10,7 @@ function fakeApp(container) {
container.push(args);
};
});
+ app.set = function () {};
return app;
}
View
5 test/spec_helper.js
@@ -1,3 +1,8 @@
+if (!process.env.TRAVIS) {
+ require('semicov').init('lib', 'Railway Routes'); // 'lib' is name of dir with code
+ process.on('exit', require('semicov').report);
+}
+
var group_name = false, EXT_EXP;
function it(should, test_case) {

0 comments on commit 84b3233

Please sign in to comment.