This issue is now about making Bot Project more extensible. Redmine integration is handled in a sandbox discussed in the thread.

Original Post

this patch adds redmine support to bot_project

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mfb’s picture

FileSize
5.85 KB

Add some more metadata: project, status and number of comments

stBorchert’s picture

Wouldn't it be better to remove the hardcoded support for Trac (and Redmine) from bot_project and let other modules extend bot_project through hooks?
We'd love to see an integration with Redmine but we need communication over Redmines REST-API :)

mfb’s picture

I could reroll this patch as a new module if that's the direction that bot_project takes. This patch does use the REST API: GET /issues/[id].xml

stBorchert’s picture

Sorry, you are right.
I will try to create a patch within the next days that implements some hooks to extend bot_project (maybe hook_bot_project_info).
For redmine support it would be great if we have the option to enter the redmine API-key so the module can access private repositories.
Something like this:

<?php
  $options = array(
    'method' => 'GET',
    'data' => array(
      'key' => variable_get('bot_project_redmine:api_key', NULL),
    ),
  );
  $response = drupal_http_request($url, $options);
?>

And maybe we could save some traffic by using json instead of xml?
Many ideas :)

stBorchert’s picture

Ok, here's a patch that creates a single hook (hook_bot_project_info) and allows other modules to "inject" settings for different issue trackers.

Example module for redmine is attached (does nothing at the moment).

stBorchert’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Uhm, forgot to change version. My patch is against latest 7.x.

stBorchert’s picture

Btw., here's a working draft of my Redmine integration (based on the latest patch): http://drupal.org/sandbox/stborchert/1151786

Bevan’s picture

Awesome!

Bevan’s picture

Title: Add Redmine support to Bot Project » Make issue-tracking integration extensible (for Redmine)
Status: Needs review » Reviewed & tested by the community

I tested the patch with both project.module and bot_project_redmine. I found two bugs in bot_project_redmine. See #1153522: isset() not issues() & depend on bot_project not bot and #1153524: Settings are not relevant.

Those bugs do not affect this patch. The code style and architecture of this patch look fantastic. I could not test it with Trac, but otherwise I think I tested everything else. This is ready for maintainer review.

Bevan’s picture

I found a bug, possibly related to this patch; The bot can no longer join multiple channels. It only joins the first channel on the list in it's configuration. I did not debug it to find the cause.

stBorchert’s picture

Hm, can't confirm this. We run bot.module with this patch (and bot_project_redmine) on one channel. I've added a new channel to the list, hit "Save configuration" and about 5 minutes later the bot joined the second channel.

Grayside’s picture

There's some end of line whitespace in bot_project_api_scraper(), otherwise looks good.

Grayside’s picture

I've spent a good chunk of time in the last few days developing against this patch, both with the Bot project Redmine implementation and my new Bot GitHub project. I have to say this info hook/plugin system isn't bad, but doesn't go far enough as a helper system to justify ignoring existing IRC hooks and form_alter.

I still suggest this be committed, but with an understanding of follow-on enhancements. A few that have come to mind (and are varying degrees of implied by the two sandboxes linked above) include:

  • Standardized system of unique, configurable syntactic prefixes. E.g., I want drupal.org to use '$', Redmine to use '#' and so on.
  • Taking that a step farther, central management of regex matching, to preserve syntactic consistency. E.g., all project plugins have the same reaction to numbers embedded in words and user names.
  • Central management of a t()-style format string, to which the scraper function supplies token values. E.g. !title (Project: !project, Owner: !owner) !link, !seen.

I'll delve further into any of those depending on how this patch and maintainer interest goes...

One thing this patch could use is a refactoring of the hook_help implementation to be less project.module focused. There should be a "Project" help that explains the core functionality of what Bot Project enables, and perhaps a set of callbacks for each of the enabled providers. If I understand how it works, maybe "Bot: help Project:Redmine" should provide the more specific help alone?

I think this is also an enhancement that can probably wait for a separate issue, so I leave this as RTBC.

Corrected the whitespace I noted above and attached the reroll.

Morbus Iff’s picture

As an FYI, my current inclination toward this issue is:

* Return bot_project.module to JUST being a project.module handler.
* Remove Trac support entirely and move it to a separate module.
* Remove API.module support entirely and move it to bot_api.module.
* Let other contrib modules provide Redmine/Trac/Github/etc./etc. integration.

I don't necessarily think that providing API hooks for every known PM tool in existence is a good idea.

Grayside’s picture

Right. My preference would probably be to simplifying bot project, or turning bot_project into a high level multi-PM handling system that other modules can opt to use, and gain a few common things, such as the stuff I mentioned in #13. Then bot_trac can be separated out, as bot_redmine already is.

Dave Reid’s picture

I prefer keeping it simple with a solution like http://drupal.org/project/bot_url that can let other modules hook into how a response about an URL should be output.

Grayside’s picture

Solid direction, but it sidesteps the quick ref-by-number, which is where a good half the complexity is, for good or bad. (E.g., I'm always dropping #3151 and the like into IRC because I can avoid needing to copy-n-paste.)

Dave Reid’s picture

Yeah, I don't see people actually using ref-by-number as much as just links, which is why I started bot_url.

larowlan’s picture

This patch adds api key authentication for redmine, changes format to RM#### for straight numbers for point of difference to straight drupal nodes.

larowlan’s picture

Issue summary: View changes

Correcting issue description.