docpad-plugin-cleanurls
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -18,12 +18,8 @@ // Generated by CoffeeScript 1.3.3 | ||
CleanUrlsPlugin.prototype.parseAfter = function(opts, next) { | ||
CleanUrlsPlugin.prototype.docpadReady = function(opts) { | ||
var database, docpad; | ||
docpad = this.docpad; | ||
database = docpad.getDatabase(); | ||
docpad.log('debug', 'Creating clean urls'); | ||
database.findAll({ | ||
outPath: { | ||
$endsWith: '.html' | ||
} | ||
}).forEach(function(document) { | ||
docpad.log('debug', 'Applying clean urls'); | ||
database.on('add change', function(document) { | ||
var documentUrl, relativeBaseUrl, relativeDirUrl; | ||
@@ -33,17 +29,10 @@ documentUrl = document.get('url'); | ||
relativeBaseUrl = '/' + document.get('relativeBase'); | ||
document.addUrl(relativeBaseUrl); | ||
document.set({ | ||
url: relativeBaseUrl | ||
}); | ||
document.setUrl(relativeBaseUrl); | ||
} | ||
if (/index\.html$/i.test(documentUrl)) { | ||
relativeDirUrl = '/' + document.get('relativeDirPath'); | ||
document.addUrl(relativeDirUrl); | ||
return document.set({ | ||
url: relativeDirUrl | ||
}); | ||
return document.setUrl(relativeDirUrl); | ||
} | ||
}); | ||
docpad.log('debug', 'Created clean urls'); | ||
return typeof next === "function" ? next() : void 0; | ||
return docpad.log('debug', 'Applied clean urls'); | ||
}; | ||
@@ -50,0 +39,0 @@ |
@@ -17,7 +17,7 @@ // Generated by CoffeeScript 1.3.3 | ||
MyTester.prototype.testServer = function(next) { | ||
var expect, fs, request, tester; | ||
var expect, fsUtil, request, tester; | ||
tester = this; | ||
expect = testers.expect; | ||
request = testers.request; | ||
fs = require('fs'); | ||
fsUtil = require('fs'); | ||
MyTester.__super__.testServer.apply(this, arguments); | ||
@@ -30,10 +30,14 @@ return this.suite('cleanurls', function(suite, test) { | ||
return request("" + baseUrl + "/welcome.html", function(err, response, actual) { | ||
var actualStr; | ||
if (err) { | ||
throw err; | ||
return done(err); | ||
} | ||
return fs.readFile("" + outExpectedPath + "/welcome.html", function(err, expected) { | ||
actualStr = actual.toString(); | ||
return fsUtil.readFile("" + outExpectedPath + "/welcome.html", function(err, expected) { | ||
var expectedStr; | ||
if (err) { | ||
throw err; | ||
return done(err); | ||
} | ||
expect(actual.toString()).to.equal(expected.toString()); | ||
expectedStr = expected.toString(); | ||
expect(actualStr, expectedStr); | ||
return done(); | ||
@@ -40,0 +44,0 @@ }); |
{ | ||
"name": "docpad-plugin-cleanurls", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Adds support for Clean Urls to DocPad", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/docpad-extras", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4472
81