Sha256: 328a66fb77c0406bb5ee1235955cf54d1ec77376b73c30ab8e6f2257ae06a17a
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module TeamcityRuby class VcsRoot extend TeamcityRuby::Resource VCS_TYPES = { :git => 'jetbrains.git' } DEFAULT_PROJECT = "_Root" DEFAULT_VCS_TYPE = :git attr_reader :teamcity_id, :name, :parent_id def self.all client.get("/vcs-roots")["vcs-root"].map do |p| VcsRoot.new(p) end end def self.find(options = {}) response = client.get("/vcs-roots/#{locator(options)}") return nil if ( response.body =~ /No vcsRoot found/ ) VcsRoot.new(response) end def self.create(options = {}, &block) vcs_type = VCS_TYPES[options.fetch(:type) { DEFAULT_VCS_TYPE }] project_id = options.fetch(:project_id) { DEFAULT_PROJECT } attributes = { "name" => options[:name], "vcsName" => vcs_type, "projectLocator" => "id:#{project_id}", } builder = TeamCity::ElementBuilder.new(attributes, &block) response = client.post("/vcs-roots", :body => builder.to_request_body) VcsRoot.new(response) end def initialize(options = {}) @teamcity_id = options["id"] @name = options["name"] end def destroy! client.delete("/vcs-roots/id:#{self.teamcity_id}") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
teamcity_ruby-0.0.1 | lib/teamcity_ruby/vcs_root.rb |