Permalink
Browse files

0.8.0

* add `clean` option
  • Loading branch information...
ianstormtaylor committed May 6, 2014
1 parent 1ef7689 commit 44581c5c87a01a3af93e5c3b92217ffac2a0b77d
Showing with 22 additions and 17 deletions.
  1. +4 −0 History.md
  2. +13 −3 bin/metalsmith
  3. +4 −13 lib/index.js
  4. +1 −1 package.json
View
@@ -1,4 +1,8 @@
+0.8.0 - May 6, 2014
+-------------------
+* add `clean` option
+
0.7.0 - April 29, 2014
----------------------
* let `plugins` be an array in `metalsmith.json`
View
@@ -18,14 +18,24 @@ try {
fatal('it seems like "metalsmith.json" is malformed.');
}
+/**
+ * Settings.
+ */
+
+var src = json.source;
+var dest = json.destination;
+var data = json.metadata;
+var clean = !! json.clean;
+
/**
* Metalsmith.
*/
var metalsmith = new Metalsmith(process.cwd());
-['source', 'destination', 'metadata', 'clean'].forEach(function(key){
- if (json[key]) metalsmith[key](json[key]);
-});
+if (src) metalsmith.source(src);
+if (dest) metalsmith.destination(dest);
+if (data) metalsmith.metadata(data);
+metalsmith.clean(clean);
/**
* Plugins.
View
@@ -8,7 +8,7 @@ var Mode = require('stat-mode');
var noop = function(){};
var path = require('path');
var readdir = require('recursive-readdir');
-var rm = require('rimraf');
+var rm = require('rimraf').sync;
var utf8 = require('is-utf8');
var Ware = require('ware');
@@ -193,19 +193,10 @@ Metalsmith.prototype.read = function(fn){
Metalsmith.prototype.write = function(files, fn){
var dest = this.destination();
+ var clean = this.clean();
- if (this.clean()) {
- rm(dest, function(err){
- if (err) return fn(err);
- writeAll();
- });
- } else {
- writeAll();
- }
-
- function writeAll(){
- each(Object.keys(files), write, fn);
- }
+ if (clean) rm(dest);
+ each(Object.keys(files), write, fn);
function write(file, done){
var data = files[file];
View
@@ -1,7 +1,7 @@
{
"name": "metalsmith",
"repository": "git://github.com/segmentio/metalsmith.git",
- "version": "0.7.0",
+ "version": "0.8.0",
"license": "MIT",
"description": "An extremely simple, pluggable static site generator.",
"keywords": [

0 comments on commit 44581c5

Please sign in to comment.