Skip to content

Commit

Permalink
Updated path API to work with the new Node
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Young committed Jul 14, 2012
1 parent 32d5bb9 commit 8230bc0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 6 additions & 4 deletions 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 = [
Expand All @@ -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));
});
}
Expand Down
3 changes: 1 addition & 2 deletions 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 <alex@helicoid.net>"
, "engines": ["node >= 0.4.7"]
, "main": "./lib/index.js"
Expand All @@ -9,4 +9,3 @@
, "url" : "http://github.com/alexyoung/pop-gallery.git"
}
}

3 changes: 1 addition & 2 deletions 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"'));
Expand Down

0 comments on commit 8230bc0

Please sign in to comment.