omnifocus-github 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
+ === 1.6.0 / 2013-07-24
2
+
3
+ * 2 major enhancements:
4
+
5
+ * Removed support for token authentication
6
+ * Use Octokit to access github.
7
+
8
+ * 1 minor enhancement:
9
+
10
+ * Updated dependency to omnifocus 2.x
11
+
1
12
  === 1.5.0 / 2013-05-10
2
13
 
3
14
  * 1 major enhancement:
data/README.txt CHANGED
@@ -14,14 +14,14 @@ separated list of github accounts.
14
14
 
15
15
  git config --global omnifocus-github.accounts "github myghe"
16
16
 
17
- For each account API end point and authentication information are
17
+ For each account API and web end points and authentication information
18
18
  should be stored in the git config under a key matching the
19
19
  account. For example:
20
20
 
21
21
  git config --global github.user me
22
22
  git config --global github.password mypassword
23
23
  git config --global myghe.api https://ghe.mydomain.com/api/v3
24
- git config --global myghe.token 1a2b3c4d5e6f7e8d
24
+ git config --global myghe.api https://ghe.mydomain.com/
25
25
 
26
26
  For each account can you specify the following parameters:
27
27
 
@@ -29,12 +29,10 @@ For each account can you specify the following parameters:
29
29
  https://api.github.com. This is so you can point this at your Github
30
30
  Enterprise endpoint.
31
31
 
32
- * user, password - A username and password pair for Basic http authentication.
33
-
34
- * token - An OAuth bearer token for OAuth workflows.
32
+ * web - specify an API endpoint other than https://www.github.com. This
33
+ is so you can point this at your Github Enterprise endpoint
35
34
 
36
- If both a token and a username and password are supplied, the token
37
- is used.
35
+ * user, password - A username and password pair for Basic http authentication.
38
36
 
39
37
  == FEATURES/PROBLEMS:
40
38
 
@@ -43,6 +41,7 @@ is used.
43
41
  == REQUIREMENTS:
44
42
 
45
43
  * omnifocus
44
+ * octokit
46
45
  * ~/.gitrc must have github username defined
47
46
 
48
47
  == INSTALL:
data/Rakefile CHANGED
@@ -8,8 +8,9 @@ Hoe.plugin :seattlerb
8
8
  Hoe.spec 'omnifocus-github' do
9
9
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
10
10
 
11
- dependency "omnifocus", "~> 1.4"
12
- dependency "json", "~> 1.5"
11
+ dependency "omnifocus", "~> 2.0"
12
+ dependency "octokit", "~> 1.24"
13
+ dependency "system-timer", "~> 1.2" # bug in octokit's deps
13
14
 
14
15
  self.rubyforge_name = 'seattlerb'
15
16
  end
@@ -1,36 +1,28 @@
1
- require 'open-uri'
2
- require 'json'
1
+ require 'octokit'
3
2
 
4
3
  module OmniFocus::Github
5
- VERSION = "1.5.0"
4
+ VERSION = "1.6.0"
6
5
  PREFIX = "GH"
7
6
 
8
- GH_API_DEFAULT = "https://api.github.com"
9
-
10
7
  def populate_github_tasks
11
8
  omnifocus_git_param(:accounts, "github").split(/\s+/).each do |account|
12
- api = omnifocus_git_param(:api, GH_API_DEFAULT, account)
9
+ endpoints = {}
10
+ endpoints[:api] = omnifocus_git_param(:api, nil, account)
11
+ endpoints[:web] = omnifocus_git_param(:web, nil, account)
12
+
13
13
  # User + password is required
14
14
  auth = {
15
15
  :user => omnifocus_git_param(:user, nil, account),
16
16
  :password => omnifocus_git_param(:password, nil, account),
17
- :token => omnifocus_git_param(:token, nil, account),
18
17
  }
19
18
  unless (auth[:user] && auth[:password])
20
19
  warn "Missing authentication parameters for account #{account}."
21
20
  next
22
21
  end
23
22
 
24
- # process will omit the account label if nil.
25
- # Supply nil for the default "github" account for compatibility
26
- # with previous versions.
27
23
  account_label = account == "github" ? nil : account
28
24
 
29
- body = fetch(api, auth, 1)
30
- process(account_label, body)
31
- (2..get_last(body)).each do |page|
32
- process(account_label, fetch(api, auth, page))
33
- end
25
+ process(account_label, gh_client(account, auth, endpoints))
34
26
  end
35
27
  end
36
28
 
@@ -39,29 +31,31 @@ module OmniFocus::Github
39
31
  param.empty? ? default : param
40
32
  end
41
33
 
42
- def fetch api, auth, page
43
- uri = URI.parse "#{api}/issues?page=#{page}"
44
-
45
- headers = {
46
- "User-Agent"=>"omnifocus-github/#{VERSION}"
47
- }
34
+ def gh_client account, auth, endpoints
35
+ if account != "github"
36
+ if endpoints[:api] && endpoints[:web]
37
+ Octokit.configure do |c|
38
+ c.api_endpoint = endpoints[:api]
39
+ c.web_endpoint = endpoints[:web]
40
+ end
41
+ else
42
+ raise ArgumentError, "api and web endpoint configs required for github enterprise"
43
+ end
44
+ end
48
45
 
49
46
  if auth[:user] && auth[:password]
50
- headers[:http_basic_authentication] = [auth[:user], auth[:password]]
47
+ client = Octokit::Client.new(:login => auth[:user],
48
+ :password => auth[:password])
49
+
50
+ client.user(auth[:user])
51
51
  else
52
52
  raise ArgumentError, "Missing authentication"
53
53
  end
54
-
55
- uri.read headers
56
- end
57
-
58
- def get_last body
59
- link, last = body.meta["link"], nil
60
- link and link[/page=(\d+).. rel=.last/, 1].to_i or 0
54
+ client
61
55
  end
62
56
 
63
- def process account, body
64
- JSON.parse(body).each do |issue|
57
+ def process account, client
58
+ client.user_issues.each do |issue|
65
59
  pr = issue["pull_request"] && !issue["pull_request"]["diff_url"].nil?
66
60
  number = issue["number"]
67
61
  url = issue["html_url"]
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: 3
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 5
8
+ - 6
9
9
  - 0
10
- version: 1.5.0
10
+ version: 1.6.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: 2013-05-10 00:00:00 Z
39
+ date: 2013-07-24 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: omnifocus
@@ -46,32 +46,47 @@ dependencies:
46
46
  requirements:
47
47
  - - ~>
48
48
  - !ruby/object:Gem::Version
49
- hash: 7
49
+ hash: 3
50
50
  segments:
51
- - 1
52
- - 4
53
- version: "1.4"
51
+ - 2
52
+ - 0
53
+ version: "2.0"
54
54
  type: :runtime
55
55
  version_requirements: *id001
56
56
  - !ruby/object:Gem::Dependency
57
- name: json
57
+ name: octokit
58
58
  prerelease: false
59
59
  requirement: &id002 !ruby/object:Gem::Requirement
60
60
  none: false
61
61
  requirements:
62
62
  - - ~>
63
63
  - !ruby/object:Gem::Version
64
- hash: 5
64
+ hash: 63
65
65
  segments:
66
66
  - 1
67
- - 5
68
- version: "1.5"
67
+ - 24
68
+ version: "1.24"
69
69
  type: :runtime
70
70
  version_requirements: *id002
71
71
  - !ruby/object:Gem::Dependency
72
- name: minitest
72
+ name: system-timer
73
73
  prerelease: false
74
74
  requirement: &id003 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ hash: 11
80
+ segments:
81
+ - 1
82
+ - 2
83
+ version: "1.2"
84
+ type: :runtime
85
+ version_requirements: *id003
86
+ - !ruby/object:Gem::Dependency
87
+ name: minitest
88
+ prerelease: false
89
+ requirement: &id004 !ruby/object:Gem::Requirement
75
90
  none: false
76
91
  requirements:
77
92
  - - ~>
@@ -82,11 +97,11 @@ dependencies:
82
97
  - 0
83
98
  version: "5.0"
84
99
  type: :development
85
- version_requirements: *id003
100
+ version_requirements: *id004
86
101
  - !ruby/object:Gem::Dependency
87
102
  name: rdoc
88
103
  prerelease: false
89
- requirement: &id004 !ruby/object:Gem::Requirement
104
+ requirement: &id005 !ruby/object:Gem::Requirement
90
105
  none: false
91
106
  requirements:
92
107
  - - ~>
@@ -97,22 +112,22 @@ dependencies:
97
112
  - 0
98
113
  version: "4.0"
99
114
  type: :development
100
- version_requirements: *id004
115
+ version_requirements: *id005
101
116
  - !ruby/object:Gem::Dependency
102
117
  name: hoe
103
118
  prerelease: false
104
- requirement: &id005 !ruby/object:Gem::Requirement
119
+ requirement: &id006 !ruby/object:Gem::Requirement
105
120
  none: false
106
121
  requirements:
107
122
  - - ~>
108
123
  - !ruby/object:Gem::Version
109
- hash: 11
124
+ hash: 9
110
125
  segments:
111
126
  - 3
112
- - 6
113
- version: "3.6"
127
+ - 7
128
+ version: "3.7"
114
129
  type: :development
115
- version_requirements: *id005
130
+ version_requirements: *id006
116
131
  description: |-
117
132
  Plugin for omnifocus gem to provide github BTS synchronization.
118
133
 
@@ -123,14 +138,14 @@ description: |-
123
138
 
124
139
  git config --global omnifocus-github.accounts "github myghe"
125
140
 
126
- For each account API end point and authentication information are
141
+ For each account API and web end points and authentication information
127
142
  should be stored in the git config under a key matching the
128
143
  account. For example:
129
144
 
130
145
  git config --global github.user me
131
146
  git config --global github.password mypassword
132
147
  git config --global myghe.api https://ghe.mydomain.com/api/v3
133
- git config --global myghe.token 1a2b3c4d5e6f7e8d
148
+ git config --global myghe.api https://ghe.mydomain.com/
134
149
 
135
150
  For each account can you specify the following parameters:
136
151
 
@@ -138,12 +153,10 @@ description: |-
138
153
  https://api.github.com. This is so you can point this at your Github
139
154
  Enterprise endpoint.
140
155
 
141
- * user, password - A username and password pair for Basic http authentication.
156
+ * web - specify an API endpoint other than https://www.github.com. This
157
+ is so you can point this at your Github Enterprise endpoint
142
158
 
143
- * token - An OAuth bearer token for OAuth workflows.
144
-
145
- If both a token and a username and password are supplied, the token
146
- is used.
159
+ * user, password - A username and password pair for Basic http authentication.
147
160
  email:
148
161
  - ryand-ruby@zenspider.com
149
162
  executables: []
@@ -162,8 +175,8 @@ files:
162
175
  - Rakefile
163
176
  - lib/omnifocus/github.rb
164
177
  homepage: https://github.com/seattlerb/omnifocus-github
165
- licenses: []
166
-
178
+ licenses:
179
+ - MIT
167
180
  post_install_message:
168
181
  rdoc_options:
169
182
  - --main
metadata.gz.sig CHANGED
Binary file