teamcity-ruby-client 0.2.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmM2N2RlMmE3MDVlOTM4NjVlYmI5ZTgyNjRhNDAzY2FhNWM2YjZiYw==
4
+ ZWU0MjFkYjg3ZmJlYjAxZDI4ZTZmYjg1M2QwNjFkZGI2MGFhYjIyMA==
5
5
  data.tar.gz: !binary |-
6
- MzE2NGViZjYxNzNkY2VmY2ViYTliYzJmYWIwZGU0MDVkZGYyYjMyYg==
6
+ Mzk5YzAyODJkZmVhZjAzYmQ5NzE2NWZkZDcxOTMxNTc0YjRlNDg1NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGI0MWYxNGY0YmU1ZDNhNzc3ZmVlODIxZTRmMjE0NGNkMTk4YjllMDNkZDY4
10
- NDcxOTM3ZTg0ZGZjOWIxMWVhN2U1MDc1ZTQ2M2JmMWQxMGFkODBjMzRiNGMz
11
- ZjZmM2E0YzlmOWIzNDdmYzg2YmY5MDNiYzdjZjczNTBlNzRlMWE=
9
+ MDY3ZTBmODViMzFiMTI0YWRmMGJhYjM1ZGJkMTczZTU0MTk3NTQzZjQwNzhi
10
+ MGI2MDFhZGQ0MGM1NDcwYjU3ZWM2MjhmODUxMzhhZWFjYzJmMjg0ZWJjOTY1
11
+ MDhiMDk3MTJhZDBjY2U4YTAxYTY2YmY4ZWIzODQ3OGRjNDI4N2Y=
12
12
  data.tar.gz: !binary |-
13
- ZDJhZTBjNzQ2NjU3MTcwOTFmYzY0MzU0M2NiOWM5YTU5ZWUwOTY1NjQzNmMw
14
- YzdhNDYwYzBjMDY2ZWE0YzgwYzg4ODVmM2RmZWFlODQ5YTQyZjFiMmE4NjJi
15
- OTM4ZTEwZTNkMzMzYjUzMTMzMjg3ZDg4Njg3ZTJhYjc2ZWFkZDQ=
13
+ ZjZhZmRhNDA3N2QxNGZhMTdkNjU2MzJmMjY3ZDk1MjE5NDI1MmI4NmE0ZTc3
14
+ MTEyMjZkZjI5ODc0ZTM0MTlmMDkzOWQ0MzY3MWY1N2IzZmI2NzJhNDNlNTY4
15
+ YmFlNTJiZjRmN2RiY2NlOWExMjEzNzE1MWY3MzQ1ZTgxMjJiZGE=
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## 0.1.0 (April 28, 2012)
1
+ ## 0.2.0 (May 7, 2013)
2
+
3
+ - added support for httpAuth
4
+ - added several CRUD methods to the api for BuildTypes, Projects, and VCSRoots
5
+ - code cleanup
6
+
7
+ ## 0.1.0 (April 28, 2013)
2
8
 
3
9
  Features:
4
10
 
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  * Tested on TeamCity 7.0 and higher
22
22
  * Most of the api calls return either an array of Hashie::Mash objects or a single Hashie::Mash object which allows you to send messages to retreive an attribute easily.
23
- * See the spec tests for more examples
23
+ * See [api docs](http://rubydoc.info/gems/teamcity-ruby-client/TeamCity/Client) or [specs](spec/teamcity/client) for additional examples and usage
24
24
 
25
25
  ### Configuration
26
26
 
@@ -29,11 +29,12 @@ Or install it yourself as:
29
29
  ```ruby
30
30
  require 'teamcity'
31
31
 
32
- # Currently only guest authentication is supported, next version will
33
- # support authentication which will allow write api calls. This only needs
34
- # to be set once per Ruby execution.
32
+ # This only needs to be set once per Ruby execution.
33
+ # You may use guestAuth instead of httpAuth and omit the use of http_user and http_password
35
34
  TeamCity.configure do |config|
36
- config.endpoint = 'http://my-teamcity-server:8111/guestAuth/app/rest'
35
+ config.endpoint = 'http://my-teamcity-server:8111/httpAuth/app/rest'
36
+ config.http_user = 'teamcity-user'
37
+ config.http_password = 'teamcity-password'
37
38
  end
38
39
  ```
39
40
 
@@ -53,6 +54,18 @@ puts TeamCity.project_buildtypes(id: 'project1')
53
54
  # to retreive an attribute easily. For example, get the name of
54
55
  # the first buildtype in a project
55
56
  puts TeamCity.project_buildtypes(id: 'project1').first.name
57
+
58
+ # Create an empty project
59
+ TeamCity.create_project('my-new-project')
60
+
61
+ # Copy a project
62
+ TeamCity.copy_project('project1', 'copied-project-name')
63
+
64
+ # Delete a project
65
+ TeamCity.delete_project('project1')
66
+
67
+ # Change project name
68
+ TeamCity.set_project_field('project1', 'name', 'new-project-name')
56
69
  ```
57
70
 
58
71
  ### Build Types (Build Configurations)
@@ -67,7 +80,8 @@ puts TeamCity.buildtype(id: 'bt1')
67
80
  # Get buildtype steps
68
81
  puts TeamCity.buildtype_steps(id: 'bt1')
69
82
 
70
- # See the api docs for more api calls
83
+ # Change buildtype name
84
+ TeamCity.set_buildtype_field('bt1', 'name', 'new-buildtype-name')
71
85
  ```
72
86
 
73
87
  ### Builds ###
@@ -96,11 +110,30 @@ puts TeamCity.build(id: TeamCity.builds(count: 1).first.id).buildType.name # Fet
96
110
 
97
111
  ```
98
112
 
113
+ ### VCS Roots ###
114
+
115
+ ```ruby
116
+ # Get all the vcs roots
117
+ puts Teamcity.vcs_roots
118
+
119
+ # Get vcs root details
120
+ puts TeamCity.vcs_root_details(1)
121
+
122
+ # Create VCS Root for a project
123
+ TeamCity.create_vcs_root('my-git-vcs-root', 'git', :projectLocator => 'project2') do |properties|
124
+ properties['branch'] = 'master'
125
+ properties['url'] = 'git@github.com:jperry/teamcity-ruby-client.git'
126
+ properties['authMethod'] = 'PRIVATE_KEY_DEFAULT'
127
+ properties['ignoreKnownHosts'] = true
128
+ end
129
+
130
+ ```
131
+
99
132
  ## Documentation
100
133
 
101
134
  ### API Docs
102
135
 
103
- [Latest](http://rubydoc.info/gems/teamcity-ruby-client/0.1.0/frames)
136
+ [Latest](http://rubydoc.info/gems/teamcity-ruby-client/)
104
137
 
105
138
  ### Generating API Docs
106
139
 
@@ -180,6 +180,26 @@ module TeamCity
180
180
  path = "buildTypes/#{buildtype_id}/#{field_name}"
181
181
  put_text_request(path, field_value)
182
182
  end
183
+
184
+ # Delete buildtype (build configuration)
185
+ #
186
+ # @param buildtype_id [String] the id of the buildtype
187
+ # @return [nil]
188
+ def delete_buildtype(buildtype_id)
189
+ delete("buildTypes/#{buildtype_id}")
190
+ end
191
+
192
+ # Set build step field
193
+ #
194
+ # @param buildtype_id [String] the id of the buildtype
195
+ # @param step_id [String] the id of the build step
196
+ # @param field_name [String] the name of the field to set
197
+ # @param field_value [String] the value to set the field name to
198
+ # @return [nil]
199
+ def set_build_step_field(buildtype_id, step_id, field_name, field_value)
200
+ path = "buildTypes/#{buildtype_id}/steps/#{step_id}/#{field_name}"
201
+ put_text_request(path, field_value)
202
+ end
183
203
  end
184
204
  end
185
205
  end
@@ -1,3 +1,3 @@
1
1
  module TeamCity
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/7.0/buildTypes/bt8
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - TeamCity Ruby Client 0.2.0
14
+ response:
15
+ status:
16
+ code: 204
17
+ message: No Content
18
+ headers:
19
+ Server:
20
+ - Apache-Coyote/1.1
21
+ Set-Cookie:
22
+ - JSESSIONID=CC41A2976701126792F604C8CD56E27D; Path=/; HttpOnly
23
+ - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
24
+ Pragma:
25
+ - no-cache
26
+ Expires:
27
+ - Thu, 01 Jan 1970 00:00:00 GMT
28
+ Cache-Control:
29
+ - no-cache
30
+ - no-store
31
+ Date:
32
+ - Thu, 16 May 2013 18:59:17 GMT
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ''
36
+ http_version:
37
+ recorded_at: Thu, 16 May 2013 18:59:17 GMT
38
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/7.0/buildTypes/bt3/steps/RUNNER_2/disabled
6
+ body:
7
+ encoding: US-ASCII
8
+ string: 'true'
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - TeamCity Ruby Client 0.2.0
14
+ Content-Type:
15
+ - text/plain
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: No Content
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Set-Cookie:
24
+ - JSESSIONID=DCB23406908AA67E6F99690A9550942D; Path=/; HttpOnly
25
+ - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
26
+ Pragma:
27
+ - no-cache
28
+ Expires:
29
+ - Thu, 01 Jan 1970 00:00:00 GMT
30
+ Cache-Control:
31
+ - no-cache
32
+ - no-store
33
+ Date:
34
+ - Fri, 17 May 2013 13:53:19 GMT
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ''
38
+ http_version:
39
+ recorded_at: Fri, 17 May 2013 13:53:19 GMT
40
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/7.0/buildTypes/bt3/steps/RUNNER_2/disabled
6
+ body:
7
+ encoding: US-ASCII
8
+ string: 'false'
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - TeamCity Ruby Client 0.2.0
14
+ Content-Type:
15
+ - text/plain
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: No Content
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Set-Cookie:
24
+ - JSESSIONID=390FA7EC04A13260A15FA79CB87FF977; Path=/; HttpOnly
25
+ - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
26
+ Pragma:
27
+ - no-cache
28
+ Expires:
29
+ - Thu, 01 Jan 1970 00:00:00 GMT
30
+ Cache-Control:
31
+ - no-cache
32
+ - no-store
33
+ Date:
34
+ - Fri, 17 May 2013 13:53:19 GMT
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ''
38
+ http_version:
39
+ recorded_at: Fri, 17 May 2013 13:53:19 GMT
40
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/7.0/projects/project2/parameters/env.SET_ME
6
+ body:
7
+ encoding: US-ASCII
8
+ string: 'true'
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - TeamCity Ruby Client 0.2.0
14
+ Content-Type:
15
+ - text/plain
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: No Content
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Set-Cookie:
24
+ - JSESSIONID=6E8FE4B770287EF2B629B8558A82A79D; Path=/; HttpOnly
25
+ - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
26
+ Pragma:
27
+ - no-cache
28
+ Expires:
29
+ - Thu, 01 Jan 1970 00:00:00 GMT
30
+ Cache-Control:
31
+ - no-cache
32
+ - no-store
33
+ Date:
34
+ - Thu, 16 May 2013 20:22:28 GMT
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ''
38
+ http_version:
39
+ recorded_at: Thu, 16 May 2013 20:22:28 GMT
40
+ recorded_with: VCR 2.4.0
@@ -133,6 +133,16 @@ describe 'BuildTypes' do
133
133
  @tc.set_buildtype_field('bt3', 'paused', 'true').should be_nil
134
134
  end
135
135
  end
136
+
137
+ describe '.set_build_step_field' do
138
+ it 'should disable a build step' do
139
+ @tc.set_build_step_field('bt3', 'RUNNER_2', 'disabled', 'true')
140
+ end
141
+
142
+ it 'should enable a build step' do
143
+ @tc.set_build_step_field('bt3', 'RUNNER_2', 'disabled', 'false')
144
+ end
145
+ end
136
146
  end
137
147
 
138
148
  describe 'POST', :vcr do
@@ -175,5 +185,11 @@ describe 'BuildTypes' do
175
185
  @tc.delete_agent_requirement('bt3', 'test').should be_nil
176
186
  end
177
187
  end
188
+
189
+ describe '.delete_buildtype' do
190
+ it 'should delete a buildtype' do
191
+ @tc.delete_buildtype('bt8').should be_nil
192
+ end
193
+ end
178
194
  end
179
195
  end
@@ -141,6 +141,10 @@ describe 'Projects' do
141
141
  it 'should set a project parameter' do
142
142
  @tc.set_project_parameter('project2', 'set-this-parameter', 'some-value').should be_nil
143
143
  end
144
+
145
+ it 'should set a project parameter with a boolean value' do
146
+ @tc.set_project_parameter('project2', 'env.SET_ME', 'true')
147
+ end
144
148
  end
145
149
 
146
150
  describe '.set_project_field' do
@@ -29,5 +29,5 @@ Gem::Specification.new do |gem|
29
29
  gem.add_runtime_dependency('faraday_middleware', '~> 0.9.0')
30
30
  gem.add_runtime_dependency('hashie', '~> 2.0.0')
31
31
  gem.add_runtime_dependency('linguistics', '~> 2.0.2')
32
- gem.add_runtime_dependency('builder', '~> 3.2.0')
32
+ gem.add_runtime_dependency('builder', '>=3.0')
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamcity-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Perry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-07 00:00:00.000000000 Z
11
+ date: 2013-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -168,16 +168,16 @@ dependencies:
168
168
  name: builder
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ~>
171
+ - - ! '>='
172
172
  - !ruby/object:Gem::Version
173
- version: 3.2.0
173
+ version: '3.0'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ~>
178
+ - - ! '>='
179
179
  - !ruby/object:Gem::Version
180
- version: 3.2.0
180
+ version: '3.0'
181
181
  description: A Ruby wrapper for the TeamCity Rest API
182
182
  email:
183
183
  - bosoxjay@gmail.com
@@ -206,6 +206,7 @@ files:
206
206
  - lib/teamcity/request.rb
207
207
  - lib/teamcity/version.rb
208
208
  - spec/cassettes/BuildTypes/DELETE/_delete_agent_requirement/should_delete_the_agent_requirement.yml
209
+ - spec/cassettes/BuildTypes/DELETE/_delete_buildtype/should_delete_a_buildtype.yml
209
210
  - spec/cassettes/BuildTypes/DELETE/_delete_buildtype_parameter/should_delete_a_buildtype_parameter.yml
210
211
  - spec/cassettes/BuildTypes/GET/_buildtype/should_fetch_the_details_of_a_buildtype_by_id.yml
211
212
  - spec/cassettes/BuildTypes/GET/_buildtype/should_raise_an_error_if_the_buildtype_does_not_exist.yml
@@ -241,6 +242,8 @@ files:
241
242
  - spec/cassettes/BuildTypes/GET/_buildtypes/should_fetch_all_the_buildtypes.yml
242
243
  - spec/cassettes/BuildTypes/POST/_attach_vcs_root/should_attach_a_vcs_root_to_a_buildtype.yml
243
244
  - spec/cassettes/BuildTypes/POST/_create_agent_requirement/should_create_an_agent_requirement_for_a_buildtype.yml
245
+ - spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_disable_a_build_step.yml
246
+ - spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_enable_a_build_step.yml
244
247
  - spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_pause_a_project.yml
245
248
  - spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_a_projects_description.yml
246
249
  - spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_the_buildtype_name.yml
@@ -270,6 +273,7 @@ files:
270
273
  - spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_name.yml
271
274
  - spec/cassettes/Projects/PUT/_set_project_field/should_un-archive_a_project.yml
272
275
  - spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter.yml
276
+ - spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter_with_a_boolean_value.yml
273
277
  - spec/cassettes/VCSRoots/GET/_vcs_root_details/should_fetch_the_vcs_root_details.yml
274
278
  - spec/cassettes/VCSRoots/GET/_vcs_roots/should_fetch_vcs_roots.yml
275
279
  - spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_shared_vcs_root.yml
@@ -311,6 +315,7 @@ specification_version: 4
311
315
  summary: Ruby wrapper for the TeamCity API
312
316
  test_files:
313
317
  - spec/cassettes/BuildTypes/DELETE/_delete_agent_requirement/should_delete_the_agent_requirement.yml
318
+ - spec/cassettes/BuildTypes/DELETE/_delete_buildtype/should_delete_a_buildtype.yml
314
319
  - spec/cassettes/BuildTypes/DELETE/_delete_buildtype_parameter/should_delete_a_buildtype_parameter.yml
315
320
  - spec/cassettes/BuildTypes/GET/_buildtype/should_fetch_the_details_of_a_buildtype_by_id.yml
316
321
  - spec/cassettes/BuildTypes/GET/_buildtype/should_raise_an_error_if_the_buildtype_does_not_exist.yml
@@ -346,6 +351,8 @@ test_files:
346
351
  - spec/cassettes/BuildTypes/GET/_buildtypes/should_fetch_all_the_buildtypes.yml
347
352
  - spec/cassettes/BuildTypes/POST/_attach_vcs_root/should_attach_a_vcs_root_to_a_buildtype.yml
348
353
  - spec/cassettes/BuildTypes/POST/_create_agent_requirement/should_create_an_agent_requirement_for_a_buildtype.yml
354
+ - spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_disable_a_build_step.yml
355
+ - spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_enable_a_build_step.yml
349
356
  - spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_pause_a_project.yml
350
357
  - spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_a_projects_description.yml
351
358
  - spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_the_buildtype_name.yml
@@ -375,6 +382,7 @@ test_files:
375
382
  - spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_name.yml
376
383
  - spec/cassettes/Projects/PUT/_set_project_field/should_un-archive_a_project.yml
377
384
  - spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter.yml
385
+ - spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter_with_a_boolean_value.yml
378
386
  - spec/cassettes/VCSRoots/GET/_vcs_root_details/should_fetch_the_vcs_root_details.yml
379
387
  - spec/cassettes/VCSRoots/GET/_vcs_roots/should_fetch_vcs_roots.yml
380
388
  - spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_shared_vcs_root.yml