module TeamCity::Client::VCSRoots
Constants
- VCS_TYPES
Public Instance Methods
create_vcs_root(options = {}, &block)
click to toggle source
Create VCS Root
@option options [String] :vcs_name Name of the vcs root @option options [String] :vcs_type Type of VCS: 'git', 'perforce', etc @option options [String] :project_id to create the vcs root under @yield [Hash] properties to set on the vcs root, view the page source of the vcs root page for the id and value of a property @return [Hashie::Mash] vcs root object that was created
@example Create a Git VCS Root that pulls from master that is only shared with it's project and sub-projecdts and uses the default private key
TeamCity.create_vcs_root(:vcs_name => 'my-git-vcs-root', :vcs_type => 'git', :project_id => 'project2') do |properties| properties['branch'] = 'master' properties['url'] = 'git@github.com:jperry/teamcity-ruby-client.git' properties['authMethod'] = 'PRIVATE_KEY_DEFAULT' properties['ignoreKnownHosts'] = true end
# File lib/teamcity/client/vcs_roots.rb, line 38 def create_vcs_root(options = {}, &block) attributes = { :name => options.fetch(:vcs_name), :vcsName => VCS_TYPES[options.fetch(:vcs_type)] || options.fetch(:vcs_type), :projectLocator => options.fetch(:project_id) } builder = TeamCity::ElementBuilder.new(attributes, &block) post("vcs-roots", :content_type => :json) do |req| req.body = builder.to_request_body end end
vcs_root_details(vcs_root_id)
click to toggle source
Get VCS Root details
@param vcs_root_id [String, Numeric] @return [Hashie::Mash]
# File lib/teamcity/client/vcs_roots.rb, line 19 def vcs_root_details(vcs_root_id) get("vcs-roots/id:#{vcs_root_id}") end
vcs_roots()
click to toggle source
List of VCS Roots
@return [Array<Hashie::Mash>, nil] of vcs roots or nil if no vcs roots exist
# File lib/teamcity/client/vcs_roots.rb, line 10 def vcs_roots response = get('vcs-roots') response['vcs-root'] end