Class: DynportTools::Jenkins::Project
- Inherits:
-
Object
- Object
- DynportTools::Jenkins::Project
- Defined in:
- lib/dynport_tools/jenkins.rb
Constant Summary collapse
- DEFAUL_SCM =
"hudson.scm.NullSCM"
Instance Attribute Summary collapse
-
#child_projects ⇒ Object
Returns the value of attribute child_projects.
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#crontab_pattern ⇒ Object
Returns the value of attribute crontab_pattern.
-
#days_to_keep ⇒ Object
Returns the value of attribute days_to_keep.
-
#description ⇒ Object
Returns the value of attribute description.
-
#disabled ⇒ Object
Returns the value of attribute disabled.
-
#email_addresses ⇒ Object
Returns the value of attribute email_addresses.
-
#locks ⇒ Object
Returns the value of attribute locks.
-
#name ⇒ Object
Returns the value of attribute name.
-
#node ⇒ Object
Returns the value of attribute node.
-
#num_to_keep ⇒ Object
Returns the value of attribute num_to_keep.
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ Project
constructor
A new instance of Project.
- #md5 ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(name = nil) ⇒ Project
Returns a new instance of Project.
151 152 153 154 155 156 157 |
# File 'lib/dynport_tools/jenkins.rb', line 151 def initialize(name = nil) self.name = name self.commands = [] self.child_projects = [] self.email_addresses = [] self.locks = [] end |
Instance Attribute Details
#child_projects ⇒ Object
Returns the value of attribute child_projects.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def child_projects @child_projects end |
#commands ⇒ Object
Returns the value of attribute commands.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def commands @commands end |
#crontab_pattern ⇒ Object
Returns the value of attribute crontab_pattern.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def crontab_pattern @crontab_pattern end |
#days_to_keep ⇒ Object
Returns the value of attribute days_to_keep.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def days_to_keep @days_to_keep end |
#description ⇒ Object
Returns the value of attribute description.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def description @description end |
#disabled ⇒ Object
Returns the value of attribute disabled.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def disabled @disabled end |
#email_addresses ⇒ Object
Returns the value of attribute email_addresses.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def email_addresses @email_addresses end |
#locks ⇒ Object
Returns the value of attribute locks.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def locks @locks end |
#name ⇒ Object
Returns the value of attribute name.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def name @name end |
#node ⇒ Object
Returns the value of attribute node.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def node @node end |
#num_to_keep ⇒ Object
Returns the value of attribute num_to_keep.
148 149 150 |
# File 'lib/dynport_tools/jenkins.rb', line 148 def num_to_keep @num_to_keep end |
Instance Method Details
#md5 ⇒ Object
159 160 161 |
# File 'lib/dynport_tools/jenkins.rb', line 159 def md5 Digest::MD5.hexdigest(to_xml) end |
#to_xml ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/dynport_tools/jenkins.rb', line 163 def to_xml Nokogiri::XML::Builder.new(:encoding => "UTF-8") do |xml| xml.project do xml.actions xml.description *[description].compact if days_to_keep || num_to_keep xml.logRotator do xml.daysToKeep days_to_keep || -1 xml.numToKeep num_to_keep || -1 xml.artifactDaysToKeep -1 xml.artifactNumToKeep -1 end end xml.keepDependencies false xml.properties xml.scm(:class => DEFAUL_SCM) if node xml.assignedNode node xml.canRoam false else xml.canRoam true end xml.disabled disabled ? true : false xml.blockBuildWhenDownstreamBuilding false xml.blockBuildWhenUpstreamBuilding false xml.triggers(:class => "vector") do if crontab_pattern xml.send("hudson.triggers.TimerTrigger") do xml.spec crontab_pattern end end end xml.concurrentBuild false xml.builders do commands.each do |command| xml.send("hudson.tasks.Shell") do xml.command command end end end xml.publishers do if child_projects.any? xml.send("hudson.tasks.BuildTrigger") do xml.childProjects child_projects.map { |c| c.name }.join(",") xml.threshold do xml.name "SUCCESS" xml.ordinal "0" xml.color "BLUE" end end end if email_addresses.any? xml.send("hudson.tasks.Mailer") do xml.recipients email_addresses.join(",") xml.dontNotifyEveryUnstableBuild true xml.sendToIndividuals false end end end xml.buildWrappers do if locks.any? xml.send("hudson.plugins.locksandlatches.LockWrapper") do xml.locks do locks.each do |lock| xml.send("hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig") { xml.name lock } end end end end end end end.to_xml end |