gitlab 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +3 -1
- data/LICENSE.txt +1 -1
- data/README.md +9 -1
- data/lib/gitlab.rb +7 -7
- data/lib/gitlab/api.rb +1 -1
- data/lib/gitlab/client.rb +9 -7
- data/lib/gitlab/client/groups.rb +88 -0
- data/lib/gitlab/client/issues.rb +13 -16
- data/lib/gitlab/client/merge_requests.rb +67 -5
- data/lib/gitlab/client/milestones.rb +6 -8
- data/lib/gitlab/client/notes.rb +106 -0
- data/lib/gitlab/client/projects.rb +98 -17
- data/lib/gitlab/client/repositories.rb +4 -6
- data/lib/gitlab/client/snippets.rb +22 -15
- data/lib/gitlab/configuration.rb +2 -1
- data/lib/gitlab/error.rb +9 -0
- data/lib/gitlab/request.rb +25 -20
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/comment_merge_request.json +1 -0
- data/spec/fixtures/create_merge_request.json +1 -0
- data/spec/fixtures/error_already_exists.json +1 -0
- data/spec/fixtures/group.json +60 -0
- data/spec/fixtures/group_create.json +1 -0
- data/spec/fixtures/group_member.json +1 -0
- data/spec/fixtures/group_member_delete.json +1 -0
- data/spec/fixtures/group_members.json +1 -0
- data/spec/fixtures/groups.json +2 -0
- data/spec/fixtures/note.json +1 -0
- data/spec/fixtures/notes.json +1 -0
- data/spec/fixtures/project.json +1 -1
- data/spec/fixtures/project_delete_key.json +8 -0
- data/spec/fixtures/project_for_user.json +1 -0
- data/spec/fixtures/project_fork_link.json +1 -0
- data/spec/fixtures/project_key.json +6 -0
- data/spec/fixtures/project_keys.json +6 -0
- data/spec/fixtures/update_merge_request.json +1 -0
- data/spec/gitlab/client/groups_spec.rb +111 -0
- data/spec/gitlab/client/issues_spec.rb +2 -2
- data/spec/gitlab/client/merge_requests_spec.rb +57 -0
- data/spec/gitlab/client/notes_spec.rb +156 -0
- data/spec/gitlab/client/projects_spec.rb +97 -2
- data/spec/gitlab/client/users_spec.rb +20 -9
- data/spec/gitlab_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -2
- metadata +55 -31
@@ -50,6 +50,20 @@ describe Gitlab::Client do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
describe ".create_project for user" do
|
54
|
+
before do
|
55
|
+
stub_post("/users", "user")
|
56
|
+
@owner = Gitlab.create_user("john@example.com", "pass", {name: 'John Owner'})
|
57
|
+
stub_post("/projects/user/#{@owner.id}", "project_for_user")
|
58
|
+
@project = Gitlab.create_project('Brute', {:user_id => @owner.id})
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return information about a created project" do
|
62
|
+
@project.name.should == "Brute"
|
63
|
+
@project.owner.name.should == "John Owner"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
53
67
|
describe ".team_members" do
|
54
68
|
before do
|
55
69
|
stub_get("/projects/3/members", "team_members")
|
@@ -89,7 +103,7 @@ describe Gitlab::Client do
|
|
89
103
|
|
90
104
|
it "should get the correct resource" do
|
91
105
|
a_post("/projects/3/members").
|
92
|
-
|
106
|
+
with(:body => {:user_id => '1', :access_level => '40'}).should have_been_made
|
93
107
|
end
|
94
108
|
|
95
109
|
it "should return information about an added team member" do
|
@@ -105,7 +119,7 @@ describe Gitlab::Client do
|
|
105
119
|
|
106
120
|
it "should get the correct resource" do
|
107
121
|
a_put("/projects/3/members/1").
|
108
|
-
|
122
|
+
with(:body => {:access_level => '40'}).should have_been_made
|
109
123
|
end
|
110
124
|
|
111
125
|
it "should return information about an edited team member" do
|
@@ -205,4 +219,85 @@ describe Gitlab::Client do
|
|
205
219
|
@hook.url.should == "https://api.example.net/v1/webhooks/ci"
|
206
220
|
end
|
207
221
|
end
|
222
|
+
|
223
|
+
describe ".make_forked_from" do
|
224
|
+
before do
|
225
|
+
stub_post("/projects/42/fork/24", "project_fork_link")
|
226
|
+
@forked_project_link = Gitlab.make_forked_from(42, 24)
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should get the correct resource" do
|
230
|
+
a_post("/projects/42/fork/24").should have_been_made
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should return information about a forked project" do
|
234
|
+
@forked_project_link.forked_from_project_id.should == 24
|
235
|
+
@forked_project_link.forked_to_project_id.should == 42
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe ".remove_forked" do
|
240
|
+
before do
|
241
|
+
stub_delete("/projects/42/fork", "project_fork_link")
|
242
|
+
@forked_project_link = Gitlab.remove_forked(42)
|
243
|
+
end
|
244
|
+
|
245
|
+
it "should be sent to correct resource" do
|
246
|
+
a_delete("/projects/42/fork").should have_been_made
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should return information about an unforked project" do
|
250
|
+
@forked_project_link.forked_to_project_id.should == 42
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
describe ".deploy_keys" do
|
255
|
+
before do
|
256
|
+
stub_get("/projects/42/keys", "project_keys")
|
257
|
+
@deploy_keys = Gitlab.deploy_keys(42)
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should get the correct resource" do
|
261
|
+
a_get("/projects/42/keys").should have_been_made
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should return project deploy keys" do
|
265
|
+
@deploy_keys.should be_an Array
|
266
|
+
@deploy_keys.first.id.should eq 2
|
267
|
+
@deploy_keys.first.title.should eq "Key Title"
|
268
|
+
@deploy_keys.first.key.should match(/ssh-rsa/)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
describe ".deploy_key" do
|
273
|
+
before do
|
274
|
+
stub_get("/projects/42/keys/2", "project_key")
|
275
|
+
@deploy_key = Gitlab.deploy_key(42, 2)
|
276
|
+
end
|
277
|
+
|
278
|
+
it "should get the correct resource" do
|
279
|
+
a_get("/projects/42/keys/2").should have_been_made
|
280
|
+
end
|
281
|
+
|
282
|
+
it "should return project deploy key" do
|
283
|
+
@deploy_key.id.should eq 2
|
284
|
+
@deploy_key.title.should eq "Key Title"
|
285
|
+
@deploy_key.key.should match(/ssh-rsa/)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
describe ".delete_deploy_key" do
|
290
|
+
before do
|
291
|
+
stub_delete("/projects/42/keys/2", "project_delete_key")
|
292
|
+
@deploy_key = Gitlab.delete_deploy_key(42, 2)
|
293
|
+
end
|
294
|
+
|
295
|
+
it "should get the correct resource" do
|
296
|
+
a_delete("/projects/42/keys/2").should have_been_made
|
297
|
+
end
|
298
|
+
|
299
|
+
it "should return information about a deleted key" do
|
300
|
+
@deploy_key.id.should == 2
|
301
|
+
end
|
302
|
+
end
|
208
303
|
end
|
@@ -50,18 +50,29 @@ describe Gitlab::Client do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
describe ".create_user" do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
context "when successful request" do
|
54
|
+
before do
|
55
|
+
stub_post("/users", "user")
|
56
|
+
@user = Gitlab.create_user("email", "pass")
|
57
|
+
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
it "should get the correct resource" do
|
60
|
+
body = {:email => "email", :password => "pass", :name => "email"}
|
61
|
+
a_post("/users").with(:body => body).should have_been_made
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should return information about a created user" do
|
65
|
+
@user.email.should == "john@example.com"
|
66
|
+
end
|
61
67
|
end
|
62
68
|
|
63
|
-
|
64
|
-
|
69
|
+
context "when bad request" do
|
70
|
+
it "should throw an exception" do
|
71
|
+
stub_post("/users", "error_already_exists", 409)
|
72
|
+
expect {
|
73
|
+
Gitlab.create_user("email", "pass")
|
74
|
+
}.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users")
|
75
|
+
end
|
65
76
|
end
|
66
77
|
end
|
67
78
|
|
data/spec/gitlab_spec.rb
CHANGED
@@ -23,6 +23,13 @@ describe Gitlab do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
describe ".sudo=" do
|
27
|
+
it "should set sudo" do
|
28
|
+
Gitlab.sudo = 'user'
|
29
|
+
Gitlab.sudo.should == 'user'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
26
33
|
describe ".user_agent" do
|
27
34
|
it "should return default user_agent" do
|
28
35
|
Gitlab.user_agent.should == Gitlab::Configuration::DEFAULT_USER_AGENT
|
data/spec/spec_helper.rb
CHANGED
@@ -27,10 +27,10 @@ def a_get(path)
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# POST
|
30
|
-
def stub_post(path, fixture)
|
30
|
+
def stub_post(path, fixture, status_code=200)
|
31
31
|
stub_request(:post, "#{Gitlab.endpoint}#{path}").
|
32
32
|
with(:query => {:private_token => Gitlab.private_token}).
|
33
|
-
to_return(:body => load_fixture(fixture))
|
33
|
+
to_return(:body => load_fixture(fixture), :status => status_code)
|
34
34
|
end
|
35
35
|
|
36
36
|
def a_post(path)
|
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nihad Abbasov
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-10-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: httparty
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: webmock
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
description: Ruby client for GitLab API
|
@@ -92,9 +83,11 @@ files:
|
|
92
83
|
- lib/gitlab.rb
|
93
84
|
- lib/gitlab/api.rb
|
94
85
|
- lib/gitlab/client.rb
|
86
|
+
- lib/gitlab/client/groups.rb
|
95
87
|
- lib/gitlab/client/issues.rb
|
96
88
|
- lib/gitlab/client/merge_requests.rb
|
97
89
|
- lib/gitlab/client/milestones.rb
|
90
|
+
- lib/gitlab/client/notes.rb
|
98
91
|
- lib/gitlab/client/projects.rb
|
99
92
|
- lib/gitlab/client/repositories.rb
|
100
93
|
- lib/gitlab/client/snippets.rb
|
@@ -104,6 +97,15 @@ files:
|
|
104
97
|
- lib/gitlab/objectified_hash.rb
|
105
98
|
- lib/gitlab/request.rb
|
106
99
|
- lib/gitlab/version.rb
|
100
|
+
- spec/fixtures/comment_merge_request.json
|
101
|
+
- spec/fixtures/create_merge_request.json
|
102
|
+
- spec/fixtures/error_already_exists.json
|
103
|
+
- spec/fixtures/group.json
|
104
|
+
- spec/fixtures/group_create.json
|
105
|
+
- spec/fixtures/group_member.json
|
106
|
+
- spec/fixtures/group_member_delete.json
|
107
|
+
- spec/fixtures/group_members.json
|
108
|
+
- spec/fixtures/groups.json
|
107
109
|
- spec/fixtures/issue.json
|
108
110
|
- spec/fixtures/issues.json
|
109
111
|
- spec/fixtures/key.json
|
@@ -112,13 +114,20 @@ files:
|
|
112
114
|
- spec/fixtures/merge_requests.json
|
113
115
|
- spec/fixtures/milestone.json
|
114
116
|
- spec/fixtures/milestones.json
|
117
|
+
- spec/fixtures/note.json
|
118
|
+
- spec/fixtures/notes.json
|
115
119
|
- spec/fixtures/project.json
|
116
120
|
- spec/fixtures/project_branch.json
|
117
121
|
- spec/fixtures/project_branches.json
|
118
122
|
- spec/fixtures/project_commits.json
|
123
|
+
- spec/fixtures/project_delete_key.json
|
124
|
+
- spec/fixtures/project_for_user.json
|
125
|
+
- spec/fixtures/project_fork_link.json
|
119
126
|
- spec/fixtures/project_hook.json
|
120
127
|
- spec/fixtures/project_hooks.json
|
121
128
|
- spec/fixtures/project_issues.json
|
129
|
+
- spec/fixtures/project_key.json
|
130
|
+
- spec/fixtures/project_keys.json
|
122
131
|
- spec/fixtures/project_tags.json
|
123
132
|
- spec/fixtures/projects.json
|
124
133
|
- spec/fixtures/session.json
|
@@ -126,11 +135,14 @@ files:
|
|
126
135
|
- spec/fixtures/snippets.json
|
127
136
|
- spec/fixtures/team_member.json
|
128
137
|
- spec/fixtures/team_members.json
|
138
|
+
- spec/fixtures/update_merge_request.json
|
129
139
|
- spec/fixtures/user.json
|
130
140
|
- spec/fixtures/users.json
|
141
|
+
- spec/gitlab/client/groups_spec.rb
|
131
142
|
- spec/gitlab/client/issues_spec.rb
|
132
143
|
- spec/gitlab/client/merge_requests_spec.rb
|
133
144
|
- spec/gitlab/client/milestones_spec.rb
|
145
|
+
- spec/gitlab/client/notes_spec.rb
|
134
146
|
- spec/gitlab/client/projects_spec.rb
|
135
147
|
- spec/gitlab/client/repositories_spec.rb
|
136
148
|
- spec/gitlab/client/snippets_spec.rb
|
@@ -139,35 +151,37 @@ files:
|
|
139
151
|
- spec/spec_helper.rb
|
140
152
|
homepage: https://github.com/narkoz/gitlab
|
141
153
|
licenses: []
|
154
|
+
metadata: {}
|
142
155
|
post_install_message:
|
143
156
|
rdoc_options: []
|
144
157
|
require_paths:
|
145
158
|
- lib
|
146
159
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
160
|
requirements:
|
149
|
-
- -
|
161
|
+
- - '>='
|
150
162
|
- !ruby/object:Gem::Version
|
151
163
|
version: '0'
|
152
|
-
segments:
|
153
|
-
- 0
|
154
|
-
hash: 2963667120197220798
|
155
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
-
none: false
|
157
165
|
requirements:
|
158
|
-
- -
|
166
|
+
- - '>='
|
159
167
|
- !ruby/object:Gem::Version
|
160
168
|
version: '0'
|
161
|
-
segments:
|
162
|
-
- 0
|
163
|
-
hash: 2963667120197220798
|
164
169
|
requirements: []
|
165
170
|
rubyforge_project:
|
166
|
-
rubygems_version: 1.
|
171
|
+
rubygems_version: 2.1.7
|
167
172
|
signing_key:
|
168
|
-
specification_version:
|
173
|
+
specification_version: 4
|
169
174
|
summary: A Ruby wrapper for the GitLab API
|
170
175
|
test_files:
|
176
|
+
- spec/fixtures/comment_merge_request.json
|
177
|
+
- spec/fixtures/create_merge_request.json
|
178
|
+
- spec/fixtures/error_already_exists.json
|
179
|
+
- spec/fixtures/group.json
|
180
|
+
- spec/fixtures/group_create.json
|
181
|
+
- spec/fixtures/group_member.json
|
182
|
+
- spec/fixtures/group_member_delete.json
|
183
|
+
- spec/fixtures/group_members.json
|
184
|
+
- spec/fixtures/groups.json
|
171
185
|
- spec/fixtures/issue.json
|
172
186
|
- spec/fixtures/issues.json
|
173
187
|
- spec/fixtures/key.json
|
@@ -176,13 +190,20 @@ test_files:
|
|
176
190
|
- spec/fixtures/merge_requests.json
|
177
191
|
- spec/fixtures/milestone.json
|
178
192
|
- spec/fixtures/milestones.json
|
193
|
+
- spec/fixtures/note.json
|
194
|
+
- spec/fixtures/notes.json
|
179
195
|
- spec/fixtures/project.json
|
180
196
|
- spec/fixtures/project_branch.json
|
181
197
|
- spec/fixtures/project_branches.json
|
182
198
|
- spec/fixtures/project_commits.json
|
199
|
+
- spec/fixtures/project_delete_key.json
|
200
|
+
- spec/fixtures/project_for_user.json
|
201
|
+
- spec/fixtures/project_fork_link.json
|
183
202
|
- spec/fixtures/project_hook.json
|
184
203
|
- spec/fixtures/project_hooks.json
|
185
204
|
- spec/fixtures/project_issues.json
|
205
|
+
- spec/fixtures/project_key.json
|
206
|
+
- spec/fixtures/project_keys.json
|
186
207
|
- spec/fixtures/project_tags.json
|
187
208
|
- spec/fixtures/projects.json
|
188
209
|
- spec/fixtures/session.json
|
@@ -190,11 +211,14 @@ test_files:
|
|
190
211
|
- spec/fixtures/snippets.json
|
191
212
|
- spec/fixtures/team_member.json
|
192
213
|
- spec/fixtures/team_members.json
|
214
|
+
- spec/fixtures/update_merge_request.json
|
193
215
|
- spec/fixtures/user.json
|
194
216
|
- spec/fixtures/users.json
|
217
|
+
- spec/gitlab/client/groups_spec.rb
|
195
218
|
- spec/gitlab/client/issues_spec.rb
|
196
219
|
- spec/gitlab/client/merge_requests_spec.rb
|
197
220
|
- spec/gitlab/client/milestones_spec.rb
|
221
|
+
- spec/gitlab/client/notes_spec.rb
|
198
222
|
- spec/gitlab/client/projects_spec.rb
|
199
223
|
- spec/gitlab/client/repositories_spec.rb
|
200
224
|
- spec/gitlab/client/snippets_spec.rb
|