omnifocus-redmine 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.txt +19 -7
- data/lib/omnifocus/redmine.rb +24 -8
- metadata +35 -17
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -6,21 +6,33 @@
|
|
6
6
|
|
7
7
|
Plugin for the omnifocus gem to provide synchronization with Redmine Issues.
|
8
8
|
|
9
|
+
This plugin uses the Redmine REST API. It must be enabled by an administrator
|
10
|
+
for the plugin to work.
|
11
|
+
|
9
12
|
The first time this runs it creates a yaml file in your home directory for
|
10
|
-
the
|
13
|
+
the configuration data.
|
14
|
+
|
15
|
+
* redmine_url is required. This is the base url for the redmine repository.
|
16
|
+
|
17
|
+
* user_id is required. To find your user id login and go to the my account
|
18
|
+
page. Your user_id is the number at the end of the url for my account.
|
11
19
|
|
12
|
-
|
13
|
-
|
20
|
+
* username is optional. It is used if the redmine server requires
|
21
|
+
authentication.
|
14
22
|
|
15
|
-
|
16
|
-
|
23
|
+
* password is optional. It is used if the redmine server requires
|
24
|
+
authentication.
|
17
25
|
|
18
|
-
|
19
|
-
|
26
|
+
* queries is optional. It is used for custom queries or multiple queries.
|
27
|
+
The queries config is an array of strings. The strings will be appended
|
28
|
+
to a query of the form:
|
29
|
+
"http://redmine_url/issues.xml?assigned_to_id=user_id".
|
20
30
|
|
21
31
|
Example:
|
22
32
|
:user_id: 20
|
23
33
|
:redmine_url: http://redmine/
|
34
|
+
:username: me
|
35
|
+
:password: 1234
|
24
36
|
:queries: ["status_id=1", "status_id=2"]
|
25
37
|
|
26
38
|
== FEATURES/PROBLEMS:
|
data/lib/omnifocus/redmine.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module OmniFocus::Redmine
|
2
|
-
VERSION = '1.
|
2
|
+
VERSION = '1.2.0'
|
3
3
|
|
4
4
|
def load_or_create_redmine_config
|
5
5
|
path = File.expand_path "~/.omnifocus-redmine.yml"
|
@@ -7,8 +7,10 @@ module OmniFocus::Redmine
|
|
7
7
|
|
8
8
|
unless config then
|
9
9
|
config = {
|
10
|
-
:
|
10
|
+
:user_id => "20",
|
11
11
|
:redmine_url => "http://redmine",
|
12
|
+
:username => "UserName",
|
13
|
+
:password => "Password"
|
12
14
|
}
|
13
15
|
|
14
16
|
File.open(path, "w") { |f|
|
@@ -24,22 +26,36 @@ module OmniFocus::Redmine
|
|
24
26
|
def populate_redmine_tasks
|
25
27
|
config = load_or_create_redmine_config
|
26
28
|
redmine_url = config[:redmine_url]
|
27
|
-
user_id
|
29
|
+
user_id = config[:user_id]
|
30
|
+
username = config[:username]
|
31
|
+
password = config[:password]
|
32
|
+
|
33
|
+
# Authenticate if the user name and password are defined
|
34
|
+
if username and password then
|
35
|
+
mechanize.basic_auth(username, password)
|
36
|
+
end
|
37
|
+
|
28
38
|
default_query = "#{redmine_url}/issues.xml?assigned_to_id=#{user_id}"
|
29
39
|
|
30
40
|
unless config[:queries]
|
31
|
-
process_query_results
|
41
|
+
process_query_results(default_query, redmine_url)
|
32
42
|
else
|
33
43
|
queries = config[:queries]
|
34
44
|
queries.each do |q|
|
35
|
-
process_query_results
|
45
|
+
process_query_results("#{default_query}&#{q}", redmine_url)
|
36
46
|
end
|
37
47
|
end
|
38
48
|
end
|
39
49
|
|
40
|
-
def process_query_results(query)
|
41
|
-
|
42
|
-
|
50
|
+
def process_query_results(query, redmine_url)
|
51
|
+
begin
|
52
|
+
mechanize.get(query)
|
53
|
+
rescue Mechanize::ResponseCodeError => e
|
54
|
+
if e.response_code == "401" then
|
55
|
+
abort "Unauthorized. Check username and password in .omnifocus-redmine"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
43
59
|
details = Nokogiri.parse(mechanize.current_page.body)
|
44
60
|
|
45
61
|
issues = details.root.xpath('//issue')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnifocus-redmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- aja
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-15 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -64,19 +64,37 @@ dependencies:
|
|
64
64
|
version: 2.8.0
|
65
65
|
type: :development
|
66
66
|
version_requirements: *id003
|
67
|
-
description:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
in your
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
67
|
+
description: |-
|
68
|
+
Plugin for the omnifocus gem to provide synchronization with Redmine Issues.
|
69
|
+
|
70
|
+
This plugin uses the Redmine REST API. It must be enabled by an administrator
|
71
|
+
for the plugin to work.
|
72
|
+
|
73
|
+
The first time this runs it creates a yaml file in your home directory for
|
74
|
+
the configuration data.
|
75
|
+
|
76
|
+
* redmine_url is required. This is the base url for the redmine repository.
|
77
|
+
|
78
|
+
* user_id is required. To find your user id login and go to the my account
|
79
|
+
page. Your user_id is the number at the end of the url for my account.
|
80
|
+
|
81
|
+
* username is optional. It is used if the redmine server requires
|
82
|
+
authentication.
|
83
|
+
|
84
|
+
* password is optional. It is used if the redmine server requires
|
85
|
+
authentication.
|
86
|
+
|
87
|
+
* queries is optional. It is used for custom queries or multiple queries.
|
88
|
+
The queries config is an array of strings. The strings will be appended
|
89
|
+
to a query of the form:
|
90
|
+
"http://redmine_url/issues.xml?assigned_to_id=user_id".
|
91
|
+
|
92
|
+
Example:
|
93
|
+
:user_id: 20
|
94
|
+
:redmine_url: http://redmine/
|
95
|
+
:username: me
|
96
|
+
:password: 1234
|
97
|
+
:queries: ["status_id=1", "status_id=2"]
|
80
98
|
email:
|
81
99
|
- kushali@rubyforge.org
|
82
100
|
executables: []
|