omnifocus-github 1.3.0 → 1.4.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.
- data.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/README.txt +29 -0
- data/lib/omnifocus/github.rb +45 -17
- metadata +17 -17
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -7,6 +7,35 @@ rdoc :: http://seattlerb.rubyforge.org/omnifocus-github
|
|
7
7
|
|
8
8
|
Plugin for omnifocus gem to provide github BTS synchronization.
|
9
9
|
|
10
|
+
Support for Github Enterprise:
|
11
|
+
|
12
|
+
In your git config, set the key omnifocus-github.accounts to a space
|
13
|
+
separated list of github accounts.
|
14
|
+
|
15
|
+
git config --global omnifocus-github.accounts "github myghe"
|
16
|
+
|
17
|
+
For each account API end point and authentication information are
|
18
|
+
should be stored in the git config under a key matching the
|
19
|
+
account. For example:
|
20
|
+
|
21
|
+
git config --global github.user me
|
22
|
+
git config --global github.password mypassword
|
23
|
+
git config --global myghe.api https://ghe.mydomain.com/api/v3
|
24
|
+
git config --global myghe.token 1a2b3c4d5e6f7e8d
|
25
|
+
|
26
|
+
For each account can you specify the following parameters:
|
27
|
+
|
28
|
+
* api - specify an API endpoint other than
|
29
|
+
https://api.github.com. This is so you can point this at your Github
|
30
|
+
Enterprise endpoint.
|
31
|
+
|
32
|
+
* user, password - A username and password pair for Basic http authentication.
|
33
|
+
|
34
|
+
* token - An OAuth bearer token for OAuth workflows.
|
35
|
+
|
36
|
+
If both a token and a username and password are supplied, the token
|
37
|
+
is used.
|
38
|
+
|
10
39
|
== FEATURES/PROBLEMS:
|
11
40
|
|
12
41
|
* Provides github BTS synchronization.
|
data/lib/omnifocus/github.rb
CHANGED
@@ -2,27 +2,53 @@ require 'open-uri'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module OmniFocus::Github
|
5
|
-
VERSION = '1.
|
5
|
+
VERSION = '1.4.0'
|
6
6
|
PREFIX = "GH"
|
7
7
|
|
8
|
-
|
9
|
-
# curl -i -u "#{user}:#{pass}" "https://api.github.com/issues?page=1"
|
10
|
-
|
11
|
-
user = `git config --global github.user`.chomp
|
12
|
-
pass = `git config --global github.password`.chomp
|
8
|
+
GH_API_DEFAULT = "https://api.github.com"
|
13
9
|
|
14
|
-
|
10
|
+
def populate_github_tasks
|
11
|
+
omnifocus_git_param(:accounts, "github").split(/\s+/).each do |account|
|
12
|
+
api = omnifocus_git_param(:api, GH_API_DEFAULT, account)
|
13
|
+
# Either token or user + password is required. If both
|
14
|
+
# are present, token is used.
|
15
|
+
auth = {
|
16
|
+
:user => omnifocus_git_param(:user, nil, account),
|
17
|
+
:password => omnifocus_git_param(:password, nil, account),
|
18
|
+
:token => omnifocus_git_param(:token, nil, account),
|
19
|
+
}
|
20
|
+
unless auth[:token] || (auth[:user] && auth[:password])
|
21
|
+
warn "Missing authentication parameters for account #{account}."
|
22
|
+
next
|
23
|
+
end
|
15
24
|
|
16
|
-
|
25
|
+
# process will omit the account label if nil.
|
26
|
+
# Supply nil for the default "github" account for compatibility
|
27
|
+
# with previous versions.
|
28
|
+
account_label = account == "github" ? nil : account
|
17
29
|
|
18
|
-
|
19
|
-
process
|
30
|
+
body = fetch(api, auth, 1)
|
31
|
+
process(account_label, body)
|
32
|
+
(2..get_last(body)).each do |page|
|
33
|
+
process(account_label, fetch(api, auth, page))
|
34
|
+
end
|
20
35
|
end
|
21
36
|
end
|
22
37
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
38
|
+
def omnifocus_git_param name, default = nil, prefix = "omnifocus-github"
|
39
|
+
param = `git config --global #{prefix}.#{name}`.chomp
|
40
|
+
param.empty? ? default : param
|
41
|
+
end
|
42
|
+
|
43
|
+
def fetch api, auth, page
|
44
|
+
uri = URI.parse "#{api}/issues?page=#{page}"
|
45
|
+
if auth[:token]
|
46
|
+
uri.read "Authorization" => "token #{auth[:token]}"
|
47
|
+
elsif auth[:user] && auth[:password]
|
48
|
+
uri.read :http_basic_authentication => [auth[:user], auth[:password]]
|
49
|
+
else
|
50
|
+
raise ArgumentError, "Missing authentication"
|
51
|
+
end
|
26
52
|
end
|
27
53
|
|
28
54
|
def get_last body
|
@@ -30,20 +56,22 @@ module OmniFocus::Github
|
|
30
56
|
link and link[/page=(\d+).. rel=.last/, 1].to_i or 0
|
31
57
|
end
|
32
58
|
|
33
|
-
def process body
|
59
|
+
def process account, body
|
34
60
|
JSON.parse(body).each do |issue|
|
61
|
+
pr = issue["pull_request"] && !issue["pull_request"]["diff_url"].nil?
|
35
62
|
number = issue["number"]
|
36
63
|
url = issue["html_url"]
|
37
|
-
project = url.split(/\//)[-3]
|
64
|
+
project = [account, url.split(/\//)[-3]].compact.join("-")
|
38
65
|
ticket_id = "#{PREFIX}-#{project}##{number}"
|
39
|
-
title = "#{ticket_id}: #{issue["title"]}"
|
66
|
+
title = "#{ticket_id}: #{pr ? "[PR] " : ""}#{issue["title"]}"
|
67
|
+
note = "#{url}\n\n#{issue["body"]}"
|
40
68
|
|
41
69
|
if existing[ticket_id] then
|
42
70
|
bug_db[existing[ticket_id]][ticket_id] = true
|
43
71
|
next
|
44
72
|
end
|
45
73
|
|
46
|
-
bug_db[project][ticket_id] = [title,
|
74
|
+
bug_db[project][ticket_id] = [title, note]
|
47
75
|
end
|
48
76
|
end
|
49
77
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnifocus-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date:
|
39
|
+
date: 2012-11-23 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: omnifocus
|
@@ -70,22 +70,22 @@ dependencies:
|
|
70
70
|
type: :runtime
|
71
71
|
version_requirements: *id002
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
73
|
+
name: minitest
|
74
74
|
prerelease: false
|
75
75
|
requirement: &id003 !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
77
77
|
requirements:
|
78
78
|
- - ~>
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
hash:
|
80
|
+
hash: 29
|
81
81
|
segments:
|
82
|
+
- 4
|
82
83
|
- 3
|
83
|
-
|
84
|
-
version: "3.9"
|
84
|
+
version: "4.3"
|
85
85
|
type: :development
|
86
86
|
version_requirements: *id003
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
|
-
name:
|
88
|
+
name: rdoc
|
89
89
|
prerelease: false
|
90
90
|
requirement: &id004 !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
@@ -94,9 +94,9 @@ dependencies:
|
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
hash: 19
|
96
96
|
segments:
|
97
|
-
-
|
98
|
-
-
|
99
|
-
version: "
|
97
|
+
- 3
|
98
|
+
- 10
|
99
|
+
version: "3.10"
|
100
100
|
type: :development
|
101
101
|
version_requirements: *id004
|
102
102
|
- !ruby/object:Gem::Dependency
|
@@ -107,11 +107,11 @@ dependencies:
|
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
hash:
|
110
|
+
hash: 1
|
111
111
|
segments:
|
112
|
-
-
|
113
|
-
-
|
114
|
-
version: "
|
112
|
+
- 3
|
113
|
+
- 3
|
114
|
+
version: "3.3"
|
115
115
|
type: :development
|
116
116
|
version_requirements: *id005
|
117
117
|
description: Plugin for omnifocus gem to provide github BTS synchronization.
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
requirements: []
|
163
163
|
|
164
164
|
rubyforge_project: seattlerb
|
165
|
-
rubygems_version: 1.8.
|
165
|
+
rubygems_version: 1.8.24
|
166
166
|
signing_key:
|
167
167
|
specification_version: 3
|
168
168
|
summary: Plugin for omnifocus gem to provide github BTS synchronization.
|
metadata.gz.sig
CHANGED
Binary file
|