githulk
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -157,2 +157,28 @@ 'use strict'; | ||
/** | ||
* Get the long SHA of a specific commit for a given repo | ||
* | ||
* @param {String} project The project details. | ||
* @param {Object} options Optional options. | ||
* @param {function} fn The callback. | ||
* @returns {Assign} | ||
* @api public | ||
*/ | ||
Repository.prototype.commitSha = function commitSha(args) { | ||
args = this.api.args(arguments); | ||
var options = args.options = this.options(args.options); | ||
var project = this.api.project(args.str); | ||
return this.send( | ||
['repos', project.user, project.repo, 'commits', options.sha], | ||
args.options, | ||
function handler(err, data) { | ||
if (err) return args.fn(err); | ||
args.fn(null, data.length && data.length > 0 ? data[0]['sha'] : null); | ||
} | ||
); | ||
}; | ||
/** | ||
* Get the README contents of an project. | ||
@@ -159,0 +185,0 @@ * |
@@ -29,3 +29,3 @@ 'use strict'; | ||
mana.extend({ | ||
initialise: function initalise(options) { | ||
initialise: function initialise(options) { | ||
options = options || {}; | ||
@@ -32,0 +32,0 @@ |
{ | ||
"name": "githulk", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Small but powerful Github client", | ||
@@ -9,6 +9,3 @@ "main": "index.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github/3rd-Eden/githulk" | ||
}, | ||
"repository": "githulks/githulk", | ||
"keywords": [ | ||
@@ -15,0 +12,0 @@ "github", |
@@ -57,2 +57,16 @@ describe('githulk.repository', function () { | ||
describe('.commitSha', function () { | ||
it('get the LONG SHA for a specific commit', function (next) { | ||
githulk.repository.commitSha('twbs/bootstrap', { sha: 'f2e912b' }, function (err, longSha) { | ||
if (err) return next(err); | ||
assume(longSha).is.a('string'); | ||
assume(longSha).equals('f2e912bb0e5041fead48bdbcaaa23de1c40291d5'); | ||
next(); | ||
}); | ||
}); | ||
}); | ||
describe('.contents', function () { | ||
@@ -59,0 +73,0 @@ it('returns an error when getting files from an unknown repo', function (next) { |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
65027
2099
0
0