Permalink
Browse files

Modify gen ID format, no longer includes millisecs value. Busterify a…

…e86 test.
  • Loading branch information...
1 parent 55b8edd commit 0a6f3522311b0bc2231a6de0c4b3bff0a3670367 @cliffano committed Feb 16, 2013
Showing with 124 additions and 222 deletions.
  1. +1 −0 CHANGELOG.md
  2. +11 −9 lib/ae86.js
  3. +111 −213 test/ae86.js
  4. +1 −0 test/fixtures/params.js
View
@@ -1,5 +1,6 @@
### 0.0.7-pre
* Engine template file extension is now optional, defaults to html
+* Modify gen ID format, no longer includes millisecs value
### 0.0.6
* Fix incorrect URL path and directory path on Windows
View
@@ -1,7 +1,8 @@
+/*jshint esnext: true */
var _ = require('underscore'),
async = require ('async'),
dateformat = require('dateformat'),
- engine = require('./engine'),
+ Engine = require('./engine'),
ncp = require('ncp'),
p = require('path'),
watchtree = require('watch-tree-maintained'),
@@ -29,6 +30,8 @@ AE86.prototype.init = function (cb) {
*/
AE86.prototype.generate = function (cb) {
+ var self = this;
+
function _static(cb) {
// copy static files as-is
ncp.ncp('static', 'out', cb);
@@ -37,28 +40,25 @@ AE86.prototype.generate = function (cb) {
function _pages(cb) {
function _params() {
-
// initialise userland params
var params = require(p.join(process.cwd(), 'params')).params;
-
// add website info
params.sitemap = params.sitemap || {};
- params.__genId = dateformat('yyyymmddHHMMssLl');
-
+ params.__genId = dateformat('yyyymmddHHMMss');
return params;
}
- var _engine = new engine(),
+ var engine = new Engine(),
tasks = {};
['partials', 'layouts', 'pages'].forEach(function (dir) {
tasks[dir] = function (cb) {
- _engine.compile(dir, cb);
+ engine.compile(dir, cb);
};
});
async.parallel(tasks, function (err, results) {
- _engine.merge('out', results, _params(), cb);
+ engine.merge('out', results, _params(), cb);
});
}
@@ -70,6 +70,8 @@ AE86.prototype.generate = function (cb) {
* A change means the project website will automatically be regenerated.
*/
AE86.prototype.watch = function () {
+ const SAMPLE_RATE = 5;
+
var self = this;
function _listener() {
@@ -82,7 +84,7 @@ AE86.prototype.watch = function () {
function _watch(file) {
var watcher = watchtree.watchTree(file, {
ignore: '\\.swp',
- 'sample-rate': 5
+ 'sample-rate': SAMPLE_RATE
});
watcher.on('fileCreated', function(path, stats) {
console.log('%s was created', file);
Oops, something went wrong.

0 comments on commit 0a6f352

Please sign in to comment.