omnifocus-rt 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.autotest ADDED
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2009-12-22
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,6 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ lib/omnifocus/rt.rb
data/README.txt ADDED
@@ -0,0 +1,62 @@
1
+ = omnifocus_rt
2
+
3
+ * http://rubyforge.org/projects/seattlerb
4
+
5
+ == DESCRIPTION:
6
+
7
+ Plugin for omnifocus gem to provide rt BTS synchronization.
8
+
9
+ The first time this runs it creates a yaml file in your home directory
10
+ for the rt url, username, password, default queue and query.
11
+
12
+ The query is optional. If you don't supply it omnifocus-rt will pull all
13
+ tickets from the default queue assigned to the specified user.
14
+
15
+ The use a custom query you must supply it in the config file. omnifocus-rt
16
+ uses the REST interface to RT. More information about query formatting is
17
+ available here: http://wiki.bestpractical.com/view/REST
18
+
19
+ Example:
20
+ :rt_url: rt
21
+ :queue: QA
22
+ :username: user
23
+ :password: pass
24
+ :query: "Queue='QA'ANDOwner='Nobody'ANDStatus!='rejected'"
25
+
26
+
27
+ == FEATURES/PROBLEMS:
28
+
29
+ * Provides rt BTS synchronization.
30
+
31
+ == REQUIREMENTS:
32
+
33
+ * omnifocus
34
+
35
+ == INSTALL:
36
+
37
+ * sudo gem install omnifocus-rt
38
+
39
+ == LICENSE:
40
+
41
+ (The MIT License)
42
+
43
+ Copyright (c) 2009 Aja Hammerly
44
+
45
+ Permission is hereby granted, free of charge, to any person obtaining
46
+ a copy of this software and associated documentation files (the
47
+ 'Software'), to deal in the Software without restriction, including
48
+ without limitation the rights to use, copy, modify, merge, publish,
49
+ distribute, sublicense, and/or sell copies of the Software, and to
50
+ permit persons to whom the Software is furnished to do so, subject to
51
+ the following conditions:
52
+
53
+ The above copyright notice and this permission notice shall be
54
+ included in all copies or substantial portions of the Software.
55
+
56
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
57
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
59
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
60
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
61
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
62
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.spec 'omnifocus-rt' do
7
+ developer('aja', 'kushali@rubyforge.org')
8
+
9
+ self.rubyforge_name = 'seattlerb'
10
+ extra_deps << 'omnifocus'
11
+ end
12
+
13
+ # vim: syntax=ruby
@@ -0,0 +1,62 @@
1
+ require 'open-uri'
2
+
3
+ module OmniFocus::Rt
4
+ VERSION = '1.0.0'
5
+
6
+ def load_or_create_rt_config
7
+ path = File.expand_path "~/.omnifocus-rt.yml"
8
+ config = YAML.load(File.read(path)) rescue nil
9
+
10
+ unless config then
11
+ config = {
12
+ :username => "USERNAME",
13
+ :password => "PASSWORD",
14
+ :rt_url => "tickets.mysite.com",
15
+ :queue => "MyQueue"
16
+ }
17
+
18
+ File.open(path, "w") { |f|
19
+ YAML.dump(config, f)
20
+ }
21
+
22
+ abort "Created default config in #{path}. Go fill it out."
23
+ end
24
+
25
+ config
26
+ end
27
+
28
+ def populate_rt_tasks
29
+ config = load_or_create_rt_config
30
+ rt_url = config[:rt_url]
31
+ username = config[:username]
32
+ password = config[:password]
33
+ queue = config[:queue]
34
+ default_query = "Owner='#{username}'ANDqueue=#{queue}"
35
+ query = config[:query] || default_query
36
+
37
+ auth = "user=#{username}&pass=#{password}"
38
+ query_url = "http://#{rt_url}/REST/1.0/search/ticket?query=#{query}&#{auth}"
39
+
40
+ html = URI.parse(query_url).read
41
+ lines = html.split(/\n/)
42
+
43
+ lines.each do |line|
44
+ bug_number = line[/(\d+):(.*)/, 1]
45
+ next unless bug_number
46
+ ticket_id = "RT##{bug_number}"
47
+
48
+ if existing[ticket_id] then
49
+ project = existing[ticket_id]
50
+ bug_db[project][ticket_id] = true
51
+ else
52
+ url = "http://#{rt_url}/Ticket/Display.html?id=#{bug_number}"
53
+ title = $2
54
+ details_url = "http://#{rt_url}/REST/1.0/ticket/#{bug_number}/show?#{auth}"
55
+ details = URI.parse(details_url).read
56
+ project = details[/Queue: ([\w-]+)/, 1]
57
+
58
+ bug_db[project][ticket_id] = ["#{ticket_id}: #{title}", url]
59
+ end
60
+ end
61
+ end
62
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omnifocus-rt
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - aja
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-22 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: omnifocus
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.4.0
34
+ version:
35
+ description: "Plugin for omnifocus gem to provide rt BTS synchronization.\n\n\
36
+ The first time this runs it creates a yaml file in your home directory\n\
37
+ for the rt url, username, password, default queue and query.\n\n\
38
+ The query is optional. If you don't supply it omnifocus-rt will pull all\n\
39
+ tickets from the default queue assigned to the specified user.\n\n\
40
+ The use a custom query you must supply it in the config file. omnifocus-rt\n\
41
+ uses the REST interface to RT. More information about query formatting is\n\
42
+ available here: http://wiki.bestpractical.com/view/REST\n\n\
43
+ Example:\n\
44
+ :rt_url: rt\n\
45
+ :queue: QA\n\
46
+ :username: user\n\
47
+ :password: pass\n\
48
+ :query: \"Queue='QA'ANDOwner='Nobody'ANDStatus!='rejected'\""
49
+ email:
50
+ - kushali@rubyforge.org
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - History.txt
57
+ - Manifest.txt
58
+ - README.txt
59
+ files:
60
+ - .autotest
61
+ - History.txt
62
+ - Manifest.txt
63
+ - README.txt
64
+ - Rakefile
65
+ - lib/omnifocus/rt.rb
66
+ has_rdoc: true
67
+ homepage: http://rubyforge.org/projects/seattlerb
68
+ licenses: []
69
+
70
+ post_install_message:
71
+ rdoc_options:
72
+ - --main
73
+ - README.txt
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ requirements: []
89
+
90
+ rubyforge_project: seattlerb
91
+ rubygems_version: 1.3.5
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: Plugin for omnifocus gem to provide rt BTS synchronization
95
+ test_files: []
96
+