Closed Bug 415278 Opened 18 years ago Closed 18 years ago

Make the WebService's plugin discovery method more extendable

Categories

(Bugzilla :: WebService, enhancement)

3.1.2
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: mkanat, Assigned: cso)

Details

Attachments

(1 file, 4 obsolete files)

Right now we return information about plugins like this: (plugin_name => $version, plugin_name2 => $version2) But what if we want to return more info about a plugin in the future than just its version? We need to instead return things like this: plugin_name => { version => $version } That's much more extendable.
Flags: blocking3.2+
Will work on this shortly.
Assignee: webservice → colin.ogilvie
Status: NEW → ASSIGNED
Attached patch Patch v1 (obsolete) — Splinter Review
I've changed the extension file from version.pl to be info.pl which then returns a hash. Think I've tested everything as well. Will upload my test info.pl shortly.
Attachment #312520 - Flags: review?(mkanat)
Attached file info.pl (obsolete) —
Attachment #312521 - Flags: review?(mkanat)
Comment on attachment 312520 [details] [diff] [review] Patch v1 >+ $enabled{$extname} = do("$extension/info.pl"); You'll also have to fix the example plugin. >@@ -125,9 +125,11 @@ >+Every extension must have a file in its root called F<info.pl>. >+This file should return a hash when called with C<do>. >+The hash should contain a 'version' element with the current version of the >+extension. Plugin authors can also add any extra infomration to this has if >+required. We should specify this a bit more. We should define the fields that they must return (version), and specify that any other fields should start with x_, which is a namespace that we promise not to use for Bugzilla itself. > > =head1 SUBROUTINES > >Index: Bugzilla/WebService/Bugzilla.pm >+ $plugins->{$name} = $plugins->{$name}; That doesn't look to be doing anything. Remember that every field we know about should be explicitly typed, if possible. (That is, "version" should be made a type('string').)
Attachment #312520 - Flags: review?(mkanat) → review-
(In reply to comment #4) > (From update of attachment 312520 [details] [diff] [review]) > >+ $enabled{$extname} = do("$extension/info.pl"); > > You'll also have to fix the example plugin. That was the following file I added. > Remember that every field we know about should be explicitly typed, if > possible. (That is, "version" should be made a type('string').) How can you explicitly type something, if it's free-form -- we don't know whether an author will want to return a string for example or an integer?
(In reply to comment #5) > That was the following file I added. Yeah, but a patch that also removes version.pl would be good. > How can you explicitly type something, if it's free-form -- we don't know > whether an author will want to return a string for example or an integer? Just type the version field.
Attached patch Patch v2 (obsolete) — Splinter Review
Fixes mkanat's review comments... I have no idea how to remove a file or show a new file in a `cvs diff` though.
Attachment #312520 - Attachment is obsolete: true
Attachment #321390 - Flags: review?(mkanat)
(In reply to comment #7) > Fixes mkanat's review comments... I have no idea how to remove a file or show a > new file in a `cvs diff` though. You can use cvsdo for that, if you're in a checkout without checkin access.
Comment on attachment 321390 [details] [diff] [review] Patch v2 This is good, except I want to use the word "Extensions" instead of "Plugins" now, which means also changing the name of the function in the WebService.
Attachment #321390 - Flags: review?(mkanat) → review-
Attached patch Patch v3 (obsolete) — Splinter Review
Hmm, cvsdo is useful... Patch that changes various bits to Extensions rather than plugins.
Attachment #312521 - Attachment is obsolete: true
Attachment #321390 - Attachment is obsolete: true
Attachment #321441 - Flags: review?(mkanat)
Attachment #312521 - Flags: review?(mkanat)
Comment on attachment 321441 [details] [diff] [review] Patch v3 >+++ extensions/example/info.pl 17 May 2008 23:05:52 -0000 >+# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> You should add yourself. >+# This script does some code to return a version number. However, >+# most plugins will probably just want to return a raw string. >+# To do that, the only contents of the file should be the string >+# on a single line, like: >+# >+# '1.2.3'; That comment should be updated. >+no warnings qw(void); # Avoid "useless use of a constant in void context" I think that's not necessary anymore? >Index: Bugzilla/WebService/Bugzilla.pm > [snip] >+A hash with a single item, C<extesions>. This points to a hash. I<That> hash >+contains the names of extensions as keys, and information about the extension >+as values. That needs to be more specific--you need to say that the info hash contains a "version" key, however you can best get that across. >Index: contrib/bz_webservice_demo.pl >+If specified on the command line, the script returns the information about the >+extensions that are installed for the Webservices. It's just extensions that are installed, not 'for the Webservices.' Everything else looks good!
Attachment #321441 - Flags: review?(mkanat) → review-
Attached patch Patch v4Splinter Review
Hopefully this time...
Attachment #321441 - Attachment is obsolete: true
Attachment #321470 - Flags: review?(mkanat)
Comment on attachment 321470 [details] [diff] [review] Patch v4 Looks good!
Attachment #321470 - Flags: review?(mkanat) → review+
Asking for approval on trunk/3.2 as I'm not sure if it's branched yet... someone let me know before I check it in :)
Flags: approval?
Flags: approval3.2?
We didn't branch yet. So a+ for immediate checkin.
Flags: approval?
Flags: approval3.2?
Flags: approval+
Checking in Bugzilla/Hook.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Hook.pm,v <-- Hook.pm new revision: 1.14; previous revision: 1.13 done Checking in Bugzilla/WebService/Bugzilla.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/Bugzilla.pm,v <-- Bugzi lla.pm new revision: 1.7; previous revision: 1.6 done Checking in contrib/bz_webservice_demo.pl; /cvsroot/mozilla/webtools/bugzilla/contrib/bz_webservice_demo.pl,v <-- bz_webs ervice_demo.pl new revision: 1.14; previous revision: 1.13 done RCS file: /cvsroot/mozilla/webtools/bugzilla/extensions/example/info.pl,v done Checking in extensions/example/info.pl; /cvsroot/mozilla/webtools/bugzilla/extensions/example/info.pl,v <-- info.pl initial revision: 1.1 done Removing extensions/example/version.pl; /cvsroot/mozilla/webtools/bugzilla/extensions/example/version.pl,v <-- version .pl new revision: delete; previous revision: 1.1 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
test script: webservice_bugzilla.t
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: