Created
August 14, 2015 17:32
-
-
Save AlexFrazer/32dc89758d71b60aa8ee to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env node --harmony | |
'use strict'; | |
require('shelljs/make'); | |
require('shelljs/global'); | |
let os = require('os'); | |
let path = require('path'); | |
let wget = require('./wget'); | |
target.all = function () { | |
console.log(`Building Application\n\tOS: ${os.platform()}\n\t${os.arch()}`); | |
target.setup(); | |
target.build(); | |
} | |
target.setup = function () { | |
console.log('====>\tDownloading dependencies'); | |
let dependencies = require('./dependencies')(); // generates the dependency array | |
let target = path.join(__dirname, 'target'); | |
mkdir(target); | |
cd(target); | |
Promise.each(dependencies, function (dep) { | |
return wget(dep); | |
}).catch(function (error) { | |
console.warn('ERROR': error); | |
exit(error.code); | |
}); | |
} |
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
let Promise = require('bluebird'); | |
let wget = require('wget-improved'); | |
let utils = require('./utilities'); | |
module.exports = function (dep) { | |
var deferred = Promise.pending(); | |
wget.download(dep.url, dep.filepath) | |
.on('end', function () { | |
utils.extract(dep.filepath); | |
deffered.resolve(); | |
}) | |
.on('error', deferred.reject) | |
.on('progress', function (progress) { | |
// add to my progress bar here | |
// this isn't a major concern right now | |
}); | |
return deferred; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment