Comparing version 0.0.4 to 0.0.5
#!/usr/bin/env node | ||
var colors = require('colors'); | ||
var fs = require('fs'); | ||
@@ -17,3 +18,3 @@ var _ = require('underscore'); | ||
fuse.watchSrcFile(relativePath + path.path, argv.i, argv.o); | ||
console.log('Watching ' + path.path + ' for changes.'); | ||
console.log('Watching ' + colors.cyan( path.path ) + ' for changes.'); | ||
}); | ||
@@ -23,3 +24,3 @@ | ||
fuse.watchFile(argv.i, argv.o); | ||
console.log('Watching ' + argv.i + ' for changes.\nCTRL + C to stop.'); | ||
console.log('Watching ' + colors.cyan( argv.i ) + ' for changes.\nCTRL + C to stop.'); | ||
@@ -31,2 +32,2 @@ } else { | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
var colors = require('colors'); | ||
var fs = require('fs'); | ||
@@ -7,4 +8,18 @@ var _ = require('underscore'); | ||
// regular expression to find referenced files | ||
var re = fuse.re = /\/\/ ?@depends (.+)\b/gi; | ||
var re = fuse.re = /\/\/ ?@(?:depends|import) (.+)\b/gi; | ||
fuse.formatTime = function () { | ||
var d = new Date(); | ||
return [ | ||
d.getHours(), | ||
':', | ||
d.getSeconds(), | ||
'.', | ||
d.getSeconds() | ||
].join(''); | ||
} | ||
// core function for parsing and outputing a fused file | ||
@@ -26,6 +41,6 @@ fuse.fuseFile = function (inputFile, outputFile, exit) { | ||
var output = content; | ||
// do we have anything to combine? | ||
if (!matches) { | ||
console.log('All done, there was nothing to combine.'); | ||
if (!matches.length) { | ||
console.log('All done, there was nothing to combine (output file was not generated).'.blue); | ||
if (exit) process.exit(0); | ||
@@ -63,6 +78,6 @@ } | ||
if (err) { | ||
console.log('Failed to write to file.'); | ||
console.log('Failed to write to file.'.red); | ||
process.exit(1); | ||
} else { | ||
console.log('Updated ' + outputFile + ', fusing ' + (matches.length+1) + ' files.\n'); | ||
console.log('Updated ' + colors.green(outputFile) + ', fusing ' + (matches.length+1) + ' files @ ' + colors.green(fuse.formatTime()) + '.\n'); | ||
if (exit) process.exit(); | ||
@@ -84,3 +99,3 @@ } | ||
if (curr.mtime.getTime() !== prev.mtime.getTime()) { | ||
console.log(inputFileName + ' changed.'); | ||
console.log(colors.blue(( inputFileName ) + ' changed.')); | ||
fuse.fuseFile(inputFile, outputFile, false); | ||
@@ -104,3 +119,3 @@ } | ||
if (curr.mtime.getTime() !== prev.mtime.getTime()) { | ||
console.log(srcFileName + ' changed.'); | ||
console.log(colors.blue(srcFileName + ' changed.')); | ||
fuse.fuseFile(inputFile, outputFile, false); | ||
@@ -120,3 +135,3 @@ } | ||
} catch (e) { | ||
console.log('Unable to read input file %s', inputFile); | ||
console.log('Unable to read input file %s'.red, inputFile); | ||
process.exit(1); | ||
@@ -123,0 +138,0 @@ } |
@@ -8,7 +8,7 @@ { | ||
"repository" : {"type": "git", "url": "https://github.com/smebberson/fuse.git"}, | ||
"dependencies" : { "underscore": ">=1.2.0", "optimist": ">=0.2.8" }, | ||
"dependencies" : { "underscore": ">=1.2.0", "optimist": ">=0.2.8", "colors": ">=0.5.1" }, | ||
"bin" : { "fuse": "./bin/fuse.js" }, | ||
"directories" : { "bin": "./bin" }, | ||
"version" : "0.0.4", | ||
"version" : "0.0.5", | ||
"engines" : {"node": ">=0.4"} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
8272
15
167
3
+ Addedcolors@>=0.5.1
+ Addedcolors@1.4.0(transitive)