Comparing version 0.1.3 to 0.1.4
var GitHub = require('node-github') | ||
, async = require('async') | ||
, github = new GitHub({ version: "3.0.0" }) | ||
@@ -22,3 +23,3 @@ , _ = require('underscore') | ||
if (hook && ! _(hook.events).deepEqual(config.events)) { | ||
if (hook && ! _(hook.events).isEqual(config.events)) { | ||
updateHook(hook, config, doneUpdatingHook) | ||
@@ -28,3 +29,3 @@ } else if (!hook) { | ||
} else { | ||
done(null, hook) | ||
doneUpdatingHook(null, hook) | ||
} | ||
@@ -67,3 +68,3 @@ }) | ||
github.getHooks({user: config.user, repo: config.repo}, function(err, hooks) { | ||
github.repos.getHooks({user: config.user, repo: config.repo}, function(err, hooks) { | ||
if (err) { cb(err) } | ||
@@ -70,0 +71,0 @@ else { cb(err, hooks.filter(isOurHook).pop()) } |
{ | ||
"name": "sync-hooks", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Function to install a batch of GitHub event hooks at once", | ||
@@ -22,3 +22,4 @@ "main": "index.js", | ||
"node-github": "0.0.3", | ||
"underscore": "~1.5.2" | ||
"underscore": "~1.5.2", | ||
"async": "~0.2.10" | ||
}, | ||
@@ -25,0 +26,0 @@ "repository": { |
@@ -32,5 +32,5 @@ var assert = require('assert') | ||
var config = {user: 'foo', repo: 'bar', url: 'http://foobar.com'} | ||
, oldGetHooks = syncHooks.github.getHooks | ||
, oldGetHooks = syncHooks.github.repos.getHooks | ||
syncHooks.github.getHooks = function(config, callback) { | ||
syncHooks.github.repos.getHooks = function(config, callback) { | ||
callback(null, mockhooks) | ||
@@ -41,6 +41,35 @@ } | ||
assert.deepEqual(hook, mockhooks[1]) | ||
syncHooks.github.getHooks = oldGetHooks | ||
syncHooks.github.repos.getHooks = oldGetHooks | ||
done() | ||
}) | ||
}) | ||
/* | ||
it("should not find hooks on a repo that is inaccessible", function (done) { | ||
var octopie = octoFactory(); | ||
octopie.add('fullscreeninc/bacon'); | ||
octopie._configureHooks(function (err, hooks) { | ||
assert.deepEqual(hooks, []) | ||
done(); | ||
}); | ||
}); | ||
it("should create our hook in response to not finding our hook", function (done) { | ||
var octopie = octoFactory(); | ||
octopie.add('ryancbarry/underscore'); | ||
octopie.on('issues', function () {}); | ||
octopie.on('pull_request', function () {}); | ||
octopie._configureHooks(function (err, hooks) { | ||
console.log('configured : hooks:\n', hooks); | ||
// assert.deepEqual(hooks, []) | ||
// var hook = hooks[0]; | ||
// assert(hook.config.url === 'http://google.com'); | ||
// assert(hook.name === 'web'); | ||
// assert.deepEqual(hook.events, ['issues', 'pull_request']); | ||
// assert(hook.config.content_type === 'json'); | ||
// assert(hook.config.insecure_ssl === '1'); | ||
done(); | ||
}); | ||
}); | ||
*/ | ||
}) |
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
8938
227
3
+ Addedasync@~0.2.10
+ Addedasync@0.2.10(transitive)