omnifocus-bugzilla 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/History.txt +4 -0
  2. data/README.txt +17 -1
  3. data/lib/omnifocus/bugzilla.rb +17 -3
  4. metadata +17 -7
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.1.0 / 2009-09-29
2
+
3
+ * Added support for multiple bugzilla queries on the same bugzilla server.
4
+
1
5
  === 1.0.0 / 2009-08-04
2
6
 
3
7
  * 1 major enhancement
data/README.txt CHANGED
@@ -7,7 +7,23 @@
7
7
  Plugin for omnifocus gem to provide bugzilla BTS synchronization.
8
8
 
9
9
  The first time this runs it creates a yaml file in your home directory
10
- for the bugzilla url and username.
10
+ for the bugzilla url, username, and queries.
11
+
12
+ The queries config is optional. If it is not included bugzilla-omnifocus will
13
+ pull all active bugs assigned to the specified user.
14
+
15
+ To use a custom query or multiple queries you must include a queries parameter
16
+ in your config.
17
+
18
+ The queries config is an array of strings. Each string is the query string
19
+ portion of the bugzilla search results url. Its easiest to create your search
20
+ in bugzilla and then paste the portion of the url after the question mark into
21
+ the config file.
22
+
23
+ Example:
24
+ :bugzilla_url: http://bugs/buglist.cgi
25
+ :username: aja
26
+ :queries: ["bug_status=NEW", "bug_status=CLOSED"]
11
27
 
12
28
  == FEATURES/PROBLEMS:
13
29
 
@@ -1,5 +1,5 @@
1
1
  module OmniFocus::Bugzilla
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
 
4
4
  def load_or_create_config
5
5
  path = File.expand_path "~/.omnifocus-bugzilla.yml"
@@ -25,10 +25,24 @@ module OmniFocus::Bugzilla
25
25
  config = load_or_create_config
26
26
  bugzilla_url = config[:bugzilla_url]
27
27
  username = config[:username]
28
+ default_query = "bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=#{username}"
28
29
 
29
- results = mechanize.get "#{bugzilla_url}?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=#{username}"
30
+ unless config[:queries]
31
+ process_query_results(bugzilla_url, default_query)
32
+ else
33
+ queries = config[:queries]
34
+ queries.each do |q|
35
+ process_query_results(bugzilla_url, q)
36
+ end
37
+ end
38
+
39
+ end
40
+
41
+ def process_query_results(bugzilla_url, query)
42
+ results = mechanize.get "#{bugzilla_url}?#{query}"
30
43
 
31
44
  bugs = results.root.xpath "//table[@class='bz_buglist']/tr[td]"
45
+
32
46
  bugs.each do |bug|
33
47
  bug_number = $1 if bug.inner_html =~ /show_bug.cgi\?id=(\d*)/
34
48
  ticket_id = "BZ##{bug_number}"
@@ -38,7 +52,6 @@ module OmniFocus::Bugzilla
38
52
  bug_db[project][ticket_id] = true
39
53
  else
40
54
  url = "http://bugs/show_bug.cgi?id=#{bug_number}"
41
- warn "url #{url}"
42
55
  details = Nokogiri.parse(mechanize.get("#{url}&ctype=xml").body)
43
56
  product = details.root.xpath('//product/text()').text.downcase
44
57
  title = details.root.xpath('//short_desc/text()').text
@@ -49,4 +62,5 @@ module OmniFocus::Bugzilla
49
62
  end
50
63
  end
51
64
  end
65
+
52
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnifocus-bugzilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aja
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-04 00:00:00 -07:00
12
+ date: 2009-09-29 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,11 +32,21 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.3.2
34
34
  version:
35
- description: |-
36
- Plugin for omnifocus gem to provide bugzilla BTS synchronization.
37
-
38
- The first time this runs it creates a yaml file in your home directory
39
- for the bugzilla url and username.
35
+ description: "Plugin for omnifocus gem to provide bugzilla BTS synchronization.\n\n\
36
+ The first time this runs it creates a yaml file in your home directory\n\
37
+ for the bugzilla url, username, and queries.\n\n\
38
+ The queries config is optional. If it is not included bugzilla-omnifocus will\n\
39
+ pull all active bugs assigned to the specified user.\n\n\
40
+ To use a custom query or multiple queries you must include a queries parameter\n\
41
+ in your config.\n\n\
42
+ The queries config is an array of strings. Each string is the query string\n\
43
+ portion of the bugzilla search results url. Its easiest to create your search\n\
44
+ in bugzilla and then paste the portion of the url after the question mark into\n\
45
+ the config file.\n\n\
46
+ Example:\n\
47
+ :bugzilla_url: http://bugs/buglist.cgi\n\
48
+ :username: aja\n\
49
+ :queries: [\"bug_status=NEW\", \"bug_status=CLOSED\"]"
40
50
  email:
41
51
  - kushali@rubyforge.org
42
52
  executables: []