Permalink
Browse files

Write example

  • Loading branch information...
1 parent 2ddb1a6 commit bcd0036b8b143dc9c77af0a8655a971ee6d76de2 @michaelnisi committed Oct 7, 2012
Showing with 18 additions and 10 deletions.
  1. +18 −10 example/generate.js
View
@@ -1,14 +1,22 @@
+// generate - generate blake site
+
var blake = require('blake')
- , source = '/Users/michael/workspace/troubled'
- , target = '/tmp/troubled-site'
- , resolve = require('path').resolve
+ , source = 'blake-site'
+ , target = '/tmp/blake-site'
+ , join = require('path').join
, Reader = require('fstream').Reader
- , props = { path:resolve(source, 'data') }
- , reader = new Reader(props)
+ , props = { path:join(source, 'data') }
, cop = require('cop')
+ , copy = require('../lib/copy.js')
-reader
- .pipe(cop('path'))
- .pipe(blake(source, target))
- .pipe(cop(function (filename) { return filename + '\n' }))
- .pipe(process.stdout)
+copy(join(source, 'resources'), target)
+ .on('error', function (err) {
+ console.error(err)
+ })
+ .on('end', function () {
+ new Reader(props)
+ .pipe(cop('path'))
+ .pipe(blake(source, target))
+ .pipe(cop(function (filename) { return filename + '\n' }))
+ .pipe(process.stdout)
+ })

0 comments on commit bcd0036

Please sign in to comment.