octokit 0.5.2 → 0.6.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/lib/octokit.rb +6 -2
- data/lib/octokit/client.rb +14 -3
- data/lib/octokit/client/connection.rb +1 -1
- data/lib/octokit/client/objects.rb +1 -1
- data/lib/octokit/client/repositories.rb +5 -10
- data/lib/octokit/client/users.rb +2 -4
- data/lib/octokit/configuration.rb +1 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -2
- data/spec/faraday/response_spec.rb +1 -1
- data/spec/helper.rb +1 -3
- data/spec/octokit/client/commits_spec.rb +1 -1
- data/spec/octokit/client/issues_spec.rb +1 -1
- data/spec/octokit/client/network_spec.rb +1 -1
- data/spec/octokit/client/objects_spec.rb +8 -3
- data/spec/octokit/client/organizations_spec.rb +1 -1
- data/spec/octokit/client/pulls_spec.rb +1 -1
- data/spec/octokit/client/repositories_spec.rb +16 -16
- data/spec/octokit/client/timelines_spec.rb +1 -1
- data/spec/octokit/client/users_spec.rb +5 -5
- data/spec/octokit/client_spec.rb +1 -1
- data/spec/octokit_spec.rb +1 -1
- data/spec/repository_spec.rb +1 -1
- metadata +5 -5
data/lib/octokit.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'octokit/configuration'
|
2
|
+
require 'octokit/client'
|
3
3
|
|
4
4
|
module Octokit
|
5
5
|
extend Configuration
|
@@ -17,6 +17,10 @@ module Octokit
|
|
17
17
|
client.send(method, *args, &block)
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.respond_to?(method)
|
21
|
+
client.respond_to?(method) || super
|
22
|
+
end
|
23
|
+
|
20
24
|
# Custom error class for rescuing from all GitHub errors
|
21
25
|
class Error < StandardError; end
|
22
26
|
|
data/lib/octokit/client.rb
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'octokit/repository'
|
2
|
+
require 'octokit/client/authentication'
|
3
|
+
require 'octokit/client/connection'
|
4
|
+
require 'octokit/client/request'
|
5
|
+
require 'octokit/client/commits'
|
6
|
+
require 'octokit/client/issues'
|
7
|
+
require 'octokit/client/network'
|
8
|
+
require 'octokit/client/objects'
|
9
|
+
require 'octokit/client/organizations'
|
10
|
+
require 'octokit/client/pulls'
|
11
|
+
require 'octokit/client/repositories'
|
12
|
+
require 'octokit/client/timelines'
|
13
|
+
require 'octokit/client/users'
|
3
14
|
|
4
15
|
module Octokit
|
5
16
|
class Client
|
@@ -26,4 +37,4 @@ module Octokit
|
|
26
37
|
include Octokit::Client::Timelines
|
27
38
|
include Octokit::Client::Users
|
28
39
|
end
|
29
|
-
end
|
40
|
+
end
|
@@ -24,20 +24,17 @@ module Octokit
|
|
24
24
|
alias :list_repos :repositories
|
25
25
|
alias :repos :repositories
|
26
26
|
|
27
|
-
def watch
|
27
|
+
def watch(repo, options={})
|
28
28
|
post("repos/watch/#{Repository.new(repo)}", options)['repository']
|
29
29
|
end
|
30
|
-
alias :watch :watch!
|
31
30
|
|
32
|
-
def unwatch
|
31
|
+
def unwatch(repo, options={})
|
33
32
|
post("repos/unwatch/#{Repository.new(repo)}", options)['repository']
|
34
33
|
end
|
35
|
-
alias :unwatch :unwatch!
|
36
34
|
|
37
|
-
def fork
|
35
|
+
def fork(repo, options={})
|
38
36
|
post("repos/fork/#{Repository.new(repo)}", options)['repository']
|
39
37
|
end
|
40
|
-
alias :fork :fork!
|
41
38
|
|
42
39
|
def create_repository(name, options={})
|
43
40
|
post("repos/create", options.merge(:name => name))['repository']
|
@@ -61,15 +58,13 @@ module Octokit
|
|
61
58
|
end
|
62
59
|
alias :delete_repo! :delete_repository!
|
63
60
|
|
64
|
-
def set_private
|
61
|
+
def set_private(repo, options={})
|
65
62
|
post("repos/set/private/#{Repository.new(repo)}", options)['repository']
|
66
63
|
end
|
67
|
-
alias :set_private :set_private!
|
68
64
|
|
69
|
-
def set_public
|
65
|
+
def set_public(repo, options={})
|
70
66
|
post("repos/set/public/#{Repository.new(repo)}", options)['repository']
|
71
67
|
end
|
72
|
-
alias :set_public :set_public!
|
73
68
|
|
74
69
|
def deploy_keys(repo, options={})
|
75
70
|
get("repos/keys/#{Repository.new(repo)}", options)['public_keys']
|
data/lib/octokit/client/users.rb
CHANGED
@@ -35,15 +35,13 @@ module Octokit
|
|
35
35
|
following(user).include?(target)
|
36
36
|
end
|
37
37
|
|
38
|
-
def follow
|
38
|
+
def follow(user, options={})
|
39
39
|
post("user/follow/#{user}", options)['users']
|
40
40
|
end
|
41
|
-
alias :follow :follow!
|
42
41
|
|
43
|
-
def unfollow
|
42
|
+
def unfollow(user, options={})
|
44
43
|
post("user/unfollow/#{user}", options)['users']
|
45
44
|
end
|
46
|
-
alias :unfollow :unfollow!
|
47
45
|
|
48
46
|
def watched(user=login, options={})
|
49
47
|
get("repos/watched/#{user}", options)['repositories']
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -6,9 +6,9 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.add_development_dependency('nokogiri', '~> 1.4')
|
7
7
|
s.add_development_dependency('rake', '~> 0.8')
|
8
8
|
s.add_development_dependency('rspec', '~> 2.5')
|
9
|
-
s.add_development_dependency('simplecov', '~> 0.
|
9
|
+
s.add_development_dependency('simplecov', '~> 0.4')
|
10
10
|
s.add_development_dependency('webmock', '~> 1.6')
|
11
|
-
s.add_development_dependency('ZenTest', '~> 4.
|
11
|
+
s.add_development_dependency('ZenTest', '~> 4.5')
|
12
12
|
s.add_runtime_dependency('addressable', '~> 2.2.4')
|
13
13
|
s.add_runtime_dependency('hashie', '~> 1.0.0')
|
14
14
|
s.add_runtime_dependency('faraday', '~> 0.5.4')
|
data/spec/helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
describe Octokit::Client::Objects do
|
4
4
|
|
@@ -34,7 +34,7 @@ describe Octokit::Client::Objects do
|
|
34
34
|
stub_get("blob/all/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
35
35
|
to_return(:body => fixture("blobs.json"))
|
36
36
|
blobs = @client.blobs("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
37
|
-
blobs.
|
37
|
+
blobs[".gitignore"].should == "5efe0eb47a773fa6ea84a0bf190ee218b6a31ead"
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
@@ -64,10 +64,15 @@ describe Octokit::Client::Objects do
|
|
64
64
|
describe ".raw" do
|
65
65
|
|
66
66
|
it "should return raw data" do
|
67
|
-
pending "TODO: This shouldn't get parsed as JSON"
|
68
67
|
stub_get("blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
69
68
|
to_return(:body => fixture("raw.txt"))
|
70
69
|
raw = @client.raw("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
70
|
+
lambda {
|
71
|
+
::MultiJson.decode(raw)
|
72
|
+
}.should raise_error
|
73
|
+
lambda {
|
74
|
+
::MultiXml.decode(raw)
|
75
|
+
}.should raise_error
|
71
76
|
end
|
72
77
|
|
73
78
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
describe Octokit::Client::Repositories do
|
4
4
|
|
@@ -67,34 +67,34 @@ describe Octokit::Client::Repositories do
|
|
67
67
|
|
68
68
|
end
|
69
69
|
|
70
|
-
describe ".watch
|
70
|
+
describe ".watch" do
|
71
71
|
|
72
72
|
it "should watch a repository" do
|
73
73
|
stub_post("repos/watch/sferik/rails_admin").
|
74
74
|
to_return(:body => fixture("repository.json"))
|
75
|
-
repository = @client.watch
|
75
|
+
repository = @client.watch("sferik/rails_admin")
|
76
76
|
repository.name.should == "rails_admin"
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
80
80
|
|
81
|
-
describe ".unwatch
|
81
|
+
describe ".unwatch" do
|
82
82
|
|
83
83
|
it "should unwatch a repository" do
|
84
84
|
stub_post("repos/unwatch/sferik/rails_admin").
|
85
85
|
to_return(:body => fixture("repository.json"))
|
86
|
-
repository = @client.unwatch
|
86
|
+
repository = @client.unwatch("sferik/rails_admin")
|
87
87
|
repository.name.should == "rails_admin"
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
91
91
|
|
92
|
-
describe ".fork
|
92
|
+
describe ".fork" do
|
93
93
|
|
94
94
|
it "should fork a repository" do
|
95
95
|
stub_post("repos/fork/sferik/rails_admin").
|
96
96
|
to_return(:body => fixture("repository.json"))
|
97
|
-
repository = @client.fork
|
97
|
+
repository = @client.fork("sferik/rails_admin")
|
98
98
|
repository.name.should == "rails_admin"
|
99
99
|
end
|
100
100
|
|
@@ -123,34 +123,34 @@ describe Octokit::Client::Repositories do
|
|
123
123
|
|
124
124
|
end
|
125
125
|
|
126
|
-
describe ".delete_repository
|
126
|
+
describe ".delete_repository" do
|
127
127
|
|
128
128
|
it "should delete a repository" do
|
129
129
|
stub_post("repos/delete/sferik/rails_admin").
|
130
130
|
to_return(:body => fixture("repository.json"))
|
131
|
-
repository = @client.delete_repository
|
131
|
+
repository = @client.delete_repository("sferik/rails_admin")
|
132
132
|
repository.name.should == "rails_admin"
|
133
133
|
end
|
134
134
|
|
135
135
|
end
|
136
136
|
|
137
|
-
describe ".set_private
|
137
|
+
describe ".set_private" do
|
138
138
|
|
139
139
|
it "should set a repository private" do
|
140
140
|
stub_post("repos/set/private/sferik/rails_admin").
|
141
141
|
to_return(:body => fixture("repository.json"))
|
142
|
-
repository = @client.set_private
|
142
|
+
repository = @client.set_private("sferik/rails_admin")
|
143
143
|
repository.name.should == "rails_admin"
|
144
144
|
end
|
145
145
|
|
146
146
|
end
|
147
147
|
|
148
|
-
describe ".set_public
|
148
|
+
describe ".set_public" do
|
149
149
|
|
150
150
|
it "should set a repository public" do
|
151
151
|
stub_post("repos/set/public/sferik/rails_admin").
|
152
152
|
to_return(:body => fixture("repository.json"))
|
153
|
-
repository = @client.set_public
|
153
|
+
repository = @client.set_public("sferik/rails_admin")
|
154
154
|
repository.name.should == "rails_admin"
|
155
155
|
end
|
156
156
|
|
@@ -300,7 +300,7 @@ describe Octokit::Client::Repositories do
|
|
300
300
|
stub_get("repos/show/sferik/rails_admin/languages").
|
301
301
|
to_return(:body => fixture("languages.json"))
|
302
302
|
languages = @client.languages("sferik/rails_admin")
|
303
|
-
languages.
|
303
|
+
languages["Ruby"].should == 205046
|
304
304
|
end
|
305
305
|
|
306
306
|
end
|
@@ -311,7 +311,7 @@ describe Octokit::Client::Repositories do
|
|
311
311
|
stub_get("repos/show/pengwynn/octokit/tags").
|
312
312
|
to_return(:body => fixture("tags.json"))
|
313
313
|
tags = @client.tags("pengwynn/octokit")
|
314
|
-
tags.
|
314
|
+
tags["v0.0.1"].should == "0d7a03f2035ecd74e4d6eb9be58865c2a688ee55"
|
315
315
|
end
|
316
316
|
|
317
317
|
end
|
@@ -322,7 +322,7 @@ describe Octokit::Client::Repositories do
|
|
322
322
|
stub_get("repos/show/pengwynn/octokit/branches").
|
323
323
|
to_return(:body => fixture("branches.json"))
|
324
324
|
branches = @client.branches("pengwynn/octokit")
|
325
|
-
branches.
|
325
|
+
branches["master"].should == "4d9a9e9ca183bab1c3d0accf1d53edd85bd6200f"
|
326
326
|
end
|
327
327
|
|
328
328
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
describe Octokit::Client::Users do
|
4
4
|
|
@@ -152,23 +152,23 @@ describe Octokit::Client::Users do
|
|
152
152
|
|
153
153
|
end
|
154
154
|
|
155
|
-
describe ".follow
|
155
|
+
describe ".follow" do
|
156
156
|
|
157
157
|
it "should follow a user" do
|
158
158
|
stub_post("user/follow/dianakimball").
|
159
159
|
to_return(:body => fixture("following.json"))
|
160
|
-
following = @client.follow
|
160
|
+
following = @client.follow("dianakimball")
|
161
161
|
following.should include("dianakimball")
|
162
162
|
end
|
163
163
|
|
164
164
|
end
|
165
165
|
|
166
|
-
describe ".unfollow
|
166
|
+
describe ".unfollow" do
|
167
167
|
|
168
168
|
it "should unfollow a user" do
|
169
169
|
stub_post("user/unfollow/dogbrainz").
|
170
170
|
to_return(:body => fixture("following.json"))
|
171
|
-
following = @client.unfollow
|
171
|
+
following = @client.unfollow("dogbrainz")
|
172
172
|
following.should_not include("dogbrainz")
|
173
173
|
end
|
174
174
|
|
data/spec/octokit/client_spec.rb
CHANGED
data/spec/octokit_spec.rb
CHANGED
data/spec/repository_spec.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.6.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Wynn Netherland
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-
|
15
|
+
date: 2011-03-20 00:00:00 -07:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
requirements:
|
68
68
|
- - ~>
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: "0.
|
70
|
+
version: "0.4"
|
71
71
|
type: :development
|
72
72
|
version_requirements: *id005
|
73
73
|
- !ruby/object:Gem::Dependency
|
@@ -89,7 +89,7 @@ dependencies:
|
|
89
89
|
requirements:
|
90
90
|
- - ~>
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: "4.
|
92
|
+
version: "4.5"
|
93
93
|
type: :development
|
94
94
|
version_requirements: *id007
|
95
95
|
- !ruby/object:Gem::Dependency
|
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
272
|
requirements: []
|
273
273
|
|
274
274
|
rubyforge_project:
|
275
|
-
rubygems_version: 1.
|
275
|
+
rubygems_version: 1.6.2
|
276
276
|
signing_key:
|
277
277
|
specification_version: 3
|
278
278
|
summary: Wrapper for the GitHub API
|