Class: DynportTools::Jenkins::RemoteProject
- Inherits:
-
Object
- Object
- DynportTools::Jenkins::RemoteProject
- Defined in:
- lib/dynport_tools/jenkins/remote_project.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
-
#xml ⇒ Object
Returns the value of attribute xml.
Class Method Summary collapse
Instance Method Summary collapse
- #child_projects ⇒ Object
- #commands ⇒ Object
- #crontab_patterns ⇒ Object
- #days_to_keep ⇒ Object
- #disabled? ⇒ Boolean
- #doc ⇒ Object
- #email_addresses ⇒ Object
-
#initialize(options = {}) ⇒ RemoteProject
constructor
A new instance of RemoteProject.
- #locks ⇒ Object
- #logrotate_value_when_set(key) ⇒ Object
- #md5 ⇒ Object
- #node ⇒ Object
- #num_to_keep ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ RemoteProject
Returns a new instance of RemoteProject.
8 9 10 11 12 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 8 def initialize( = {}) .each do |key, value| self.send(:"#{key}=", value) end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 2 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 2 def url @url end |
#xml ⇒ Object
Returns the value of attribute xml.
2 3 4 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 2 def xml @xml end |
Class Method Details
.from_details_hash(project_hash) ⇒ Object
4 5 6 |
# 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 |
Instance Method Details
#child_projects ⇒ Object
48 49 50 51 52 53 54 |
# 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 ⇒ Object
36 37 38 |
# 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 ⇒ Object
40 41 42 |
# 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 ⇒ Object
22 23 24 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 22 def days_to_keep logrotate_value_when_set("daysToKeep") end |
#disabled? ⇒ Boolean
44 45 46 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 44 def disabled? doc.at("/project/disabled/text()").to_s == "true" end |
#doc ⇒ Object
14 15 16 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 14 def doc @doc ||= Nokogiri::XML(xml) if xml end |
#email_addresses ⇒ Object
56 57 58 |
# 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 ⇒ Object
64 65 66 |
# 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) ⇒ Object
30 31 32 33 34 |
# 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 ⇒ Object
18 19 20 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 18 def md5 Digest::MD5.hexdigest(xml) if xml end |
#node ⇒ Object
60 61 62 |
# 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 ⇒ Object
26 27 28 |
# File 'lib/dynport_tools/jenkins/remote_project.rb', line 26 def num_to_keep logrotate_value_when_set("numToKeep") end |