Permalink
Browse files

fail build task if http requests are not successful

  • Loading branch information...
1 parent 69e1baf commit f6ec88106496d3193623dae242ce93c8cff21717 @tkellen tkellen committed Oct 15, 2013
Showing with 14 additions and 9 deletions.
  1. +14 −9 Gruntfile.js
View
@@ -22,22 +22,27 @@ module.exports = function(grunt) {
// make http request for author file in a repo
var authorFile = function (dep) {
var deferred = when.defer();
- request.get({
- url: baseurl+dep+'/master/AUTHORS'
- }, function(err, res, body) {
- deferred.resolve(body.split('\n'));
+ var url = baseurl+dep+'/master/AUTHORS';
+ request.get({url: url}, function(err, res, body) {
+ if (res.statusCode != 200) {
+ grunt.fail.fatal('Failed to retrieve '+url);
+ } else {
+ deferred.resolve(body.split('\n'));
+ }
});
return deferred.promise
};
// make http request for package.json in a repo
var packageJSON = function (dep) {
var deferred = when.defer();
- request.get({
- url: baseurl+dep+'/master/package.json',
- json: true
- }, function(err, res, body) {
- deferred.resolve(body);
+ var url = baseurl+dep+'/master/package.json';
+ request.get({url: url, json: true}, function(err, res, body) {
+ if (res.statusCode != 200) {
+ grunt.fail.fatal('Failed to retrieve '+url);
+ } else {
+ deferred.resolve(body);
+ }
});
return deferred.promise
};

0 comments on commit f6ec881

Please sign in to comment.