From 8230bc0b08804c27ca3c30aed87114821940833c Mon Sep 17 00:00:00 2001 From: Alex Young Date: Sat, 14 Jul 2012 20:15:16 +0100 Subject: [PATCH] Updated path API to work with the new Node --- lib/index.js | 10 ++++++---- package.json | 3 +-- test/test.js | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/index.js b/lib/index.js index 37b9222..42262f3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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)); }); } diff --git a/package.json b/package.json index 2b52b15..9f30bee 100644 --- a/package.json +++ b/package.json @@ -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 " , "engines": ["node >= 0.4.7"] , "main": "./lib/index.js" @@ -9,4 +9,3 @@ , "url" : "http://github.com/alexyoung/pop-gallery.git" } } - diff --git a/test/test.js b/test/test.js index 046c7e6..acd2b00 100644 --- a/test/test.js +++ b/test/test.js @@ -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"'));