Skip to content

Commit

Permalink
Add .travis.yml. Fix minify command's error reporting. Remove executa…
Browse files Browse the repository at this point in the history
…bles all together.
  • Loading branch information
Karthik Viswanathan committed Aug 5, 2012
1 parent ec9af0c commit 0b59ec4
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 138 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
@@ -0,0 +1,6 @@
language: node_js
node_js:
- 0.8
- 0.6
before_install:
- sudo apt-get -y install optipng libjpeg-progs
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
# Nodefront
# Nodefront [![Build Status](https://secure.travis-ci.org/karthikv/nodefront.png)](http://travis-ci.org/karthikv/nodefront)

To see a styled version of the documentation below, please visit [nodefront's website](http://karthikv.github.com/nodefront).

Expand Down
10 changes: 5 additions & 5 deletions commands/minify.js
Expand Up @@ -179,7 +179,7 @@ function minify(fileName, toFileName, type) {
*/
function imageExecCallback(error, stdout, stderr) {
if (error) {
deferred.resolve(error);
deferred.reject(error);
} else {
console.log('Optimized ' + relativeFileName + ' to ' +
relativeToFileName + '.');
Expand All @@ -189,16 +189,16 @@ function minify(fileName, toFileName, type) {

if (type === 'png') {
// use optipng to optimize PNG
exec(__dirname + '/../executables/optipng -o4 -clobber -out ' +
toFileName + ' ' + fileName, function(error, stdout, stderr) {
exec('optipng -o4 -out ' + toFileName + ' ' + fileName,
function(error, stdout, stderr) {
// remove backup file created by optipng
exec('rm ' + toFileName + '.bak');
imageExecCallback(error, stdout, stderr);
});
} else if (type === 'jpg' || type === 'jpeg') {
// use jpegtran to optimize JPEG
exec(__dirname + '/../executables/jpegtran -optimize -progressive' +
' -outfile ' + toFileName + ' ' + fileName, imageExecCallback);
exec('jpegtran -optimize -progressive -outfile ' + toFileName + ' ' +
fileName, imageExecCallback);
} else {
utils.readFile(fileName)
.then(function(contents) {
Expand Down
Binary file removed executables/.libs/jpegtran
Binary file not shown.
Binary file removed executables/jpeg-8/.libs/libjpeg.8.dylib
Binary file not shown.
130 changes: 0 additions & 130 deletions executables/jpegtran

This file was deleted.

Binary file removed executables/optipng
Binary file not shown.
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -24,5 +24,8 @@
"socket.io": "0.9.6",
"stylus": "0.27.2",
"uglify-js": "1.3.2"
},
"scripts": {
"test": "make test"
}
}
12 changes: 10 additions & 2 deletions test/test.minify.js
Expand Up @@ -120,7 +120,11 @@ describe('nodefront minify', function() {
expectedDir + '/images/book.min.jpg');
})
.fin(function() {
return q.ncall(fs.unlink, fs, inputDir + '/images/book.min.jpg');
try {
fs.unlinkSync(inputDir + '/images/book.min.jpg');
} catch (error) {
// don't worry about this; there was likely an error earlier
}
})
.then(done)
.end();
Expand All @@ -133,7 +137,11 @@ describe('nodefront minify', function() {
expectedDir + '/images/placeholder.min.png');
})
.fin(function() {
return q.ncall(fs.unlink, fs, inputDir + '/images/placeholder.min.png');
try {
fs.unlinkSync(inputDir + '/images/placeholder.min.png');
} catch (error) {
// don't worry about this; there was likely an error earlier
}
})
.then(done)
.end();
Expand Down

0 comments on commit 0b59ec4

Please sign in to comment.