teamcity_ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +42 -0
- data/Rakefile +5 -0
- data/lib/teamcity_ruby/build_configuration.rb +86 -0
- data/lib/teamcity_ruby/element_builder.rb +27 -0
- data/lib/teamcity_ruby/project.rb +52 -0
- data/lib/teamcity_ruby/resource.rb +26 -0
- data/lib/teamcity_ruby/vcs_root.rb +49 -0
- data/lib/teamcity_ruby/version.rb +3 -0
- data/lib/teamcity_ruby.rb +28 -0
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_step_added_to_it.yml +331 -0
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_trigger_added_to_it.yml +298 -0
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_vcs_root_attached_with_specific_checkout_rules.yml +335 -0
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/fetches_a_specific_build_configuration_by_id.yml +261 -0
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/lists_all_build_configurations.yml +397 -0
- data/spec/cassettes/TeamcityRuby_Project/creates_a_project_copying_its_settings_from_a_source_project.yml +301 -0
- data/spec/cassettes/TeamcityRuby_Project/creates_a_project_with_a_parent_project.yml +154 -0
- data/spec/cassettes/TeamcityRuby_Project/destroys_a_specific_project.yml +223 -0
- data/spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_id_locator.yml +220 -0
- data/spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_name_locator.yml +187 -0
- data/spec/cassettes/TeamcityRuby_Project/lists_all_projects_including_root_built_in_on_TeamCity_.yml +224 -0
- data/spec/cassettes/TeamcityRuby_VcsRoot/lists_all_vcs_roots.yml +151 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/teamcity_ruby/build_configuration_spec.rb +59 -0
- data/spec/teamcity_ruby/element_builder_spec.rb +29 -0
- data/spec/teamcity_ruby/project_spec.rb +59 -0
- data/spec/teamcity_ruby/vcs_root_spec.rb +21 -0
- data/teamcity_ruby.gemspec +31 -0
- metadata +242 -0
@@ -0,0 +1,187 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.4.0
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: get
|
6
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects
|
7
|
+
body:
|
8
|
+
string: ""
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Date:
|
20
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
Set-Cookie:
|
26
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
27
|
+
- TCSESSIONID=392B1546BFCAD08FE3D7DD20A590E18F; Path=/; HttpOnly
|
28
|
+
Content-Type:
|
29
|
+
- application/json
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Expires:
|
33
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
34
|
+
Cache-Control:
|
35
|
+
- no-cache
|
36
|
+
- no-store
|
37
|
+
body:
|
38
|
+
string: "{\"project\":[{\"id\":\"_Root\",\"name\":\"<Root project>\",\"href\":\"/httpAuth/app/rest/projects/id:_Root\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=_Root\"},{\"id\":\"PetshopApp\",\"name\":\"Petshop App\",\"href\":\"/httpAuth/app/rest/projects/id:PetshopApp\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=PetshopApp\",\"parentProjectId\":\"_Root\"}]}"
|
39
|
+
http_version:
|
40
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
41
|
+
- request:
|
42
|
+
method: delete
|
43
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects/id:_Root
|
44
|
+
body:
|
45
|
+
string: ""
|
46
|
+
headers:
|
47
|
+
Accept:
|
48
|
+
- application/json
|
49
|
+
Content-Type:
|
50
|
+
- application/json
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 403
|
54
|
+
message: Forbidden
|
55
|
+
headers:
|
56
|
+
Date:
|
57
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
58
|
+
Transfer-Encoding:
|
59
|
+
- chunked
|
60
|
+
Server:
|
61
|
+
- Apache-Coyote/1.1
|
62
|
+
Set-Cookie:
|
63
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
64
|
+
- TCSESSIONID=BCD0E1E1888DE5D8112DD59034A4F848; Path=/; HttpOnly
|
65
|
+
Content-Type:
|
66
|
+
- text/plain
|
67
|
+
Pragma:
|
68
|
+
- no-cache
|
69
|
+
Expires:
|
70
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
71
|
+
Cache-Control:
|
72
|
+
- no-cache
|
73
|
+
- no-store
|
74
|
+
body:
|
75
|
+
string: |-
|
76
|
+
Error has occurred during request processing (Forbidden).
|
77
|
+
Error: jetbrains.buildServer.serverSide.auth.AccessDeniedException: Root project cannot be removed
|
78
|
+
Access denied. Check the user has enough permissions to perform the operation.
|
79
|
+
http_version:
|
80
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
81
|
+
- request:
|
82
|
+
method: delete
|
83
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects/id:PetshopApp
|
84
|
+
body:
|
85
|
+
string: ""
|
86
|
+
headers:
|
87
|
+
Accept:
|
88
|
+
- application/json
|
89
|
+
Content-Type:
|
90
|
+
- application/json
|
91
|
+
response:
|
92
|
+
status:
|
93
|
+
code: 204
|
94
|
+
message: No Content
|
95
|
+
headers:
|
96
|
+
Date:
|
97
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
98
|
+
Server:
|
99
|
+
- Apache-Coyote/1.1
|
100
|
+
Set-Cookie:
|
101
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
102
|
+
- TCSESSIONID=51D54AEBB20CEB8EA5DFF280165E22A6; Path=/; HttpOnly
|
103
|
+
Pragma:
|
104
|
+
- no-cache
|
105
|
+
Expires:
|
106
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
107
|
+
Cache-Control:
|
108
|
+
- no-cache
|
109
|
+
- no-store
|
110
|
+
body:
|
111
|
+
string: ""
|
112
|
+
http_version:
|
113
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
114
|
+
- request:
|
115
|
+
method: post
|
116
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects
|
117
|
+
body:
|
118
|
+
string: "{\"name\":\"Petshop App\"}"
|
119
|
+
headers:
|
120
|
+
Accept:
|
121
|
+
- application/json
|
122
|
+
Content-Type:
|
123
|
+
- application/json
|
124
|
+
response:
|
125
|
+
status:
|
126
|
+
code: 200
|
127
|
+
message: OK
|
128
|
+
headers:
|
129
|
+
Date:
|
130
|
+
- Sat, 19 Apr 2014 18:41:02 GMT
|
131
|
+
Transfer-Encoding:
|
132
|
+
- chunked
|
133
|
+
Server:
|
134
|
+
- Apache-Coyote/1.1
|
135
|
+
Set-Cookie:
|
136
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
137
|
+
- TCSESSIONID=354CDB7237F0FA2ECF3E1D98B4FA29EC; Path=/; HttpOnly
|
138
|
+
Content-Type:
|
139
|
+
- application/json
|
140
|
+
Pragma:
|
141
|
+
- no-cache
|
142
|
+
Expires:
|
143
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
144
|
+
Cache-Control:
|
145
|
+
- no-cache
|
146
|
+
- no-store
|
147
|
+
body:
|
148
|
+
string: "{\"id\":\"PetshopApp\",\"name\":\"Petshop App\",\"href\":\"/httpAuth/app/rest/projects/id:PetshopApp\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=PetshopApp\",\"parentProjectId\":\"_Root\"}"
|
149
|
+
http_version:
|
150
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
151
|
+
- request:
|
152
|
+
method: get
|
153
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects/name:Petshop%20App
|
154
|
+
body:
|
155
|
+
string: ""
|
156
|
+
headers:
|
157
|
+
Accept:
|
158
|
+
- application/json
|
159
|
+
Content-Type:
|
160
|
+
- application/json
|
161
|
+
response:
|
162
|
+
status:
|
163
|
+
code: 200
|
164
|
+
message: OK
|
165
|
+
headers:
|
166
|
+
Date:
|
167
|
+
- Sat, 19 Apr 2014 18:41:02 GMT
|
168
|
+
Transfer-Encoding:
|
169
|
+
- chunked
|
170
|
+
Server:
|
171
|
+
- Apache-Coyote/1.1
|
172
|
+
Set-Cookie:
|
173
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
174
|
+
- TCSESSIONID=06DBE7144BD06345E4887A65A25463FC; Path=/; HttpOnly
|
175
|
+
Content-Type:
|
176
|
+
- application/json
|
177
|
+
Pragma:
|
178
|
+
- no-cache
|
179
|
+
Expires:
|
180
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
181
|
+
Cache-Control:
|
182
|
+
- no-cache
|
183
|
+
- no-store
|
184
|
+
body:
|
185
|
+
string: "{\"id\":\"PetshopApp\",\"name\":\"Petshop App\",\"href\":\"/httpAuth/app/rest/projects/id:PetshopApp\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=PetshopApp\",\"parentProjectId\":\"_Root\"}"
|
186
|
+
http_version:
|
187
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
data/spec/cassettes/TeamcityRuby_Project/lists_all_projects_including_root_built_in_on_TeamCity_.yml
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.4.0
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: get
|
6
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects
|
7
|
+
body:
|
8
|
+
string: ""
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Date:
|
20
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
Set-Cookie:
|
26
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
27
|
+
- TCSESSIONID=DFEF9E023B09AEF4B353611E0784AE3E; Path=/; HttpOnly
|
28
|
+
Content-Type:
|
29
|
+
- application/json
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Expires:
|
33
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
34
|
+
Cache-Control:
|
35
|
+
- no-cache
|
36
|
+
- no-store
|
37
|
+
body:
|
38
|
+
string: "{\"project\":[{\"id\":\"_Root\",\"name\":\"<Root project>\",\"href\":\"/httpAuth/app/rest/projects/id:_Root\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=_Root\"},{\"id\":\"SampleProject\",\"name\":\"Sample Project\",\"href\":\"/httpAuth/app/rest/projects/id:SampleProject\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=SampleProject\",\"parentProjectId\":\"_Root\"}]}"
|
39
|
+
http_version:
|
40
|
+
recorded_at: Sat, 19 Apr 2014 18:38:16 GMT
|
41
|
+
- request:
|
42
|
+
method: delete
|
43
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects/id:_Root
|
44
|
+
body:
|
45
|
+
string: ""
|
46
|
+
headers:
|
47
|
+
Accept:
|
48
|
+
- application/json
|
49
|
+
Content-Type:
|
50
|
+
- application/json
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 403
|
54
|
+
message: Forbidden
|
55
|
+
headers:
|
56
|
+
Date:
|
57
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
58
|
+
Transfer-Encoding:
|
59
|
+
- chunked
|
60
|
+
Server:
|
61
|
+
- Apache-Coyote/1.1
|
62
|
+
Set-Cookie:
|
63
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
64
|
+
- TCSESSIONID=2A0820E930220197122D28B70A231451; Path=/; HttpOnly
|
65
|
+
Content-Type:
|
66
|
+
- text/plain
|
67
|
+
Pragma:
|
68
|
+
- no-cache
|
69
|
+
Expires:
|
70
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
71
|
+
Cache-Control:
|
72
|
+
- no-cache
|
73
|
+
- no-store
|
74
|
+
body:
|
75
|
+
string: |-
|
76
|
+
Error has occurred during request processing (Forbidden).
|
77
|
+
Error: jetbrains.buildServer.serverSide.auth.AccessDeniedException: Root project cannot be removed
|
78
|
+
Access denied. Check the user has enough permissions to perform the operation.
|
79
|
+
http_version:
|
80
|
+
recorded_at: Sat, 19 Apr 2014 18:38:16 GMT
|
81
|
+
- request:
|
82
|
+
method: delete
|
83
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects/id:SampleProject
|
84
|
+
body:
|
85
|
+
string: ""
|
86
|
+
headers:
|
87
|
+
Accept:
|
88
|
+
- application/json
|
89
|
+
Content-Type:
|
90
|
+
- application/json
|
91
|
+
response:
|
92
|
+
status:
|
93
|
+
code: 204
|
94
|
+
message: No Content
|
95
|
+
headers:
|
96
|
+
Date:
|
97
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
98
|
+
Server:
|
99
|
+
- Apache-Coyote/1.1
|
100
|
+
Set-Cookie:
|
101
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
102
|
+
- TCSESSIONID=2BF4FB483161FE0C99BDA59D655A031A; Path=/; HttpOnly
|
103
|
+
Pragma:
|
104
|
+
- no-cache
|
105
|
+
Expires:
|
106
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
107
|
+
Cache-Control:
|
108
|
+
- no-cache
|
109
|
+
- no-store
|
110
|
+
body:
|
111
|
+
string: ""
|
112
|
+
http_version:
|
113
|
+
recorded_at: Sat, 19 Apr 2014 18:38:16 GMT
|
114
|
+
- request:
|
115
|
+
method: post
|
116
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects
|
117
|
+
body:
|
118
|
+
string: "{\"name\":\"Project 1\"}"
|
119
|
+
headers:
|
120
|
+
Accept:
|
121
|
+
- application/json
|
122
|
+
Content-Type:
|
123
|
+
- application/json
|
124
|
+
response:
|
125
|
+
status:
|
126
|
+
code: 200
|
127
|
+
message: OK
|
128
|
+
headers:
|
129
|
+
Date:
|
130
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
131
|
+
Transfer-Encoding:
|
132
|
+
- chunked
|
133
|
+
Server:
|
134
|
+
- Apache-Coyote/1.1
|
135
|
+
Set-Cookie:
|
136
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
137
|
+
- TCSESSIONID=1453D6C1AF0183680D88E98A668E4563; Path=/; HttpOnly
|
138
|
+
Content-Type:
|
139
|
+
- application/json
|
140
|
+
Pragma:
|
141
|
+
- no-cache
|
142
|
+
Expires:
|
143
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
144
|
+
Cache-Control:
|
145
|
+
- no-cache
|
146
|
+
- no-store
|
147
|
+
body:
|
148
|
+
string: "{\"id\":\"Project1\",\"name\":\"Project 1\",\"href\":\"/httpAuth/app/rest/projects/id:Project1\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=Project1\",\"parentProjectId\":\"_Root\"}"
|
149
|
+
http_version:
|
150
|
+
recorded_at: Sat, 19 Apr 2014 18:38:16 GMT
|
151
|
+
- request:
|
152
|
+
method: post
|
153
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects
|
154
|
+
body:
|
155
|
+
string: "{\"name\":\"Project 2\"}"
|
156
|
+
headers:
|
157
|
+
Accept:
|
158
|
+
- application/json
|
159
|
+
Content-Type:
|
160
|
+
- application/json
|
161
|
+
response:
|
162
|
+
status:
|
163
|
+
code: 200
|
164
|
+
message: OK
|
165
|
+
headers:
|
166
|
+
Date:
|
167
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
168
|
+
Transfer-Encoding:
|
169
|
+
- chunked
|
170
|
+
Server:
|
171
|
+
- Apache-Coyote/1.1
|
172
|
+
Set-Cookie:
|
173
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
174
|
+
- TCSESSIONID=E98FB8EBDECE806BC3C79248216BC4D9; Path=/; HttpOnly
|
175
|
+
Content-Type:
|
176
|
+
- application/json
|
177
|
+
Pragma:
|
178
|
+
- no-cache
|
179
|
+
Expires:
|
180
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
181
|
+
Cache-Control:
|
182
|
+
- no-cache
|
183
|
+
- no-store
|
184
|
+
body:
|
185
|
+
string: "{\"id\":\"Project2\",\"name\":\"Project 2\",\"href\":\"/httpAuth/app/rest/projects/id:Project2\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=Project2\",\"parentProjectId\":\"_Root\"}"
|
186
|
+
http_version:
|
187
|
+
recorded_at: Sat, 19 Apr 2014 18:38:16 GMT
|
188
|
+
- request:
|
189
|
+
method: get
|
190
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects
|
191
|
+
body:
|
192
|
+
string: ""
|
193
|
+
headers:
|
194
|
+
Accept:
|
195
|
+
- application/json
|
196
|
+
Content-Type:
|
197
|
+
- application/json
|
198
|
+
response:
|
199
|
+
status:
|
200
|
+
code: 200
|
201
|
+
message: OK
|
202
|
+
headers:
|
203
|
+
Date:
|
204
|
+
- Sat, 19 Apr 2014 18:41:01 GMT
|
205
|
+
Transfer-Encoding:
|
206
|
+
- chunked
|
207
|
+
Server:
|
208
|
+
- Apache-Coyote/1.1
|
209
|
+
Set-Cookie:
|
210
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
211
|
+
- TCSESSIONID=F042D890C91EF86317A4A833DB25297B; Path=/; HttpOnly
|
212
|
+
Content-Type:
|
213
|
+
- application/json
|
214
|
+
Pragma:
|
215
|
+
- no-cache
|
216
|
+
Expires:
|
217
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
218
|
+
Cache-Control:
|
219
|
+
- no-cache
|
220
|
+
- no-store
|
221
|
+
body:
|
222
|
+
string: "{\"project\":[{\"id\":\"_Root\",\"name\":\"<Root project>\",\"href\":\"/httpAuth/app/rest/projects/id:_Root\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=_Root\"},{\"id\":\"Project1\",\"name\":\"Project 1\",\"href\":\"/httpAuth/app/rest/projects/id:Project1\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=Project1\",\"parentProjectId\":\"_Root\"},{\"id\":\"Project2\",\"name\":\"Project 2\",\"href\":\"/httpAuth/app/rest/projects/id:Project2\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=Project2\",\"parentProjectId\":\"_Root\"}]}"
|
223
|
+
http_version:
|
224
|
+
recorded_at: Sat, 19 Apr 2014 18:38:16 GMT
|
@@ -0,0 +1,151 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.4.0
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: get
|
6
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
|
7
|
+
body:
|
8
|
+
string: ""
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Date:
|
20
|
+
- Sat, 19 Apr 2014 18:41:02 GMT
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
Set-Cookie:
|
26
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
27
|
+
- TCSESSIONID=8DD56D732A6BF74BB2288A5F1009ECC1; Path=/; HttpOnly
|
28
|
+
Content-Type:
|
29
|
+
- application/json
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Expires:
|
33
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
34
|
+
Cache-Control:
|
35
|
+
- no-cache
|
36
|
+
- no-store
|
37
|
+
body:
|
38
|
+
string: "{\"count\":0,\"vcs-root\":[]}"
|
39
|
+
http_version:
|
40
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
41
|
+
- request:
|
42
|
+
method: post
|
43
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
|
44
|
+
body:
|
45
|
+
string: "{\"name\":\"VCS Root 1\",\"properties\":{\"property\":[{\"value\":\"git@example.com/repo.git\",\"name\":\"url\"}]},\"projectLocator\":\"id:_Root\",\"vcsName\":\"jetbrains.git\"}"
|
46
|
+
headers:
|
47
|
+
Accept:
|
48
|
+
- application/json
|
49
|
+
Content-Type:
|
50
|
+
- application/json
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
Date:
|
57
|
+
- Sat, 19 Apr 2014 18:41:02 GMT
|
58
|
+
Transfer-Encoding:
|
59
|
+
- chunked
|
60
|
+
Server:
|
61
|
+
- Apache-Coyote/1.1
|
62
|
+
Set-Cookie:
|
63
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
64
|
+
- TCSESSIONID=03988E0B58533A2C1FCA9C621DD460C8; Path=/; HttpOnly
|
65
|
+
Content-Type:
|
66
|
+
- application/json
|
67
|
+
Pragma:
|
68
|
+
- no-cache
|
69
|
+
Expires:
|
70
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
71
|
+
Cache-Control:
|
72
|
+
- no-cache
|
73
|
+
- no-store
|
74
|
+
body:
|
75
|
+
string: "{\"id\":\"Root_VcsRoot1\",\"name\":\"VCS Root 1\",\"vcsName\":\"jetbrains.git\",\"status\":\"NOT_MONITORED\",\"lastChecked\":\"20140419T173243+0000\",\"href\":\"/httpAuth/app/rest/vcs-roots/id:Root_VcsRoot1\",\"project\":{\"id\":\"_Root\",\"name\":\"<Root project>\",\"href\":\"/httpAuth/app/rest/projects/id:_Root\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=_Root\"},\"properties\":{\"property\":[{\"name\":\"url\",\"value\":\"git@example.com/repo.git\"}]},\"vcsRootInstances\":{\"href\":\"/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:Root_VcsRoot1)\"}}"
|
76
|
+
http_version:
|
77
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
78
|
+
- request:
|
79
|
+
method: post
|
80
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
|
81
|
+
body:
|
82
|
+
string: "{\"name\":\"VCS Root 2\",\"properties\":{\"property\":[{\"value\":\"git@example.com/repo.git\",\"name\":\"url\"}]},\"projectLocator\":\"id:_Root\",\"vcsName\":\"jetbrains.git\"}"
|
83
|
+
headers:
|
84
|
+
Accept:
|
85
|
+
- application/json
|
86
|
+
Content-Type:
|
87
|
+
- application/json
|
88
|
+
response:
|
89
|
+
status:
|
90
|
+
code: 200
|
91
|
+
message: OK
|
92
|
+
headers:
|
93
|
+
Date:
|
94
|
+
- Sat, 19 Apr 2014 18:41:02 GMT
|
95
|
+
Transfer-Encoding:
|
96
|
+
- chunked
|
97
|
+
Server:
|
98
|
+
- Apache-Coyote/1.1
|
99
|
+
Set-Cookie:
|
100
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
101
|
+
- TCSESSIONID=696A8E5AE880ABE14FA316F240E2CFA2; Path=/; HttpOnly
|
102
|
+
Content-Type:
|
103
|
+
- application/json
|
104
|
+
Pragma:
|
105
|
+
- no-cache
|
106
|
+
Expires:
|
107
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
108
|
+
Cache-Control:
|
109
|
+
- no-cache
|
110
|
+
- no-store
|
111
|
+
body:
|
112
|
+
string: "{\"id\":\"Root_VcsRoot2\",\"name\":\"VCS Root 2\",\"vcsName\":\"jetbrains.git\",\"status\":\"NOT_MONITORED\",\"lastChecked\":\"20140419T173243+0000\",\"href\":\"/httpAuth/app/rest/vcs-roots/id:Root_VcsRoot2\",\"project\":{\"id\":\"_Root\",\"name\":\"<Root project>\",\"href\":\"/httpAuth/app/rest/projects/id:_Root\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=_Root\"},\"properties\":{\"property\":[{\"name\":\"url\",\"value\":\"git@example.com/repo.git\"}]},\"vcsRootInstances\":{\"href\":\"/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:Root_VcsRoot2)\"}}"
|
113
|
+
http_version:
|
114
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
115
|
+
- request:
|
116
|
+
method: get
|
117
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
|
118
|
+
body:
|
119
|
+
string: ""
|
120
|
+
headers:
|
121
|
+
Accept:
|
122
|
+
- application/json
|
123
|
+
Content-Type:
|
124
|
+
- application/json
|
125
|
+
response:
|
126
|
+
status:
|
127
|
+
code: 200
|
128
|
+
message: OK
|
129
|
+
headers:
|
130
|
+
Date:
|
131
|
+
- Sat, 19 Apr 2014 18:41:02 GMT
|
132
|
+
Transfer-Encoding:
|
133
|
+
- chunked
|
134
|
+
Server:
|
135
|
+
- Apache-Coyote/1.1
|
136
|
+
Set-Cookie:
|
137
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
138
|
+
- TCSESSIONID=5F88302CB09885BEB323E4850B857478; Path=/; HttpOnly
|
139
|
+
Content-Type:
|
140
|
+
- application/json
|
141
|
+
Pragma:
|
142
|
+
- no-cache
|
143
|
+
Expires:
|
144
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
145
|
+
Cache-Control:
|
146
|
+
- no-cache
|
147
|
+
- no-store
|
148
|
+
body:
|
149
|
+
string: "{\"count\":2,\"vcs-root\":[{\"id\":\"Root_VcsRoot1\",\"name\":\"VCS Root 1\",\"href\":\"/httpAuth/app/rest/vcs-roots/id:Root_VcsRoot1\"},{\"id\":\"Root_VcsRoot2\",\"name\":\"VCS Root 2\",\"href\":\"/httpAuth/app/rest/vcs-roots/id:Root_VcsRoot2\"}]}"
|
150
|
+
http_version:
|
151
|
+
recorded_at: Sat, 19 Apr 2014 18:38:17 GMT
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'teamcity_ruby'
|
5
|
+
|
6
|
+
require 'vcr'
|
7
|
+
|
8
|
+
VCR.configure do |c|
|
9
|
+
c.cassette_library_dir = 'spec/cassettes'
|
10
|
+
c.hook_into :webmock
|
11
|
+
c.configure_rspec_metadata!
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec.configure do |c|
|
15
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
16
|
+
end
|
17
|
+
|
18
|
+
TeamcityRuby.configure do |c|
|
19
|
+
c.base_uri 'http://localhost:8111/httpAuth/app/rest/'
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_all_projects
|
23
|
+
TeamcityRuby::Project.all.each do |p|
|
24
|
+
p.destroy!
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_all_vcs_roots
|
29
|
+
TeamcityRuby::VcsRoot.all.each do |p|
|
30
|
+
p.destroy!
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module TeamcityRuby
|
4
|
+
describe BuildConfiguration do
|
5
|
+
before do
|
6
|
+
delete_all_projects
|
7
|
+
delete_all_vcs_roots
|
8
|
+
@project = Project.create("Sample Project")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "lists all build configurations", :vcr do
|
12
|
+
build_configuration_names = ["Build Configuration 1", "Build Configuration 2"]
|
13
|
+
|
14
|
+
build_configuration_names.each do |b|
|
15
|
+
build_configuration = BuildConfiguration.create(b, :project_id => @project.teamcity_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
BuildConfiguration.all.map(&:name).should == build_configuration_names
|
19
|
+
end
|
20
|
+
|
21
|
+
it "fetches a specific build configuration by id", :vcr do
|
22
|
+
build_configuration = BuildConfiguration.create("Sample Build Configuration", :project_id => @project.teamcity_id)
|
23
|
+
|
24
|
+
BuildConfiguration.find(:id => build_configuration.teamcity_id).should == build_configuration
|
25
|
+
end
|
26
|
+
|
27
|
+
context "a existing build configuration" do
|
28
|
+
let(:build_configuration) { BuildConfiguration.create("Sample Build Configuration", :project_id => @project.teamcity_id) }
|
29
|
+
|
30
|
+
it "can get a vcs root attached with specific checkout rules", :vcr do
|
31
|
+
vcs_root = VcsRoot.create(:name => "Sample VCS Root")
|
32
|
+
checkout_rules = "+:trunk => ."
|
33
|
+
|
34
|
+
build_configuration.attach_vcs_root(vcs_root.teamcity_id, checkout_rules)
|
35
|
+
|
36
|
+
build_configuration.vcs_root_entries.should == [{ :vcs_root_id => vcs_root.teamcity_id, :checkout_rules => checkout_rules }]
|
37
|
+
end
|
38
|
+
|
39
|
+
it "can get a build step added to it", :vcr do
|
40
|
+
build_configuration.add_step(:name => "Sample Step", :type => "Maven") do |s|
|
41
|
+
s['goals'] = 'verify'
|
42
|
+
end
|
43
|
+
|
44
|
+
created_build_step = build_configuration.steps.find { |s| s.name == 'Sample Step' }
|
45
|
+
created_build_step.type.should == 'Maven'
|
46
|
+
created_build_step.properties.should include({"goals" => "verify"})
|
47
|
+
end
|
48
|
+
|
49
|
+
it "can get a build trigger added to it", :vcr do
|
50
|
+
build_configuration.add_trigger(:type => "vcsTrigger") do |t|
|
51
|
+
t["perCheckinTriggering"] = "true"
|
52
|
+
end
|
53
|
+
|
54
|
+
created_build_trigger = build_configuration.triggers.find { |s| s.type == 'vcsTrigger' }
|
55
|
+
created_build_trigger.properties.should include({"perCheckinTriggering" => "true"})
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TeamCity::ElementBuilder do
|
4
|
+
it 'outputs json following TeamCity convention for elements and properties' do
|
5
|
+
builder = TeamCity::ElementBuilder.new(:attr1 => 'x') do |properties|
|
6
|
+
properties['property1'] = 'z'
|
7
|
+
end
|
8
|
+
|
9
|
+
JSON.parse(builder.to_request_body).should == {
|
10
|
+
"attr1" => "x",
|
11
|
+
"properties" => {
|
12
|
+
"property" => [
|
13
|
+
{
|
14
|
+
"name" => "property1",
|
15
|
+
"value" => "z"
|
16
|
+
}
|
17
|
+
]
|
18
|
+
}
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'outputs json following TeamCity convention for elements even if no properties are defined' do
|
23
|
+
builder = TeamCity::ElementBuilder.new(:attr1 => 'x')
|
24
|
+
|
25
|
+
JSON.parse(builder.to_request_body).should == {
|
26
|
+
"attr1" => "x", "properties" => { "property" => [] }
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|