diff options
-rw-r--r-- | bugzilla.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/bugzilla.rb b/bugzilla.rb index 2171015..dec329e 100644 --- a/bugzilla.rb +++ b/bugzilla.rb @@ -35,16 +35,27 @@ rescue LoadError end -class BugzillaPlugin < Plugin +# Valid statuses +# 'DONE' and 'OPEN' are special cases that expand to the rest of the statuses in that array +DONE_STATUS = ['DONE','RESOLVED','VERIFIED','CLOSED'] +OPEN_STATUS = ['OPEN','UNCONFIRMED','NEW','ASSIGNED','REOPENED'] +VALID_RESO = ['FIXED', 'INVALID', 'WONTFIX', 'LATER', 'REMIND', 'DUPLICATE', 'WORKSFORME', 'CANTFIX', 'NEEDINFO', 'TEST-REQUEST', 'UPSTREAM'] + +# Each zilla instance may have these parameters +OPTIONS = [ 'name', 'baseurl', 'dataurl', 'showbugurl', 'reporturl' ] + +# Now life gets fun, these are regular expresses to check the above arrays +_STATUS_INPUT = (DONE_STATUS+OPEN_STATUS+['ALL']).uniq.join('|') +STATUS_INPUT_1 = /^(?:#{_STATUS_INPUT})$/ +STATUS_INPUT_N = /^(?:#{_STATUS_INPUT})(?:,(?:#{_STATUS_INPUT}))*$/ +_RESO_INPUT = (VALID_RESO+['ALL']).uniq.join('|') +RESO_INPUT_1 = /^(?:#{_RESO_INPUT})$/ +RESO_INPUT_N = /^(?:#{_RESO_INPUT})(?:,(?:#{_RESO_INPUT}))*$/ +_OPTIONS_INPUT = OPTIONS.join('|') +OPTIONS_INPUT_1 = /^(?:#{_OPTIONS_INPUT})$/ +OPTIONS_INPUT_N = /^(?:#{_OPTIONS_INPUT})(?:,(?:#{_OPTIONS_INPUT}))*$/ - # Valid statuses - # 'DONE' and 'OPEN' are special cases that expand to the rest of the statuses in that array - DONE_STATUS = ['DONE','RESOLVED','VERIFIED','CLOSED'] - OPEN_STATUS = ['OPEN','UNCONFIRMED','NEW','ASSIGNED','REOPENED'] - VALID_RESO = ['FIXED', 'INVALID', 'WONTFIX', 'LATER', 'REMIND', 'DUPLICATE', 'WORKSFORME', 'CANTFIX', 'NEEDINFO', 'TEST-REQUEST', 'UPSTREAM'] - - # Each zilla instance may have these parameters - OPTIONS = [ 'name', 'baseurl', 'dataurl', 'showbugurl', 'reporturl' ] +class BugzillaPlugin < Plugin # Exception class to raise when requesting information about an # unknown zilla instance. |