Class: Hudson::JobConfig
- Inherits:
-
Object
- Object
- Hudson::JobConfig
- Defined in:
- lib/api/job_config.rb
Instance Attribute Summary collapse
-
#archived_resources ⇒ Object
Returns the value of attribute archived_resources.
-
#config ⇒ Object
Returns the value of attribute config.
-
#description ⇒ Object
Returns the value of attribute description.
-
#disabled ⇒ Object
Returns the value of attribute disabled.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#repositories ⇒ Object
Returns the value of attribute repositories.
-
#targets ⇒ Object
Returns the value of attribute targets.
Instance Method Summary collapse
- #create ⇒ Object
- #create_builders(project) ⇒ Object
- #create_publisher(project) ⇒ Object
- #create_svn(p) ⇒ Object
-
#initialize ⇒ JobConfig
constructor
A new instance of JobConfig.
Constructor Details
#initialize ⇒ JobConfig
Returns a new instance of JobConfig.
7 8 9 10 11 |
# File 'lib/api/job_config.rb', line 7 def initialize @disabled = false @targets = [] @provider = "svn" end |
Instance Attribute Details
#archived_resources ⇒ Object
Returns the value of attribute archived_resources.
5 6 7 |
# File 'lib/api/job_config.rb', line 5 def archived_resources @archived_resources end |
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/api/job_config.rb', line 5 def config @config end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/api/job_config.rb', line 5 def description @description end |
#disabled ⇒ Object
Returns the value of attribute disabled.
5 6 7 |
# File 'lib/api/job_config.rb', line 5 def disabled @disabled end |
#provider ⇒ Object
Returns the value of attribute provider.
5 6 7 |
# File 'lib/api/job_config.rb', line 5 def provider @provider end |
#repositories ⇒ Object
Returns the value of attribute repositories.
5 6 7 |
# File 'lib/api/job_config.rb', line 5 def repositories @repositories end |
#targets ⇒ Object
Returns the value of attribute targets.
5 6 7 |
# File 'lib/api/job_config.rb', line 5 def targets @targets end |
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/api/job_config.rb', line 13 def create b = Builder::XmlMarkup.new(:indent => 1) @config= b.project do |p| p.description @description p.disabled @disabled # Repositories unless @repositories.nil? if @provider == "svn" create_svn(p) end end # Builders if @targets.length > 0 create_builders(p) else p.builders end # Create publisers create_publisher(p) # defaults p.properties do |prop| prop.tag!("watched-dependencies-property") end p.actions p.keepDependencies false p.advancedAffinityChooser false p.canRoam true p.blockBuildWhenDownstreamBuilding false p.blockBuildWhenUpstreamBuilding false p.triggers("class"=>"vector") p.concurrentBuild false p.cleanWorkspaceRequired true p.buildWrappers end @config end |
#create_builders(project) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/api/job_config.rb', line 77 def create_builders(project) shell = "#Prepare project\n" buckminster = "import '${WORKSPACE}/feature.p2.site/site.cquery'\n" buckminster += "build\n" buckminster += "perform -D target.os=* -D target.ws=* -D target.arch=* feature.p2.site#site.p2\n" # Setup targets as csv tgts = @targets.map{|a| a["feature"]}.join(",") shell += "/opt/hudson-osx/tools/prepare ${WORKSPACE} \"#{tgts}\"\n" project.builders do |builder| # Shell tashs builder.tag!("hudson.tasks.Shell") do |t| t.command shell end # Buckminster task builder.tag!("hudson.plugins.buckminster.EclipseBuckminsterBuilder") do |b| b.installationName "Buckminster" b.commands buckminster b.targetPlatformName "Opensixen Core" b.logLevel "info" b.params b.userTemp b.userOutput b.userCommand b.userWorkspace b.globalPropertiesFile b.equinoxLauncherArgs end end end |
#create_publisher(project) ⇒ Object
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/api/job_config.rb', line 111 def create_publisher(project) project.publishers do |publisher| publisher.tag!("hudson.tasks.ArtifactArchiver") do |a| a.artifacts @archived_resources a.compressionType "GZIP" a.latestOnly false a.autoValidateFileMask false end end end |
#create_svn(p) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/api/job_config.rb', line 55 def create_svn(p) p.scm("class"=>"hudson.scm.SubversionSCM") do |svn| svn.excludedRegions svn.includedRegions svn.excludedUsers svn.excludedRevprop svn.excludedCommitMessages svn.workspaceUpdater("class"=>"hudson.scm.subversion.UpdateUpdater") svn.locations do |l| @repositories.each do |repo| l.tag!("hudson.scm.SubversionSCM_-ModuleLocation") do |ml| ml.remote repo["uri"] ml.local repo["path"] ml.depthOption "infinity" ml.ignoreExternalsOption false end end end end end |