Class: TeamcityRuby::BuildConfiguration
- Inherits:
-
Object
- Object
- TeamcityRuby::BuildConfiguration
show all
- Extended by:
- Resource
- Defined in:
- lib/teamcity_ruby/build_configuration.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Resource
all, client, extended, find, locator, resource_name, url_path
Constructor Details
Returns a new instance of BuildConfiguration.
17
18
19
20
21
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 17
def initialize(options = {})
@teamcity_id = options["id"]
@name = options["name"]
@project_id = options["projectId"]
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 5
def name
@name
end
|
#project_id ⇒ Object
Returns the value of attribute project_id.
5
6
7
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 5
def project_id
@project_id
end
|
#teamcity_id ⇒ Object
Returns the value of attribute teamcity_id.
5
6
7
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 5
def teamcity_id
@teamcity_id
end
|
Class Method Details
.create(name, options = {}) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 10
def self.create(name, options = {})
payload = { "name" => name }.to_json
project_id = options.fetch(:project_id) { raise ":project_id is required" }
response = client.post("/projects/id:#{project_id}/buildTypes", :body => payload)
new(response)
end
|
Instance Method Details
#add_step(options = {}, &block) ⇒ Object
36
37
38
39
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 36
def add_step(options = {}, &block)
attributes = { "name" => options[:name], "type" => options[:type] }
post_with_properties("/buildTypes/id:#{teamcity_id}/steps", attributes, &block)
end
|
#add_trigger(options = {}, &block) ⇒ Object
45
46
47
48
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 45
def add_trigger(options = {}, &block)
attributes = { "type" => options[:type] }
post_with_properties("/buildTypes/id:#{teamcity_id}/triggers", attributes, &block)
end
|
#attach_vcs_root(vcs_root_id, checkout_rules) ⇒ Object
23
24
25
26
27
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 23
def attach_vcs_root(vcs_root_id, checkout_rules)
payload = { "vcs-root" => { "id" => vcs_root_id }, "checkout-rules" => checkout_rules }
response = client.post("/buildTypes/id:#{teamcity_id}/vcs-root-entries", :body => payload.to_json)
response["id"]
end
|
#steps ⇒ Object
41
42
43
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 41
def steps
get_with_properties("/buildTypes/id:#{teamcity_id}/steps")
end
|
#triggers ⇒ Object
50
51
52
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 50
def triggers
get_with_properties("/buildTypes/id:#{teamcity_id}/triggers")
end
|
#vcs_root_entries ⇒ Object
29
30
31
32
33
34
|
# File 'lib/teamcity_ruby/build_configuration.rb', line 29
def vcs_root_entries
response = client.get("/buildTypes/id:#{teamcity_id}/vcs-root-entries")["vcs-root-entry"]
response.map do |i|
{ :vcs_root_id => i["vcs-root"]["id"], :checkout_rules => i["checkout-rules"] }
end
end
|