Permalink
Browse files

Updated path API to work with the new Node

  • Loading branch information...
1 parent 32d5bb9 commit 8230bc0b08804c27ca3c30aed87114821940833c Alex Young committed Jul 14, 2012
Showing with 8 additions and 8 deletions.
  1. +6 −4 lib/index.js
  2. +1 −2 package.json
  3. +1 −2 test/test.js
View
@@ -1,15 +1,17 @@
var fs = require('fs')
- , path = require('path');
+ , path = require('path')
+ , existsSync = require('fs').existsSync || path.existsSync
+ ;
module.exports = {
generator: {
run: function(helpers, pathName) {
var paths = ['_posts', '_lib', '_layouts', '_includes', 'stylesheets', 'javascripts'];
- if (!path.existsSync(pathName)) fs.mkdirSync(pathName, 0777);
+ if (!existsSync(pathName)) fs.mkdirSync(pathName, 0777);
paths.forEach(function(p) {
p = path.join(pathName, p);
- if (!path.existsSync(p)) fs.mkdirSync(p, 0777);
+ if (!existsSync(p)) fs.mkdirSync(p, 0777);
});
var files = [
@@ -24,7 +26,7 @@ module.exports = {
var templateFileName = __dirname + f[0]
, outFileName = f[1] + '/' + path.basename(f[0]);
- if (!path.existsSync(outFileName))
+ if (!existsSync(outFileName))
fs.writeFileSync(outFileName, fs.readFileSync(templateFileName));
});
}
View
@@ -1,6 +1,6 @@
{ "name": "pop-gallery"
, "description": "Provides helpers and a generator that can be used to build galleries."
-, "version": "0.1.0"
+, "version": "0.1.1"
, "author": "Alex R. Young <alex@helicoid.net>"
, "engines": ["node >= 0.4.7"]
, "main": "./lib/index.js"
@@ -9,4 +9,3 @@
, "url" : "http://github.com/alexyoung/pop-gallery.git"
}
}
-
View
@@ -1,7 +1,6 @@
var assert = require('assert')
, gallery = require(__dirname + '/../lib/index')
-
-var result = gallery.helpers.gallery.apply({ root: __dirname + '/fixtures/' });
+ , result = gallery.helpers.gallery.apply({ root: __dirname + '/fixtures/' });
// Make sure it actually finds the files
assert.ok(result.match('div id="gallery"'));

0 comments on commit 8230bc0

Please sign in to comment.