Permalink
Browse files

Copy static resources

  • Loading branch information...
michaelnisi committed Oct 7, 2012
1 parent 98beffc commit 2ddb1a6d3aa8f131b9e2fc6d07af7ce5f5cd4fde
Showing with 27 additions and 15 deletions.
  1. +19 −6 bin/cli.js
  2. +6 −7 index.js
  3. +1 −1 lib/generate.js
  4. +1 −1 lib/getReader.js
View
@@ -3,6 +3,8 @@
var blake = require('../index.js')
, cop = require('cop')
, getReader = require('../lib/getReader.js')
, copy = require('../lib/copy.js')
, join = require('path').join
;(function () {
var arg = process.argv.splice(2)
@@ -14,12 +16,23 @@ var blake = require('../index.js')
var source = arg.shift()
, target = arg.shift()
, reader = getReader(source, arg)
reader
.pipe(cop('path'))
.pipe(blake(source, target))
.pipe(cop(function (filename) { return filename + '\n' }))
.pipe(process.stdout)
function bake () {
getReader(source, arg)
.pipe(cop('path'))
.pipe(blake(source, target))
.pipe(cop(function (filename) { return filename + '\n' }))
.pipe(process.stdout)
}
if (!arg.length) {
copy(join(source, 'resources'), target)
.on('error', function (err) {
console.error(err)
})
.on('end', bake)
} else {
bake()
}
})()
View
@@ -17,13 +17,12 @@ function blake (source, target) {
, views: views
, paths: paths
}
// probably generate should copy
// copy(source, resolve(target, 'resources'))
// .on('error', function (err) {
// console.error(err)
// })
//
/*
copy(resolve(source, 'resources'), target)
.on('error', function (err) {
console.error(err)
})*/
return generate(props)
}
View
@@ -30,7 +30,7 @@ function generate (props) {
stream.write = function (filename) {
count++
read(filename, function (err, item) {
generate(item, function (err) {
if (err) {
View
@@ -1,4 +1,4 @@
// getReader - return input stream
// getReader - return stream of filenames
module.exports = getReader

0 comments on commit 2ddb1a6

Please sign in to comment.