diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2008-06-06 03:03:19 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2008-06-06 03:03:19 +0000 |
commit | c4c83045943a01c39a238e524c7eb98267e53b7f (patch) | |
tree | 1775c587f03cd9e1664267d066f55361c61e678d | |
parent | Use channel name not object for the defaults array. (diff) | |
download | rbot-bugzilla-c4c83045943a01c39a238e524c7eb98267e53b7f.tar.gz rbot-bugzilla-c4c83045943a01c39a238e524c7eb98267e53b7f.tar.bz2 rbot-bugzilla-c4c83045943a01c39a238e524c7eb98267e53b7f.zip |
Move global constants and add more for validation.
-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. |