Comparing version 0.1.3 to 0.1.5
{ | ||
"name": "grunt-ccb", | ||
"version": "0.1.3", | ||
"version": "0.1.5", | ||
"description": "Create a CCB with manfiest information in JIRA", | ||
@@ -5,0 +5,0 @@ "main": "Gruntfile.js", |
@@ -18,20 +18,25 @@ 'use string'; | ||
var createCcbContents = function(){ | ||
return { | ||
fields: { | ||
project: { | ||
id: options.jira.project_id | ||
}, | ||
summary: util.format('Deploying %s %s to production', options.project.name, options.build_number), | ||
issuetype: { | ||
id: options.jira.ccb_issue_type | ||
}, | ||
customfield_11502: grunt.template.today("isoDateTime"), | ||
customfield_11505: 'Commit log:\n\n' + grunt.file.read(options.manifest) | ||
} | ||
}; | ||
try | ||
{ | ||
return { | ||
fields: { | ||
project: { | ||
id: options.jira.project_id | ||
}, | ||
summary: util.format('Deploying %s %s to production', options.project.name, options.build_number), | ||
issuetype: { | ||
id: options.jira.ccb_issue_type | ||
}, | ||
customfield_11502: grunt.template.today("isoDateTime"), | ||
customfield_11505: 'Commit log:\n\n' + grunt.file.read(options.manifest) | ||
} | ||
}; | ||
} | ||
catch(err){ | ||
grunt.fail(err); | ||
} | ||
}; | ||
var createCbb = function(){ | ||
grunt.verbose.writeln("Creating CCB"); | ||
@@ -41,2 +46,4 @@ var ccbContents = createCcbContents(), | ||
grunt.verbose.writeln(JSON.stringify(ccbContents)); | ||
request({ | ||
@@ -56,10 +63,11 @@ url: options.jira.api_url + "issue/", | ||
}, function(error, response, body){ | ||
if (response.statusCode >= 300 || error){ | ||
if (error) { | ||
deferred.reject(error); | ||
} | ||
else{ | ||
else if (response.statusCode >= 300 ) { | ||
deferred.reject("Bad response: " + response); | ||
} | ||
else { | ||
var ccbId = body.id; | ||
grunt.log.writeln('CCB ID is: ' + ccbId); | ||
deferred.resolve(ccbId); | ||
@@ -73,2 +81,3 @@ } | ||
var updateCcbToInDevelopmentState = function(ccbId){ | ||
grunt.verbose.writeln("Updating CCB to 'In development' state"); | ||
@@ -95,7 +104,9 @@ var deferred = q.defer(); | ||
}, function(error, response, body){ | ||
if (error){ | ||
if (error) { | ||
deferred.reject(error); | ||
} | ||
else{ | ||
else if (response.statusCode >= 300 ) { | ||
deferred.reject("Bad response: " + response); | ||
} | ||
else { | ||
deferred.resolve(ccbId); | ||
@@ -106,6 +117,6 @@ } | ||
return deferred.promise; | ||
}; | ||
var closeCcb = function(ccbId){ | ||
grunt.verbose.writeln("Updating CCB to 'Closed' state"); | ||
@@ -132,7 +143,9 @@ var deferred = q.defer(); | ||
}, function(error, response, body){ | ||
if (error){ | ||
if (error) { | ||
deferred.reject(error); | ||
} | ||
else{ | ||
else if (response.statusCode >= 300 ) { | ||
deferred.reject("Bad response: " + response); | ||
} | ||
else { | ||
deferred.resolve(); | ||
@@ -147,10 +160,17 @@ } | ||
createCbb() | ||
.then(updateCcbToInDevelopmentState) | ||
.then(closeCcb) | ||
.then(function(ccbId){ | ||
return updateCcbToInDevelopmentState(ccbId); | ||
}) | ||
.then(function(ccbId){ | ||
return closeCcb(ccbId); | ||
}) | ||
.catch(function(error){ | ||
grunt.fatal.fail(error); | ||
grunt.fatal(error); | ||
}) | ||
.done(done); | ||
.done(function(){ | ||
grunt.verbose.writeln("Done!"); | ||
done(); | ||
}); | ||
}); | ||
}; |
@@ -1,1 +0,1 @@ | ||
{"headers":{"content-type":"application/json","accept":"application/json","host":"localhost:8888","authorization":"Basic dXNlcjpwYXNzd29yZA==","content-length":"236","connection":"keep-alive"},"url":"/issue/","body":{"fields":{"project":{"id":"4321"},"summary":"Deploying projectname grunt-ccb_1234 to production","issuetype":{"id":20},"customfield_11502":"2014-05-09T11:46:02","customfield_11505":"Commit log:\n\n{\n \"example\": \"manifest\"\n}"}}} | ||
{"headers":{"content-type":"application/json","accept":"application/json","host":"localhost:8888","authorization":"Basic dXNlcjpwYXNzd29yZA==","content-length":"236","connection":"keep-alive"},"url":"/issue/","body":{"fields":{"project":{"id":"4321"},"summary":"Deploying projectname grunt-ccb_1234 to production","issuetype":{"id":20},"customfield_11502":"2014-05-12T11:39:08","customfield_11505":"Commit log:\n\n{\n \"example\": \"manifest\"\n}"}}} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17786
295