Support Multiple projects per channel #4

Merged
merged 6 commits into from Oct 20, 2011

Projects

None yet

2 participants

@throughnothing

This adds support for multiple projects per channel. For now, the first channel is the primary/default.

I've moved !setgithubproject -> !setgithubprojects and added !addgithubproject <channel> <project> as well as !deletegithubproject <channel> <project>.

For auth, I've added !setauthforproject <project> <auth> (not sure if this should have 'github' somewhere in the command name?), as well as !setdefaultauth <auth> which will set a global auth default for anything without a specific auth set (very useful for me as I add many projects but all can use the same auth).

To facilitate multiple repos with issues/prs, i've updated EasyLinks.pm to use the following:

If you just type issue 42 you will get the issue for the default project (the first one added to that channel). If there are other projects, you can do api issue 42 and it will search through all your projects for the first one that matches 'api' and use that one. If none are found to match, it reverts back to the default again. The same happens with !pr. This makes it so that with !pr you don't have to type the full project name.

I've also made !pr support authenticated requests using the same auth_for_project and auth_default parameters as everything else. This does replace the LWP::Simple requirement with LWP::UserAgent (updated in the makefile).

I'd love some comments and feedback. Thanks!

@bigpresh bigpresh merged commit c0fec2b into bigpresh:master Oct 20, 2011
@bigpresh
Owner

Excellent stuff - merged!

I'll look in to making use of GitHub's new hooks very soon, hopefully this afternoon.

I should be able to rip out most of Announce (all the polling crap), and add some code to automatically determine the external IP/hostname of the machine we're on, pick an ephemeral port at random and fire up a listener on it, then poke GitHub's new web hooks API to arrange for web hooks to hit us with those details; or, perhaps, require a specific port to be configured, so it can be allowed through the firewall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment