From 89384f4071637cdbba797965f01d95bf6d2d6128 Mon Sep 17 00:00:00 2001 From: Connor McSheffrey Date: Thu, 10 Oct 2013 20:37:24 -0700 Subject: [PATCH] undo changes to extractCode, using grunt task instead --- extractCode.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/extractCode.js b/extractCode.js index 8728776b..b5714e3c 100644 --- a/extractCode.js +++ b/extractCode.js @@ -16,24 +16,21 @@ function main(dest, filenames) { if (!dest) { throw new Error('no dest provided'); } - console.log(filenames); - filenames.map(function (filename) { - var content = fs.readFileSync(filename).toString('utf8'); - var codeSamples = content.match(CODE_SAMPLE); + var content = fs.readFileSync(filename).toString('utf8'); + var codeSamples = content.match(CODE_SAMPLE); - - codeSamples.map(function (codeSample) { - // Do a little jank preprocessing - codeSample = codeSample.replace('', ''); - var extracted = codeSample.match(PARTS); - if (!extracted) { - throw new Error('Code sample did not match correct format in ' + filename + ': ' + truncate(codeSample)); - } - var filename = extracted[1]; - var content = extracted[2].replace(/\*\*/g, ''); - fs.writeFileSync(argv.dest + '/' + filename, content); - }); + codeSamples.map(function (codeSample) { + // Do a little jank preprocessing + codeSample = codeSample.replace('', ''); + var extracted = codeSample.match(PARTS); + if (!extracted) { + throw new Error('Code sample did not match correct format in ' + filename + ': ' + truncate(codeSample)); + } + var filename = extracted[1]; + var content = extracted[2].replace(/\*\*/g, ''); + fs.writeFileSync(argv.dest + '/' + filename, content); + }); }); }