Module: TeamCity::Client::BuildTypes
- Included in:
- TeamCity::Client
- Defined in:
- lib/teamcity/client/build_types.rb
Overview
Defines methods related to build types (or build configurations)
Instance Method Summary collapse
-
#attach_vcs_root(buildtype_id, vcs_root_id) ⇒ Hashie::Mash
Attach a vcs root to a build type (build configuration_).
-
#buildtype(options = {}) ⇒ Hashie::Mash
Get build configuration details.
-
#buildtype_agent_requirements(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration agent_requirements.
-
#buildtype_artifact_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration artifact_dependencies.
-
#buildtype_features(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration features.
-
#buildtype_investigations(buildtype_id) ⇒ Array<Hashie::Mash>
Get investigation info for build configuration.
-
#buildtype_parameters(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration parameters.
-
#buildtype_settings(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration settings.
-
#buildtype_snapshot_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration snapshot_dependencies.
-
#buildtype_state(options = {}) ⇒ String
Get whether the build is paused or not.
-
#buildtype_steps(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration steps.
-
#buildtype_template(options = {}) ⇒ Hashie::Mash?
Get template associated with build configuration.
-
#buildtype_triggers(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration triggers.
-
#buildtype_vcs_root_entries(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration vcs_root_entries.
-
#buildtypes ⇒ Array<Hashie::Mash>?
List of build types.
-
#create_agent_requirement(buildtype_id, parameter_name, parameter_value, condition) ⇒ Hashie::Mash
Create a buildtype agent requirement (Create).
-
#delete_agent_requirement(buildtype_id, parameter_name) ⇒ nil
Delete an agent requirement for a buildtype.
-
#delete_buildtype(buildtype_id) ⇒ nil
Delete buildtype (build configuration).
-
#delete_buildtype_parameter(buildtype_id, parameter_name) ⇒ nil
Delete a buildtype parameter.
-
#set_build_step_field(buildtype_id, step_id, field_name, field_value) ⇒ nil
Set build step field.
-
#set_buildtype_field(buildtype_id, field_name, field_value) ⇒ Object
Set a buildtype field.
-
#set_buildtype_parameter(buildtype_id, parameter_name, parameter_value) ⇒ Object
Set a buildtype parameter (Create or Update).
Instance Method Details
#attach_vcs_root(buildtype_id, vcs_root_id) ⇒ Hashie::Mash
Attach a vcs root to a build type (build configuration_)
110 111 112 113 114 115 116 117 118 119 |
# File 'lib/teamcity/client/build_types.rb', line 110 def attach_vcs_root(buildtype_id, vcs_root_id) builder = Builder::XmlMarkup.new builder.tag!('vcs-root-entry'.to_sym) do |node| node.tag!('vcs-root'.to_sym, :id => vcs_root_id) end post("buildTypes/#{buildtype_id}/vcs-root-entries") do |req| req.headers['Content-Type'] = 'application/xml' req.body = builder.target! end end |
#buildtype(options = {}) ⇒ Hashie::Mash
Get build configuration details
24 25 26 27 |
# File 'lib/teamcity/client/build_types.rb', line 24 def buildtype(={}) () get("buildTypes/#{locator()}") end |
#buildtype_agent_requirements(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration agent_requirements
99 |
# File 'lib/teamcity/client/build_types.rb', line 99 make_method :agent_requirements |
#buildtype_artifact_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration artifact_dependencies
100 |
# File 'lib/teamcity/client/build_types.rb', line 100 make_method :artifact_dependencies |
#buildtype_features(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration features
96 |
# File 'lib/teamcity/client/build_types.rb', line 96 make_method :features |
#buildtype_investigations(buildtype_id) ⇒ Array<Hashie::Mash>
Get investigation info for build configuration
63 64 65 66 |
# File 'lib/teamcity/client/build_types.rb', line 63 def buildtype_investigations(buildtype_id) response = get("buildTypes/#{buildtype_id}/investigations") response['investigation'] end |
#buildtype_parameters(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration parameters
53 54 55 56 57 |
# File 'lib/teamcity/client/build_types.rb', line 53 def buildtype_parameters(={}) () response = get("buildTypes/#{locator()}/parameters") response['property'] end |
#buildtype_settings(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration settings
43 44 45 46 47 |
# File 'lib/teamcity/client/build_types.rb', line 43 def buildtype_settings(={}) () response = get("buildTypes/#{locator()}/settings") response['property'] end |
#buildtype_snapshot_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration snapshot_dependencies
101 |
# File 'lib/teamcity/client/build_types.rb', line 101 make_method :snapshot_dependencies |
#buildtype_state(options = {}) ⇒ String
Get whether the build is paused or not
33 34 35 36 37 |
# File 'lib/teamcity/client/build_types.rb', line 33 def buildtype_state(={}) () path = "buildTypes/#{locator()}/paused" get(path, :accept => :text, :content_type => :text) end |
#buildtype_steps(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration steps
98 |
# File 'lib/teamcity/client/build_types.rb', line 98 make_method :steps |
#buildtype_template(options = {}) ⇒ Hashie::Mash?
Get template associated with build configuration
72 73 74 75 76 77 78 79 |
# File 'lib/teamcity/client/build_types.rb', line 72 def buildtype_template(={}) () begin get("buildTypes/#{locator()}/template") rescue StandardError => e /No template associated/.match(e.to_s) ? nil : raise end end |
#buildtype_triggers(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration triggers
97 |
# File 'lib/teamcity/client/build_types.rb', line 97 make_method :triggers |
#buildtype_vcs_root_entries(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration vcs_root_entries
102 |
# File 'lib/teamcity/client/build_types.rb', line 102 make_method :vcs_root_entries |
#buildtypes ⇒ Array<Hashie::Mash>?
List of build types
15 16 17 18 |
# File 'lib/teamcity/client/build_types.rb', line 15 def buildtypes response = get('buildTypes') response['buildType'] end |
#create_agent_requirement(buildtype_id, parameter_name, parameter_value, condition) ⇒ Hashie::Mash
Check the TeamCity UI for supported conditions
Create a buildtype agent requirement (Create)
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/teamcity/client/build_types.rb', line 157 def create_agent_requirement(buildtype_id, parameter_name, parameter_value, condition) builder = Builder::XmlMarkup.new builder.tag!('agent-requirement'.to_sym, :id => parameter_name, :type => condition) do |node| node.properties do |p| p.property(:name => 'property-name', :value => parameter_name) p.property(:name => 'property-value', :value => parameter_value) end end path = "buildTypes/#{buildtype_id}/agent-requirements" post(path, :accept => :json, :content_type => :xml) do |req| req.body = builder.target! end end |
#delete_agent_requirement(buildtype_id, parameter_name) ⇒ nil
Delete an agent requirement for a buildtype
176 177 178 |
# File 'lib/teamcity/client/build_types.rb', line 176 def delete_agent_requirement(buildtype_id, parameter_name) delete("buildTypes/#{buildtype_id}/agent-requirements/#{parameter_name}") end |
#delete_buildtype(buildtype_id) ⇒ nil
Delete buildtype (build configuration)
204 205 206 |
# File 'lib/teamcity/client/build_types.rb', line 204 def delete_buildtype(buildtype_id) delete("buildTypes/#{buildtype_id}") end |
#delete_buildtype_parameter(buildtype_id, parameter_name) ⇒ nil
Delete a buildtype parameter
140 141 142 143 |
# File 'lib/teamcity/client/build_types.rb', line 140 def delete_buildtype_parameter(buildtype_id, parameter_name) path = "buildTypes/#{buildtype_id}/parameters/#{parameter_name}" delete(path, :accept => :text, :content_type => :text) end |
#set_build_step_field(buildtype_id, step_id, field_name, field_value) ⇒ nil
Set build step field
215 216 217 218 219 220 |
# File 'lib/teamcity/client/build_types.rb', line 215 def set_build_step_field(buildtype_id, step_id, field_name, field_value) path = "buildTypes/#{buildtype_id}/steps/#{step_id}/#{field_name}" put(path, :accept => :text, :content_type => :text) do |req| req.body = field_value end end |
#set_buildtype_field(buildtype_id, field_name, field_value) ⇒ Object
Set a buildtype field
193 194 195 196 197 198 |
# File 'lib/teamcity/client/build_types.rb', line 193 def set_buildtype_field(buildtype_id, field_name, field_value) path = "buildTypes/#{buildtype_id}/#{field_name}" put(path, :accept => :text, :content_type => :text) do |req| req.body = field_value end end |
#set_buildtype_parameter(buildtype_id, parameter_name, parameter_value) ⇒ Object
Set a buildtype parameter (Create or Update)
128 129 130 131 132 133 |
# File 'lib/teamcity/client/build_types.rb', line 128 def set_buildtype_parameter(buildtype_id, parameter_name, parameter_value) path = "buildTypes/#{buildtype_id}/parameters/#{parameter_name}" put(path, :accept => :text, :content_type => :text) do |req| req.body = parameter_value end end |