node-advpng
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -8,4 +8,4 @@ 'use strict'; | ||
name: 'advpng', | ||
url: 'http://raw.github.com/colorhook/node-advpng/master/', | ||
pathPrefix: '../vendor', | ||
url: 'https://raw.github.com/colorhook/node-advpng/master/', | ||
pathPrefix: '../bin', | ||
urlPrefix: 'vendor', | ||
@@ -36,3 +36,2 @@ platforms: { | ||
var targetPath = []; | ||
var arch = process.arch === 'x64' ? 'x64' : 'x86'; | ||
var exec = target.name; | ||
@@ -44,9 +43,4 @@ | ||
targetPath.push(target.pathPrefix); | ||
targetPath.push(platform.path); | ||
targetPath.unshift(__dirname); | ||
if (platform.arch === true) { | ||
targetPath.push(arch); | ||
} | ||
if (!options.dll && platform.suffix !== undefined) { | ||
@@ -53,0 +47,0 @@ exec += '.' + platform.suffix; |
{ | ||
"name": "node-advpng", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "advpng Node wrapper", | ||
@@ -18,2 +18,6 @@ "keywords": ["advpng", "advpng node wrapper"], | ||
"url": "http://colorhook.com" | ||
}, { | ||
"name": "LaurentGoderre", | ||
"email": "laurent.goderre@gmail.com", | ||
"url": "http://github.com/LaurentGoderre" | ||
}], | ||
@@ -20,0 +24,0 @@ "bugs": { |
@@ -16,3 +16,3 @@ 'use strict'; | ||
console.log(chalk.red('pre-build test failed, compiling from source...')); | ||
throw new Error("node-advpng cannot be installed, please contact colorhook@gmail.com"); | ||
throw new Error("node-advpng cannot be installed, please contact colorhook@gmail.com"); | ||
} else { | ||
@@ -23,15 +23,32 @@ console.log(chalk.green('pre-build test passed successfully, skipping build...')); | ||
} | ||
console.log(binPath); | ||
if (fs.existsSync(binPath)) { | ||
runTest(); | ||
} else { | ||
request.get(binUrl) | ||
.pipe(fs.createWriteStream(binPath)) | ||
.on('close', function () { | ||
try{ | ||
//fs.chmod(binPath, '0755'); | ||
}catch(err){} | ||
runTest(); | ||
}); | ||
var downloadByURL = function(url, callback){ | ||
console.log("download from "+url); | ||
var stream = request.get(binUrl).pipe(fs.createWriteStream(binPath)); | ||
stream.on('close', function () { | ||
callback(); | ||
}); | ||
stream.on('error', callback); | ||
} | ||
var onComplete = function(err){ | ||
if(err){ | ||
return console.log("error: advpng cannot be installed, please check the binary path is available"); | ||
} | ||
try{ | ||
fs.chmod(binPath, '0755'); | ||
}catch(err){} | ||
runTest(); | ||
} | ||
downloadByURL(binUrl, function(err){ | ||
if(err){ | ||
binUrl = binUrl.replace("https://", "http://"); | ||
return dowuloadByURL(backUrl, onComplete); | ||
}else{ | ||
onComplete(); | ||
} | ||
}); | ||
} |
@@ -19,2 +19,3 @@ 'use strict'; | ||
execFile(binPath, ['-h'], function (err, stdout, stderr) { | ||
console.log(stdout.toString()); | ||
assert(stdout.toString().toLowerCase().indexOf('advancecomp') !== -1); | ||
@@ -21,0 +22,0 @@ cb(); |
472780
158