class DynportTools::Jenkins::RemoteProject

Attributes

name[RW]
url[RW]
xml[RW]

Public Class Methods

from_details_hash(project_hash) click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 4
def self.from_details_hash(project_hash)
  new(:url => project_hash[:url], :name => project_hash[:name], :xml => project_hash[:body])
end
new(options = {}) click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 8
def initialize(options = {})
  options.each do |key, value|
    self.send(:"#{key}=", value)
  end
end

Public Instance Methods

child_projects() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 48
def child_projects
  if projects = doc.xpath("/project/publishers/hudson.tasks.BuildTrigger/childProjects").first
    projects.inner_text.split(/\s*,\s*/)
  else
    []
  end
end
commands() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 36
def commands
  doc.xpath("/project/builders/hudson.tasks.Shell/command").map(&:inner_text)
end
crontab_patterns() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 40
def crontab_patterns
  doc.xpath("/project/triggers/hudson.triggers.TimerTrigger/spec").map(&:inner_text)
end
days_to_keep() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 22
def days_to_keep
  logrotate_value_when_set("daysToKeep")
end
disabled?() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 44
def disabled?
  doc.at("/project/disabled/text()").to_s == "true"
end
doc() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 14
def doc
  @doc ||= Nokogiri::XML(xml) if xml
end
email_addresses() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 56
def email_addresses
  doc.xpath("/project/publishers/hudson.tasks.Mailer/recipients").map { |rec| rec.inner_text.split(",") }.flatten
end
locks() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 64
  def locks
doc.xpath("/project/buildWrappers/hudson.plugins.locksandlatches.LockWrapper/locks/hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig/name").map(&:inner_text)
  end
logrotate_value_when_set(key) click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 30
def logrotate_value_when_set(key)
  if node = doc.at("/project/logRotator/#{key}")
    node.inner_text.to_i if node.inner_text.to_i != -1
  end
end
md5() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 18
def md5
  Digest::MD5.hexdigest(xml) if xml
end
node() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 60
def node
  doc.xpath("/project/assignedNode").map { |n| n.inner_text }.first
end
num_to_keep() click to toggle source
# File lib/dynport_tools/jenkins/remote_project.rb, line 26
def num_to_keep
  logrotate_value_when_set("numToKeep")
end