Comparing version
@@ -7,2 +7,6 @@ const fs = require('fs') | ||
module.exports = Blorg | ||
module.exports.archetypes = { | ||
blog : require('./archetypes/blog') | ||
, presentation : require('./archetypes/presentation') | ||
} | ||
@@ -22,2 +26,3 @@ function handleError (err) { | ||
this.resolvedDirectories = {} | ||
this.resolvedFiles = {} | ||
@@ -85,14 +90,26 @@ this.loadData(function (err) { | ||
Blorg.prototype.toDirectory = function (value, callback) { | ||
var uri = path.resolve(this.root, value) | ||
return this._toPath(value, 'dir', callback) | ||
} | ||
if (this.resolvedDirectories[value]) | ||
return callback(null, this.resolvedDirectories[value]) | ||
// utility function for plugins | ||
Blorg.prototype.toFile = function (value, callback) { | ||
return this._toPath(value, 'file', callback) | ||
} | ||
Blorg.prototype._toPath = function (value, type, callback) { | ||
var uri = path.resolve(this.root, value) | ||
, cache = this['resolved' + (type == 'dir' ? 'Directories' : 'Files')] | ||
if (cache[value]) | ||
return callback(null, cache[value]) | ||
fs.stat(uri, function (err, stat) { | ||
if (err) | ||
return callback(err) | ||
if (!stat.isDirectory()) | ||
if (type == 'dir' && !stat.isDirectory()) | ||
return callback(new Error('Config property "' + value + '" is not a directory: ' + uri)) | ||
else if (type == 'file' && !stat.isFile()) | ||
return callback(new Error('Config property "' + value + '" is not a file: ' + uri)) | ||
this.resolvedDirectories[value] = uri | ||
cache[value] = uri | ||
@@ -99,0 +116,0 @@ return callback(null, uri) |
{ | ||
"name": "blorg" | ||
, "version": "0.1.2" | ||
, "description": "Flexible static blog generator" | ||
, "main": "lib/blorg.js" | ||
, "bin": "bin/blorg.js" | ||
, "homepage" : "https://github.com/rvagg/blorg" | ||
, "repository" : { | ||
"name" : "blorg" | ||
, "version" : "0.2.0" | ||
, "description" : "Flexible static blog generator" | ||
, "main" : "lib/blorg.js" | ||
, "bin" : "bin/blorg.js" | ||
, "homepage" : "https://github.com/rvagg/blorg" | ||
, "repository" : { | ||
"type" : "git" | ||
, "url" : "https://github.com/rvagg/blorg" | ||
} | ||
, "keywords": [ | ||
, "keywords" : [ | ||
"blog" | ||
] | ||
, "authors" : [ | ||
, "authors" : [ | ||
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)" | ||
] | ||
, "license": "MIT" | ||
, "scripts": {} | ||
, "dependencies": { | ||
"swig" : "~0.13.5" | ||
, "ssbl" : "~0.0.0" | ||
, "execute" : "~0.1.0" | ||
, "after" : "~0.7.0" | ||
, "xtend" : "~2.0.3" | ||
, "mkdirp" : "~0.3.5" | ||
, "license" : "MIT" | ||
, "dependencies" : { | ||
"swig" : "~0.13.5" | ||
, "ssbl" : "~0.0.0" | ||
, "execute" : "~0.1.0" | ||
, "after" : "~0.7.0" | ||
, "xtend" : "~2.0.3" | ||
, "mkdirp" : "~0.3.5" | ||
, "brucedown" : "~0.0.1" | ||
, "map-async" : "~0.1.1" | ||
} | ||
} | ||
, "devDependencies" : { | ||
"bustermove" : "*" | ||
, "referee" : "*" | ||
, "tap" : "*" | ||
} | ||
, "scripts" : { | ||
"test" : "tap tests/*-test.js" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
21508
53.57%18
38.46%493
60.06%1
-50%16
Infinity%8
33.33%3
Infinity%7
16.67%+ Added
+ Added