Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b55302
commit aa7f0b3
Showing
6 changed files
with
35 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
node_modules | ||
optipng/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#!/usr/bin/env node | ||
|
||
var spawn = require('child_process').spawn; | ||
var binPath = require('../lib/optipng-bin').path; | ||
|
||
spawn(binPath, process.argv.slice(2), { stdio: 'inherit' }) | ||
.on('exit', process.exit); | ||
.on('exit', process.exit); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
'use strict'; | ||
var exec = require('child_process').exec; | ||
var colors = require('colors'); | ||
var binPath = require('./lib/optipng-bin.js').path; | ||
var which = require('which'); | ||
var path = require('path'); | ||
|
||
|
||
which('make', function(err, makepath){ | ||
which('make', function (err) { | ||
if (err) { | ||
console.log(err.red); | ||
return; | ||
return console.log(err.red); | ||
} | ||
|
||
if (process.platform === 'darwin' || process.platform === 'linux') { | ||
var binDir = path.dirname(binPath); | ||
var buildScript = 'make clean &&' + | ||
'./configure --with-system-zlib --bindir=' + binDir + ' --mandir=man && ' + | ||
'make install'; | ||
exec(buildScript, {cwd: './optipng/'}, function(err, stdout, stderr) { | ||
exec(buildScript, { cwd: './optipng/' }, function (err) { | ||
if (err) { | ||
console.log(err.red); | ||
return; | ||
return console.log(err.red); | ||
} | ||
|
||
console.log('OptiPNG rebuilt successfully'.green); | ||
}); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
/*global describe, it, after */ | ||
/*global describe, it */ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var exec = require('child_process').exec; | ||
var binPath = require('../lib/optipng-bin.js').path; | ||
var fs = require('fs'); | ||
|
||
describe('OptiPNG rebuild', function() { | ||
it('it should rebuild the optipng binaries', function(cb) { | ||
this.timeout(15000); // give this test time to build | ||
var origCTime = fs.statSync(binPath).ctime; | ||
exec('node rebuild-optipng.js', {}, function(err){ | ||
var actualCTime = fs.statSync(binPath).ctime; | ||
assert(actualCTime !== origCTime); | ||
cb(err); | ||
}).path; | ||
describe('OptiPNG rebuild', function () { | ||
it('it should rebuild the optipng binaries', function (cb) { | ||
this.timeout(15000); // give this test time to build | ||
var origCTime = fs.statSync(binPath).ctime; | ||
exec('node rebuild-optipng.js', {}, function (err) { | ||
var actualCTime = fs.statSync(binPath).ctime; | ||
assert(actualCTime !== origCTime); | ||
cb(err); | ||
}).path; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters