Module: Cigale::Publisher

Defined in:
lib/cigale/publisher.rb,
lib/cigale/publisher/s3.rb,
lib/cigale/publisher/dry.rb,
lib/cigale/publisher/ftp.rb,
lib/cigale/publisher/git.rb,
lib/cigale/publisher/pmd.rb,
lib/cigale/publisher/scp.rb,
lib/cigale/publisher/ssh.rb,
lib/cigale/publisher/tap.rb,
lib/cigale/publisher/cifs.rb,
lib/cigale/publisher/jira.rb,
lib/cigale/publisher/plot.rb,
lib/cigale/publisher/email.rb,
lib/cigale/publisher/junit.rb,
lib/cigale/publisher/robot.rb,
lib/cigale/publisher/sonar.rb,
lib/cigale/publisher/stash.rb,
lib/cigale/publisher/xunit.rb,
lib/cigale/publisher/cigame.rb,
lib/cigale/publisher/ircbot.rb,
lib/cigale/publisher/jabber.rb,
lib/cigale/publisher/jacoco.rb,
lib/cigale/publisher/testng.rb,
lib/cigale/publisher/archive.rb,
lib/cigale/publisher/doxygen.rb,
lib/cigale/publisher/gatling.rb,
lib/cigale/publisher/javadoc.rb,
lib/cigale/publisher/jclouds.rb,
lib/cigale/publisher/trigger.rb,
lib/cigale/publisher/campfire.rb,
lib/cigale/publisher/coverage.rb,
lib/cigale/publisher/cppcheck.rb,
lib/cigale/publisher/findbugs.rb,
lib/cigale/publisher/fitnesse.rb,
lib/cigale/publisher/flowdock.rb,
lib/cigale/publisher/logstash.rb,
lib/cigale/publisher/pipeline.rb,
lib/cigale/publisher/valgrind.rb,
lib/cigale/publisher/warnings.rb,
lib/cigale/publisher/cloverphp.rb,
lib/cigale/publisher/cobertura.rb,
lib/cigale/publisher/email-ext.rb,
lib/cigale/publisher/logparser.rb,
lib/cigale/publisher/naginator.rb,
lib/cigale/publisher/scoverage.rb,
lib/cigale/publisher/sloccount.rb,
lib/cigale/publisher/checkstyle.rb,
lib/cigale/publisher/post-tasks.rb,
lib/cigale/publisher/scan-build.rb,
lib/cigale/publisher/violations.rb,
lib/cigale/publisher/claim-build.rb,
lib/cigale/publisher/fingerprint.rb,
lib/cigale/publisher/performance.rb,
lib/cigale/publisher/sitemonitor.rb,
lib/cigale/publisher/text-finder.rb,
lib/cigale/publisher/xml-summary.rb,
lib/cigale/publisher/join-trigger.rb,
lib/cigale/publisher/maven-deploy.rb,
lib/cigale/publisher/ruby-metrics.rb,
lib/cigale/publisher/image-gallery.rb,
lib/cigale/publisher/shining-panda.rb,
lib/cigale/publisher/blame-upstream.rb,
lib/cigale/publisher/copy-to-master.rb,
lib/cigale/publisher/downstream-ext.rb,
lib/cigale/publisher/html-publisher.rb,
lib/cigale/publisher/aggregate-tests.rb,
lib/cigale/publisher/build-publisher.rb,
lib/cigale/publisher/clone-workspace.rb,
lib/cigale/publisher/github-notifier.rb,
lib/cigale/publisher/postbuildscript.rb,
lib/cigale/publisher/groovy-postbuild.rb,
lib/cigale/publisher/artifact-deployer.rb,
lib/cigale/publisher/emotional-jenkins.rb,
lib/cigale/publisher/workspace-cleanup.rb,
lib/cigale/publisher/description-setter.rb,
lib/cigale/publisher/disable-failed-job.rb,
lib/cigale/publisher/rich-text-publisher.rb,
lib/cigale/publisher/aggregate-flow-tests.rb,
lib/cigale/publisher/google-cloud-storage.rb,
lib/cigale/publisher/conditional-publisher.rb,
lib/cigale/publisher/display-upstream-changes.rb,
lib/cigale/publisher/trigger-parameterized-builds.rb

Defined Under Namespace

Classes: CustomPublisher

Instance Method Summary collapse

Instance Method Details

#publisher_classesObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/cigale/publisher.rb', line 88

def publisher_classes
  @publisher_classes ||= {
    "aggregate-flow-tests" => CustomPublisher.new,
    "aggregate-tests" => "hudson.tasks.test.AggregatedTestResultPublisher",
    "archive" => "hudson.tasks.ArtifactArchiver",
    "blame-upstream" => CustomPublisher.new,
    "artifact-deployer" => "org.jenkinsci.plugins.artifactdeployer.ArtifactDeployerPublisher",
    "build-publisher" => "hudson.plugins.build__publisher.BuildPublisher",
    "campfire" => "hudson.plugins.campfire.CampfireNotifier",
    "checkstyle" => "hudson.plugins.checkstyle.CheckStylePublisher",
    "cifs" => "jenkins.plugins.publish__over__cifs.CifsPublisherPlugin",
    "cigame" => CustomPublisher.new,
    "claim-build" => CustomPublisher.new,
    "clone-workspace" => CustomPublisher.new,
    "cloverphp" => "org.jenkinsci.plugins.cloverphp.CloverPHPPublisher",
    "cobertura" => "hudson.plugins.cobertura.CoberturaPublisher",
    "conditional-publisher" => "org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher",
    "copy-to-master" => "com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier",
    "coverage" => "hudson.plugins.cobertura.CoberturaPublisher",
    "cppcheck" => "org.jenkinsci.plugins.cppcheck.CppcheckPublisher",
    "description-setter" => "hudson.plugins.descriptionsetter.DescriptionSetterPublisher",
    "disable-failed-job" => CustomPublisher.new,
    "display-upstream-changes" => CustomPublisher.new,
    "downstream-ext" => "hudson.plugins.downstream__ext.DownstreamTrigger",
    "doxygen" => "hudson.plugins.doxygen.DoxygenArchiver",
    "dry" => "hudson.plugins.dry.DryPublisher",
    "email-ext" => "hudson.plugins.emailext.ExtendedEmailPublisher",
    "email" => "hudson.tasks.Mailer",
    "emotional-jenkins" => CustomPublisher.new,
    "findbugs" => CustomPublisher.new,
    "fingerprint" => "hudson.tasks.Fingerprinter",
    "fitnesse" => "hudson.plugins.fitnesse.FitnesseResultsRecorder",
    "flowdock" => "com.flowdock.jenkins.FlowdockNotifier",
    "ftp" => "jenkins.plugins.publish__over__ftp.BapFtpPublisherPlugin",
    "gatling" => "io.gatling.jenkins.GatlingPublisher",
    "git" => "hudson.plugins.git.GitPublisher",
    "github-notifier" => CustomPublisher.new,
    "google-cloud-storage" => ["com.google.jenkins.plugins.storage.GoogleCloudStorageUploader", :plugin => "google-storage-plugin"],
    "groovy-postbuild" => "org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder",
    "html-publisher" => "htmlpublisher.HtmlPublisher",
    "image-gallery" => "org.jenkinsci.plugins.imagegallery.ImageGalleryRecorder",
    "ircbot" => "hudson.plugins.ircbot.IrcPublisher",
    "jabber" => "hudson.plugins.jabber.im.transport.JabberPublisher",
    "jacoco" => "hudson.plugins.jacoco.JacocoPublisher",
    "javadoc" => "hudson.tasks.JavadocArchiver",
    "jclouds" => "jenkins.plugins.jclouds.blobstore.BlobStorePublisher",
    "jira" => CustomPublisher.new,
    "join-trigger" => "join.JoinTrigger",
    "junit" => "hudson.tasks.junit.JUnitResultArchiver",
    "logparser" => "hudson.plugins.logparser.LogParserPublisher",
    "logstash" => "jenkins.plugins.logstash.LogstashNotifier",
    "maven-deploy" => "hudson.maven.RedeployPublisher",
    "naginator" => "com.chikli.hudson.plugin.naginator.NaginatorPublisher",
    "performance" => "hudson.plugins.performance.PerformancePublisher",
    "pipeline" => "au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger",
    "plot" => "hudson.plugins.plot.PlotPublisher",
    "pmd" => "hudson.plugins.pmd.PmdPublisher",
    "post-tasks" => "hudson.plugins.postbuildtask.PostbuildTask",
    "postbuildscript" => "org.jenkinsci.plugins.postbuildscript.PostBuildScript",
    "rich-text-publisher" => "org.korosoft.jenkins.plugin.rtp.RichTextPublisher",
    "robot" => "hudson.plugins.robot.RobotPublisher",
    "ruby-metrics" => "hudson.plugins.rubyMetrics.rcov.RcovPublisher",
    "s3" => "hudson.plugins.s3.S3BucketPublisher",
    "scan-build" => "jenkins.plugins.clangscanbuild.publisher.ClangScanBuildPublisher",
    "scoverage" => "org.jenkinsci.plugins.scoverage.ScoveragePublisher",
    "scp" => "be.certipost.hudson.plugin.SCPRepositoryPublisher",
    "shining-panda" => "jenkins.plugins.shiningpanda.publishers.CoveragePublisher",
    "sitemonitor" => "hudson.plugins.sitemonitor.SiteMonitorRecorder",
    "sloccount" => "hudson.plugins.sloccount.SloccountPublisher",
    "sonar" => "hudson.plugins.sonar.SonarPublisher",
    "ssh" => "jenkins.plugins.publish__over__ssh.BapSshPublisherPlugin",
    "stash" => "org.jenkinsci.plugins.stashNotifier.StashNotifier",
    "tap" => "org.tap4j.plugin.TapPublisher",
    "testng" => "hudson.plugins.testng.Publisher",
    "text-finder" => "hudson.plugins.textfinder.TextFinderPublisher",
    "trigger-parameterized-builds" => "hudson.plugins.parameterizedtrigger.BuildTrigger",
    "trigger" => "hudson.tasks.BuildTrigger",
    "valgrind" => "org.jenkinsci.plugins.valgrind.ValgrindPublisher",
    "violations" => "hudson.plugins.violations.ViolationsPublisher",
    "warnings" => "hudson.plugins.warnings.WarningsPublisher",
    "workspace-cleanup" => ["hudson.plugins.ws__cleanup.WsCleanup", :plugin => "[email protected]"],
    "xml-summary" => "hudson.plugins.summary__report.ACIPluginPublisher",
    "xunit" => "xunit",
  }
end

#translate_aggregate_flow_tests_publisher(xml, pdef) ⇒ Object



3
4
5
# File 'lib/cigale/publisher/aggregate-flow-tests.rb', line 3

def translate_aggregate_flow_tests_publisher (xml, pdef)
  xml.tag! "org.zeroturnaround.jenkins.flowbuildtestaggregator.FlowTestAggregator"
end

#translate_aggregate_tests_publisher(xml, pdef) ⇒ Object



3
4
5
# File 'lib/cigale/publisher/aggregate-tests.rb', line 3

def translate_aggregate_tests_publisher (xml, pdef)
  xml.includeFailedBuilds pdef["include-failed-builds"]
end

#translate_archive_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/cigale/publisher/archive.rb', line 2

def translate_archive_publisher (xml, pdef)
  xml.artifacts pdef["artifacts"]
  xml.latestOnly false
  xml.allowEmptyArchive pdef["allow-empty"]
  onlysucc = pdef["only-if-success"] and xml.onlyIfSuccessful onlysucc
  fingerprint = pdef["fingerprint"] and xml.fingerprint fingerprint
end

#translate_artifact_deployer_publisher(xml, pdef) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cigale/publisher/artifact-deployer.rb', line 3

def translate_artifact_deployer_publisher (xml, pdef)
  xml.entries do
    for entry in pdef["entries"]
      xml.tag! "org.jenkinsci.plugins.artifactdeployer.ArtifactDeployerEntry" do
        xml.includes entry["files"]
        xml.basedir entry["basedir"]
        xml.excludes entry["excludes"]
        xml.remote entry["remote"]
        xml.flatten entry["flatten"]
        xml.deleteRemote entry["delete-remote"]
        xml.deleteRemoteArtifacts entry["delete-remote-artifacts"]
        xml.failNoFilesDeploy entry["fail-no-files"]
        xml.groovyExpression entry["groovy-script"]
      end
    end
  end
  xml.deployEvenBuildFail pdef["deploy-if-fail"]
end

#translate_blame_upstream_publisher(xml, pdef) ⇒ Object



3
4
5
# File 'lib/cigale/publisher/blame-upstream.rb', line 3

def translate_blame_upstream_publisher (xml, pdef)
  xml.tag! "hudson.plugins.blame__upstream__commiters.BlameUpstreamCommitersPublisher"
end

#translate_build_publisher_publisher(xml, pdef) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cigale/publisher/build-publisher.rb', line 3

def translate_build_publisher_publisher (xml, pdef)
  xml.publishUnstableBuilds pdef["publish-unstable-builds"]
  xml.publishFailedBuilds pdef["publish-failed-builds"]
  days = pdef["days-to-keep"]
  num = pdef["num-to-keep"]

  if days || num
    xml.logRotator do
      xml.daysToKeep days
      xml.numToKeep num
      xml.artifactDaysToKeep -1
      xml.artifactNumToKeep -1
    end
  end
end

#translate_campfire_publisher(xml, pdef) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cigale/publisher/campfire.rb', line 3

def translate_campfire_publisher (xml, pdef)
  if pdef["subdomain"] || pdef["token"] || pdef["ssl"] || pdef["room"]
    xml.campfire do
      xml.subdomain pdef["subdomain"]
      xml.token pdef["token"]
      xml.ssl pdef["ssl"]
    end
    xml.room do
      xml.name pdef["room"]
      xml.campfire :reference => "../../campfire"
    end
  else
    xml.campfire
  end
end

#translate_checkstyle_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/checkstyle.rb', line 2

def translate_checkstyle_publisher (xml, pdef)
  xml.healthy pdef["healthy"]
  xml.unHealthy pdef["unHealthy"] || pdef["unhealthy"]
  xml.thresholdLimit pdef["healthThreshold"] || pdef["health-threshold"] || "low"
  xml.pluginName "[CHECKSTYLE] "
  xml.defaultEncoding pdef["defaultEncoding"] || pdef["default-encoding"]
  xml.canRunOnFailed boolp(pdef["canRunOnFailed"] || pdef["can-run-on-failed"], false)
  xml.useStableBuildAsReference boolp(pdef["useStableBuildAsReference"] || pdef["use-stable-build-as-reference"], false)
  xml.useDeltaValues boolp(pdef["useDeltaValues"] || pdef["use-delta-values"], false)

  thresholds = pdef["thresholds"] || {}
  uthresh = thresholds["unstable"] || {}
  fthresh = thresholds["failed"] || {}

  xml.thresholds do
    xml.unstableTotalAll uthresh["totalAll"] || uthresh["total-all"]
    xml.unstableTotalHigh uthresh["totalHigh"] || uthresh["total-high"]
    xml.unstableTotalNormal uthresh["totalNormal"] || uthresh["total-normal"]
    xml.unstableTotalLow uthresh["totalLow"] || uthresh["total-low"]

    una = (uthresh["newAll"] || uthresh["new-all"]) and xml.unstableNewAll una
    unh = (uthresh["newHigh"] || uthresh["new-high"]) and xml.unstableNewHigh unh
    unn = (uthresh["newNormal"] || uthresh["new-normal"]) and xml.unstableNewNormal unn
    unl = (uthresh["newLow"] || uthresh["new-low"]) and xml.unstableNewLow unl

    xml.failedTotalAll fthresh["totalAll"] || fthresh["total-all"]
    xml.failedTotalHigh fthresh["totalHigh"] || fthresh["total-high"]
    xml.failedTotalNormal fthresh["totalNormal"] || fthresh["total-normal"]
    xml.failedTotalLow fthresh["totalLow"] || fthresh["total-low"]

    fna = (fthresh["newAll"] || fthresh["new-all"]) and xml.failedNewAll fna
    fnh = (fthresh["newHigh"] || fthresh["new-high"]) and xml.failedNewHigh fnh
    fnn = (fthresh["newNormal"] || fthresh["new-normal"]) and xml.failedNewNormal fnn
    fnl = (fthresh["newLow"] || fthresh["new-low"]) and xml.failedNewLow fnl
  end
  xml.shouldDetectModules boolp(pdef["shouldDetectModules"] || pdef["should-detect-modules"], false)

  xml.dontComputeNew boolp(pdef["dontComputeNew"] || pdef["dont-compute-new"], true)
  xml.doNotResolveRelativePaths boolp(pdef["doNotResolveRelativePaths"] || pdef["do-not-resolve-relative-paths"], false)
  xml.pattern pdef["pattern"]
end

#translate_cifs_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cigale/publisher/cifs.rb', line 2

def translate_cifs_publisher (xml, pdef)
  xml.consolePrefix "CIFS: "
  xml.delegate do
    xml.publishers do
      xml.tag! "jenkins.plugins.publish__over__cifs.CifsPublisher" do
        xml.configName pdef["site"]
        xml.verbose true
        xml.transfers do
          xml.tag! "jenkins.plugins.publish__over__cifs.CifsTransfer" do
            xml.remoteDirectory pdef["target"]
            xml.sourceFiles pdef["source"]
            xml.excludes pdef["excludes"]
            xml.removePrefix pdef["remove-prefix"]
            xml.remoteDirectorySDF false
            xml.flatten pdef["flatten"]
            xml.cleanRemote false
          end # CifsTransfer
        end #transfers

        xml.useWorkspaceInPromotion false
        xml.usePromotionTimestamp false
      end # CifsPublisher
    end # publishers

    xml.continueOnError false
    xml.failOnError false
    xml.alwaysPublishFromMaster false
    xml.hostConfigurationAccess :class => "jenkins.plugins.publish_over_cifs.CifsPublisherPlugin", :reference => "../.."
  end # delegate
end

#translate_cigame_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/cigame.rb', line 2

def translate_cigame_publisher (xml, pdef)
  xml.tag! "hudson.plugins.cigame.GamePublisher"
end

#translate_claim_build_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/claim-build.rb', line 2

def translate_claim_build_publisher (xml, pdef)
  xml.tag! "hudson.plugins.claim.ClaimPublisher"
end

#translate_clone_workspace_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/cigale/publisher/clone-workspace.rb', line 2

def translate_clone_workspace_publisher (xml, pdef)
  xml.tag! "hudson.plugins.cloneworkspace.CloneWorkspacePublisher", :plugin => "clone-workspace-scm" do
    xml.workspaceGlob pdef["workspace-glob"]
    weg = pdef["workspace-exclude-glob"] and xml.workspaceExcludeGlob weg
    xml.criteria (pdef["criteria"] || "any").capitalize
    xml.archiveMethod (pdef["archive-method"] || "tar").upcase
    xml.overrideDefaultExcludes boolp(pdef["override-default-excludes"], false)
  end
end

#translate_cloverphp_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
54
55
# File 'lib/cigale/publisher/cloverphp.rb', line 2

def translate_cloverphp_publisher (xml, pdef)
  if html = pdef["html"]
    xml.publishHtmlReport true
    xml.reportDir html["dir"]
  else
    xml.publishHtmlReport false
  end

  xml.xmlLocation pdef["xml-location"]

  if html
    xml.disableArchiving !html["archive"]
  else
    xml.disableArchiving false
  end

  targets = {}

  for target in toa pdef["metric-targets"]
    k, v = first_pair(target)
    targets[k] = v
  end
  targets["healthy"] ||= {
    "method" => 70,
    "statement" => 80,
  }

  htarget = targets["healthy"]
  utarget = targets["unhealthy"]
  ftarget = targets["failing"]

  xml.healthyTarget do
    hmc = htarget["method"] and xml.methodCoverage hmc
    hsc = htarget["statement"] and xml.statementCoverage hsc
  end

  if utarget
    xml.unhealthyTarget do
      umc = utarget["method"] and xml.methodCoverage umc
      usc = utarget["statement"] and xml.statementCoverage usc
    end
  else
    xml.unhealthyTarget
  end

  if ftarget
    xml.failingTarget do
      fmc = ftarget["method"] and xml.methodCoverage fmc
      fsc = ftarget["statement"] and xml.statementCoverage fsc
    end
  else
    xml.failingTarget
  end
end

#translate_cobertura_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/cobertura.rb', line 2

def translate_cobertura_publisher (xml, pdef)
  xml.coberturaReportFile pdef["report-file"]
  xml.onlyStable pdef["only-stable"]

  pdef.has_key?("fail-unhealthy") and xml.failUnhealthy pdef["fail-unhealthy"]
  pdef.has_key?("fail-unstable") and xml.failUnstable pdef["fail-unstable"]
  pdef.has_key?("health-auto-update") and xml.autoUpdateHealth pdef["health-auto-update"]
  pdef.has_key?("stability-auto-update") and xml.autoUpdateStability pdef["stability-auto-update"]
  pdef.has_key?("zoom-coverage-chart") and xml.zoomCoverageChart pdef["zoom-coverage-chart"]
  pdef.has_key?("fail-no-reports") and xml.failNoReports pdef["fail-no-reports"]

  targets = {
    "healthy" => {},
    "unhealthy" => {},
    "failing" => {},
  }

  for target in toa pdef["targets"]
    metric, values = first_pair(target)
    values.each do |state, value|
      targets[state][metric] = value
    end
  end

  targets.each do |state, metrics|
    xml.tag! "#{state}Target" do
      xml.targets :class => "enum-map", :"enum-type" => "hudson.plugins.cobertura.targets.CoverageMetric" do
        metrics.each do |metric, value|
          xml.entry do
            xml.tag! "hudson.plugins.cobertura.targets.CoverageMetric", metric.upcase
            xml.int value
          end
        end
      end # targets class=enum-map
    end
  end # each metric

  xml.sourceEncoding pdef["source-encoding"]
end

#translate_conditional_publisher_publisher(xml, pdef) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cigale/publisher/conditional-publisher.rb', line 3

def translate_conditional_publisher_publisher (xml, pdef)
  xml.publishers do

    for publisher in pdef
      xml.tag! "org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher" do
        translate_condition "condition", xml, publisher

        onfailure = publisher["on-evaluation-failure"] || "fail"
        verb = case onfailure
        when "dont-run" then "DontRun"
        when "fail" then "Fail"
        when "run-and-mark-unstable" then "RunUnstable"
        else
          raise "Unknown evaluation failure consequence: #{onfailure}"
        end
        xml.runner :class => "org.jenkins_ci.plugins.run_condition.BuildStepRunner$#{verb}"

        for action in publisher["action"]
          translate_individual_publisher xml, action
        end
      end # Conditional publisher
    end # for publisher in pdef
  end
end

#translate_copy_to_master_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
# File 'lib/cigale/publisher/copy-to-master.rb', line 2

def translate_copy_to_master_publisher (xml, pdef)
  xml.includes toa(pdef["includes"]).join(",")
  xml.excludes toa(pdef["excludes"]).join(",")
  xml.destinationFolder
end

#translate_coverage_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cigale/publisher/coverage.rb', line 2

def translate_coverage_publisher (xml, pdef)
  translate_cobertura_publisher xml, {
    "report-file" => "**/coverage.xml",
    "only-stable" => false,
    "targets" => [
      {
        "conditional" => {
          "healthy" => 70,
          "unhealthy" => 0,
          "failing" => 0,
        },
      },
      {
        "line" => {
          "healthy" => 80,
          "unhealthy" => 0,
          "failing" => 0,
        },
      },
      {
        "method" => {
          "healthy" => 80,
          "unhealthy" => 0,
          "failing" => 0,
        },
      },
    ],
    "source-encoding" => "ASCII",
  }
end

#translate_cppcheck_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/cppcheck.rb', line 2

def translate_cppcheck_publisher (xml, pdef)
  xml.cppcheckConfig do
    xml.pattern pdef["pattern"]
    xml.ignoreBlankFiles false

    thresholds = toh pdef["thresholds"]
    xml.configSeverityEvaluation do
      xml.threshold thresholds["unstable"]
      xml.newThreshold thresholds["new-unstable"]
      xml.failureThreshold thresholds["failure"]
      xml.newFailureThreshold thresholds["new-failure"]

      xml.healthy
      xml.unHealthy

      severities = toh thresholds["severity"]

      xml.severityError boolp(severities["error"], true)
      xml.severityWarning boolp(severities["warning"], true)
      xml.severityStyle boolp(severities["style"], true)
      xml.severityPerformance boolp(severities["performance"], true)
      xml.severityInformation boolp(severities["information"], true)
    end

    graph = toh pdef["graph"]
    xml.configGraph do
      xysize = toa graph["xysize"]
      xml.xSize xysize[0]
      xml.ySize xysize[1]

      display = toh graph["display"]
      xml.displayAllErrors boolp(display["sum"], true)
      xml.displayErrorSeverity boolp(display["error"], false)
      xml.displayWarningSeverity boolp(display["warning"], false)
      xml.displayStyleSeverity boolp(display["style"], false)
      xml.displayPerformanceSeverity boolp(display["performance"], false)
      xml.displayInformationSeverity boolp(display["information"], false)
    end
  end
end

#translate_description_setter_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/cigale/publisher/description-setter.rb', line 2

def translate_description_setter_publisher (xml, pdef)
  xml.regexp pdef["regexp"]
  xml.regexpForFailed pdef["regexp-for-failed"]
  xml.description pdef["description"]
  xml.descriptionForFailed pdef["description-for-failed"]
  xml.setForMatrix pdef["set-for-matrix"]
end

#translate_disable_failed_job_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/cigale/publisher/disable-failed-job.rb', line 2

def translate_disable_failed_job_publisher (xml, pdef)
  xml.tag! "disableFailedJob.disableFailedJob.DisableFailedJob", :plugin => "disable-failed-job" do
    xml.whenDisable pdef["when-to-disable"]
    times = pdef["no-of-failures"] and xml.failureTimes times
    xml.optionalBrockChecked !!times
  end
end

#translate_display_upstream_changes_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/display-upstream-changes.rb', line 2

def translate_display_upstream_changes_publisher (xml, pdef)
  xml.tag! "jenkins.plugins.displayupstreamchanges.DisplayUpstreamChangesRecorder"
end

#translate_downstream_ext_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/cigale/publisher/downstream-ext.rb', line 2

def translate_downstream_ext_publisher (xml, pdef)
  xml.childProjects toa(pdef["projects"]).join(",")

  threshold = pdef["criteria"] || "success"
  xml.threshold do
    translate_build_status xml, threshold.upcase
  end
  xml.thresholdStrategy underize(pdef["condition"] || "and-higher").upcase
  xml.onlyIfSCMChanges boolp(pdef["only-on-scm-change"], false)
  xml.onlyIfLocalSCMChanges boolp(pdef["only-on-local-scm-change"], false)
end

#translate_doxygen_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
# File 'lib/cigale/publisher/doxygen.rb', line 2

def translate_doxygen_publisher (xml, pdef)
  xml.doxyfilePath pdef["doxyfile"]
  xml.keepAll pdef["keepall"]
  xml.folderWhereYouRunDoxygen pdef["folder"]
end

#translate_dry_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/dry.rb', line 2

def translate_dry_publisher (xml, pdef)
  xml.healthy pdef["healthy"]
  xml.unHealthy pdef["unhealthy"]
  xml.thresholdLimit pdef["health-threshold"] || "low"
  xml.pluginName "[DRY] "
  xml.defaultEncoding pdef["default-encoding"]
  xml.canRunOnFailed boolp(pdef["can-run-on-failed"], false)
  xml.useStableBuildAsReference boolp(pdef["use-stable-build-as-reference"], false)
  xml.useDeltaValues boolp(pdef["use-delta-values"], false)
  xml.thresholds do
    thresholds = pdef["thresholds"] || {}

    uthresh = thresholds["unstable"] || {}
    xml.unstableTotalAll uthresh["total-all"]
    xml.unstableTotalHigh uthresh["total-high"]
    xml.unstableTotalNormal uthresh["total-normal"]
    xml.unstableTotalLow uthresh["total-low"]

    una = uthresh["new-all"] and xml.unstableNewAll una
    unh = uthresh["new-high"] and xml.unstableNewHigh unh
    unn = uthresh["new-normal"] and xml.unstableNewNormal unn
    unl = uthresh["new-low"] and xml.unstableNewLow unl

    fthresh = thresholds["failed"] || {}
    xml.failedTotalAll fthresh["total-all"]
    xml.failedTotalHigh fthresh["total-high"]
    xml.failedTotalNormal fthresh["total-normal"]
    xml.failedTotalLow fthresh["total-low"]

    fna = fthresh["new-all"] and xml.failedNewAll fna
    fnh = fthresh["new-high"] and xml.failedNewHigh fnh
    fnn = fthresh["new-normal"] and xml.failedNewNormal fnn
    fnl = fthresh["new-low"] and xml.failedNewLow fnl
  end
  xml.shouldDetectModules boolp(pdef["should-detect-modules"], false)
  xml.dontComputeNew boolp(pdef["dont-compute-new"], true)
  xml.doNotResolveRelativePaths boolp(pdef["do-not-resolve-relative-paths"], false)
  xml.pattern pdef["pattern"]
  xml.highThreshold pdef["high-threshold"] || 50
  xml.normalThreshold pdef["normal-threshold"] || 25
end

#translate_email_ext_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cigale/publisher/email-ext.rb', line 2

def translate_email_ext_publisher (xml, pdef)
  xml.recipientList pdef["recipients"] || "$DEFAULT_RECIPIENTS"
  xml.configuredTriggers do
    @email_ext_triggers ||= {
      "always" => "Always",
      "unstable" => "Unstable",
      "first-failure" => "FirstFailure",
      "not-built" => "NotBuilt",
      "aborted" => "Aborted",
      "regression" => "Regression",
      "failure" => "Failure",
      "second-failure" => "SecondFailure",
      "improvement" => "Improvement",
      "still-failing" => "StillFailing",
      "success" => "Success",
      "fixed" => "Fixed",
      "still-unstable" => "StillUnstable",
      "pre-build" => "PreBuild",
    }

    sendto = {}
    for rec in toa(pdef["send-to"])
      sendto[rec] = true
    end

    unless pdef.has_key?("failure")
      pdef["failure"] = true
    end

    @email_ext_triggers.each do |key, value|
      if pdef[key]
        xml.tag! "hudson.plugins.emailext.plugins.trigger.#{value}Trigger" do
          xml.email do
            xml.recipientList
            xml.subject "$PROJECT_DEFAULT_SUBJECT"
            xml.body "$PROJECT_DEFAULT_CONTENT"
            xml.sendToDevelopers boolp(sendto["developers"], false)
            xml.sendToRequester boolp(sendto["requester"], false)
            xml.includeCulprits boolp(sendto["culprits"], false)
            xml.sendToRecipientList boolp(sendto["recipients"], true)
          end
        end # trigger
      end
    end
  end # configuredTriggers

  xml.contentType case pdef["content-type"]
  when "html", nil
    "text/html"
  else
    raise "Unknown content-type: #{pdef["content-type"]}"
  end
  xml.defaultSubject pdef["subject"] || "Subject for Build ${BUILD_NUMBER}"
  xml.defaultContent pdef["content"] || "The build has finished"
  xml.attachmentsPattern pdef["attachments"]
  xml.presendScript pdef["presend-script"]
  xml.attachBuildLog boolp(pdef["attach-build-log"], false)
  xml.saveOutput boolp(pdef["save-output"], false)
  xml.disabled boolp(pdef["disabled"], false)
  xml.replyTo pdef["reply-to"] || "$DEFAULT_REPLYTO"
  xml.matrixTriggerMode case pdef["matrix-trigger"]
  when "only-configurations"
    "ONLY_CONFIGURATIONS"
  else
    raise "Unknown matrix trigger mode #{pdef["matrix-trigger"]}"
  end
end

#translate_email_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
# File 'lib/cigale/publisher/email.rb', line 2

def translate_email_publisher (xml, pdef)
  xml.recipients pdef["recipients"]
  xml.dontNotifyEveryUnstableBuild false
  xml.sendToIndividuals boolp(pdef["send-to-individuals"], false)
end

#translate_emotional_jenkins_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/emotional-jenkins.rb', line 2

def translate_emotional_jenkins_publisher (xml, pdef)
  xml.tag! "org.jenkinsci.plugins.emotional__jenkins.EmotionalJenkinsPublisher"
end

#translate_findbugs_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/findbugs.rb', line 2

def translate_findbugs_publisher (xml, pdef)
  xml.tag! "hudson.plugins.findbugs.FindBugsPublisher", :plugin => "findbugs" do
    xml.isRankActivated pdef["rank-priority"]
    xml.includePattern pdef["include-files"]
    xml.excludePattern pdef["exclude-files"]
    xml.usePreviousBuildAsReference pdef["use-previous-build-as-reference"]
    xml.healthy pdef["healthy"]
    xml.unHealthy pdef["unhealthy"]
    xml.thresholdLimit pdef["health-threshold"]
    xml.pluginName "[FINDBUGS] "
    xml.defaultEncoding
    xml.canRunOnFailed pdef["can-run-on-failed"]
    xml.useStableBuildAsReference pdef["use-stable-build-as-reference"]
    xml.useDeltaValues pdef["use-delta-values"]

    xml.thresholds do
      thresholds = pdef["thresholds"] || {}
      uthresh = thresholds["unstable"] || {}
      fthresh = thresholds["failed"] || {}

      xml.unstableTotalAll uthresh["total-all"]
      xml.unstableTotalHigh uthresh["total-high"]
      xml.unstableTotalNormal uthresh["total-normal"]
      xml.unstableTotalLow uthresh["total-low"]
      xml.unstableNewAll uthresh["new-all"]
      xml.unstableNewHigh uthresh["new-high"]
      xml.unstableNewNormal uthresh["new-normal"]
      xml.unstableNewLow uthresh["new-low"]

      xml.failedTotalAll fthresh["total-all"]
      xml.failedTotalHigh fthresh["total-high"]
      xml.failedTotalNormal fthresh["total-normal"]
      xml.failedTotalLow fthresh["total-low"]
      xml.failedNewAll fthresh["new-all"]
      xml.failedNewHigh fthresh["new-high"]
      xml.failedNewNormal fthresh["new-normal"]
      xml.failedNewLow fthresh["new-low"]
    end
    xml.shouldDetectModules pdef["should-detect-modules"]
    xml.dontComputeNew pdef["dont-compute-new"]
    xml.doNotResolveRelativePaths false
    xml.pattern pdef["pattern"]
  end
end

#translate_fingerprint_publisher(xml, pdef) ⇒ Object



2
3
4
5
# File 'lib/cigale/publisher/fingerprint.rb', line 2

def translate_fingerprint_publisher (xml, pdef)
  xml.targets pdef["files"]
  xml.recordBuildArtifacts pdef["record-artifacts"]
end

#translate_fitnesse_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/fitnesse.rb', line 2

def translate_fitnesse_publisher (xml, pdef)
  xml.fitnessePathToXmlResultsIn pdef["results"]
end

#translate_flowdock_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/flowdock.rb', line 2

def translate_flowdock_publisher (xml, pdef)
  xml.flowToken pdef["token"]
  xml.notificationTags pdef["tags"]
  xml.chatNotification boolp(pdef["chat-notification"], true)

  @flowdock_notifications ||= {
    "Success" => "SUCCESS",
    "Failure" => "FAILURE",
    "Fixed" => "FIXED",
    "Unstable" => "UNSTABLE",
    "Aborted" => "ABORTED",
    "NotBuilt" => "NOT_BUILT",
  }

  notifications = {
    "Success" => true,
    "Failure" => true,
    "Fixed" => true,
  }

  @flowdock_notifications.each do |k, v|
    setkey = "notify-#{k.downcase}"
    if pdef.has_key?(setkey)
      notifications[k] = pdef[setkey]
    end
  end

  xml.notifyMap do
    @flowdock_notifications.each do |k, v|
      xml.entry do
        xml.tag! "com.flowdock.jenkins.BuildResult", v
        xml.boolean !!notifications[k]
      end
    end
  end # notifymap

  @flowdock_notifications.each do |k, v|
    xml.tag! "notify#{k}", !!notifications[k]
  end
end

#translate_ftp_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cigale/publisher/ftp.rb', line 2

def translate_ftp_publisher (xml, pdef)
  xml.consolePrefix "FTP: "
  xml.delegate do
    xml.publishers do
      xml.tag! "jenkins.plugins.publish__over__ftp.BapFtpPublisher" do
        xml.configName pdef["site"]
        xml.verbose true
        xml.transfers do
          xml.tag! "jenkins.plugins.publish__over__ftp.BapFtpTransfer" do
            xml.remoteDirectory pdef["target"]
            xml.sourceFiles pdef["source"]
            xml.excludes pdef["excludes"]
            xml.removePrefix pdef["remove-prefix"]
            xml.remoteDirectorySDF false
            xml.flatten pdef["flatten"]
            xml.cleanRemote false
            xml.asciiMode false
          end
        end

        xml.useWorkspaceInPromotion false
        xml.usePromotionTimestamp false
      end
    end # publishers

    xml.continueOnError false
    xml.failOnError false
    xml.alwaysPublishFromMaster false
    xml.hostConfigurationAccess :class => "jenkins.plugins.publish_over_ftp.BapFtpPublisherPlugin", :reference => "../.."
  end
end

#translate_gatling_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/gatling.rb', line 2

def translate_gatling_publisher (xml, pdef)
  xml.enabled true
end

#translate_git_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/git.rb', line 2

def translate_git_publisher (xml, pdef)
  xml.configVersion 2
  xml.pushMerge pdef["push-merge"]
  xml.pushOnlyIfSuccess pdef["push-only-if-success"]
  xml.forcePush false

  xml.tagsToPush do
    for tag in pdef["tags"]
      tk, tdef = first_pair(tag)

      xml.tag! "hudson.plugins.git.GitPublisher_-TagToPush" do
        xml.targetRepoName tdef["remote"]
        xml.tagName tdef["name"]
        xml.tagMessage tdef["message"]
        xml.createTag tdef["create-tag"]
        xml.updateTag tdef["update-tag"]
      end
    end
  end

  xml.branchesToPush do
    for branch in pdef["branches"]
      btype, bdef = first_pair(branch)
      xml.tag! "hudson.plugins.git.GitPublisher_-BranchToPush" do
        xml.targetRepoName bdef["remote"]
        xml.branchName bdef["name"]
      end
    end
  end

  xml.notesToPush do
    for note in pdef["notes"]
      ntype, ndef = first_pair(note)
      xml.tag! "hudson.plugins.git.GitPublisher_-NoteToPush" do
        xml.targetRepoName ndef["remote"]
        xml.noteMsg ndef["message"]
        xml.noteNamespace ndef["namespace"]
        xml.noteReplace ndef["replace-note"]
      end
    end
  end

end

#translate_github_notifier_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/github-notifier.rb', line 2

def translate_github_notifier_publisher (xml, pdef)
  xml.tag! "com.cloudbees.jenkins.GitHubCommitNotifier"
end

#translate_google_cloud_storage_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/google-cloud-storage.rb', line 2

def translate_google_cloud_storage_publisher (xml, pdef)
  xml.credentialsId pdef["credentials-id"]
  had = {}

  xml.uploads do
    for u in pdef["uploads"]
      k, v = first_pair(u)

      clazz = case k
      when "expiring-elements" then "ExpiringBucketLifecycleManager"
      when "build-log" then "StdoutUpload"
      when "classic" then "ClassicUpload"
      else raise "Unknown upload type #{k}"
      end
      clazz = "com.google.jenkins.plugins.storage.#{clazz}"

      xml.tag! clazz do
        xml.bucketNameWithVars v["bucket-name"] || v["storage-location"]
        xml.sharedPublicly boolp(v["share-publicly"], false)
        xml.forFailedJobs boolp(v["upload-for-failed-jobs"], false)
        if had[k]
          xml.module :reference => "../../#{clazz}/module"
        else
          xml.module
        end

        case k
        when "expiring-elements" then
          xml.bucketObjectTTL v["days-to-retain"]
        when "build-log" then
          xml.logName v["log-name"]
        when "classic" then
          xml.sourceGlobWithVars v["file-pattern"]
        end
      end

      had[k] = true
    end # for u in uploads
  end

end

#translate_groovy_postbuild_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/cigale/publisher/groovy-postbuild.rb', line 2

def translate_groovy_postbuild_publisher (xml, pdef)
  case pdef
  when String
    xml.behavior 0
    xml.groovyScript pdef
  else
    xml.behavior 1
    xml.groovyScript pdef["script"]
  end
end

#translate_html_publisher_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/cigale/publisher/html-publisher.rb', line 2

def translate_html_publisher_publisher (xml, pdef)
  xml.reportTargets do
    xml.tag! "htmlpublisher.HtmlPublisherTarget" do
      xml.reportName pdef["name"]
      xml.reportDir pdef["dir"]
      xml.reportFiles pdef["files"]
      xml.keepAll pdef["keep-all"]
      xml.allowMissing pdef["allow-missing"]
      xml.wrapperName "htmlpublisher-wrapper.html"
    end
  end
end


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cigale/publisher/image-gallery.rb', line 2

def translate_image_gallery_publisher (xml, pdef)
  xml.imageGalleries do
    for gallery in pdef
      type = gallery["gallery-type"] || "archived-images-gallery"
      clazz = case type
      when "archived-images-gallery"
        "org.jenkinsci.plugins.imagegallery.imagegallery.ArchivedImagesGallery"
      when "in-folder-comparative-gallery"
        "org.jenkinsci.plugins.imagegallery.comparative.InFolderComparativeArchivedImagesGallery"
      when "multiple-folder-comparative-gallery"
        "org.jenkinsci.plugins.imagegallery.comparative.MultipleFolderComparativeArchivedImagesGallery"
      else
        raise "Unknown image gallery type: '#{type}'"
      end

      xml.tag! clazz do
        xml.title gallery["title"]
        imwidth = gallery["image-width"] and xml.imageWidth imwidth
        xml.markBuildAsUnstableIfNoArchivesFound boolp(gallery["unstable-if-no-artifacts"], false)
        baseroot = gallery["base-root-folder"]
        if baseroot || type != "archived-images-gallery"
          xml.baseRootFolder baseroot
        end

        includes = gallery["includes"]
        if includes || type == "archived-images-gallery"
          xml.includes includes
        end
        inwidth = gallery["image-inner-width"] and xml.imageInnerWidth inwidth
      end
    end # for gallery in pdef
  end # xml.imageGalleries
end

#translate_individual_publisher(xml, p) ⇒ Object

translate_publishers



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/cigale/publisher.rb', line 189

def translate_individual_publisher (xml, p)
  type, spec = asplode p

  clazz = publisher_classes[type]

  method = method_for_translate("publisher", type)

  case clazz
  when String
    xml.publisher :class => clazz do
      self.send method, xml, spec
    end
  when Array
    xml.publisher({:class => clazz[0]}.merge(clazz[1])) do
      self.send method, xml, spec
    end
  else
    raise "Invalid individual publisher: #{clazz}"
  end
end

#translate_ircbot_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cigale/publisher/ircbot.rb', line 2

def translate_ircbot_publisher (xml, pdef)
  xml.buildToChatNotifier :class => "hudson.plugins.im.build_notify.DefaultBuildToChatNotifier"
  xml.strategy (pdef["strategy"] || "all").upcase
  xml.targets do
    for chan in pdef["channels"]
      xml.tag! "hudson.plugins.im.GroupChatIMMessageTarget" do
        xml.name chan["name"]
        xml.password chan["password"]
        xml.notificationOnly chan["notify-only"]
      end
    end
  end

  xml.notifyOnBuildStart boolp(pdef["notify-start"], false)
  xml.notifySuspects boolp(pdef["notify-committers"], false)
  xml.notifyCulprits boolp(pdef["notify-culprits"], false)
  xml.notifyFixers boolp(pdef["notify-fixers"], false)
  xml.notifyUpstreamCommitters boolp(pdef["notify-upstream"], false)
  xml.matrixMultiplier (pdef["matrix-notifier"] || "only-configurations").gsub("-", "_").upcase
end

#translate_jabber_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cigale/publisher/jabber.rb', line 2

def translate_jabber_publisher (xml, pdef)
  xml.targets do
    for gt in toa pdef["group-targets"]
      xml.tag! "hudson.plugins.im.GroupChatIMMessageTarget" do
        xml.name gt
        xml.notificationOnly false
      end
    end

    for it in toa pdef["individual-targets"]
      xml.tag! "hudson.plugins.im.DefaultIMMessageTarget" do
        xml.value it
      end
    end
  end

  xml.strategy (pdef["strategy"] || "all").upcase
  xml.notifyOnBuildStart pdef["notify-on-build-start"]
  xml.notifySuspects false
  xml.notifyCulprits false
  xml.notifyFixers false
  xml.notifyUpstreamCommitters false
  xml.buildToChatNotifier :class => "hudson.plugins.im.build_notify.DefaultBuildToChatNotifier"
  xml.matrixMultiplier "ONLY_CONFIGURATIONS"
end

#translate_jacoco_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cigale/publisher/jacoco.rb', line 2

def translate_jacoco_publisher (xml, pdef)
  xml.execPattern pdef["exec-pattern"]
  xml.classPattern pdef["class-pattern"]
  xml.sourcePattern pdef["source-pattern"]
  xml.changeBuildStatus
  xml.inclusionPattern
  xml.exclusionPattern

  targets = pdef["targets"] || {}

  for target in targets
    k, v = first_pair(target)
    xml.tag! "maximum#{k.capitalize}Coverage", v["healthy"]
    xml.tag! "minimum#{k.capitalize}Coverage", v["unhealthy"]
  end
end

#translate_javadoc_publisher(xml, pdef) ⇒ Object



2
3
4
5
# File 'lib/cigale/publisher/javadoc.rb', line 2

def translate_javadoc_publisher (xml, pdef)
  xml.javadocDir pdef["directory"]
  xml.keepAll pdef["keep-all-successful"]
end

#translate_jclouds_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/cigale/publisher/jclouds.rb', line 2

def translate_jclouds_publisher (xml, pdef)
  xml.profileName pdef["profile"]
  xml.entries do
    xml.tag! "jenkins.plugins.jclouds.blobstore.BlobStoreEntry" do
      xml.container pdef["container"]
      xml.path pdef["basedir"]
      xml.sourceFile pdef["files"]
      xml.keepHierarchy false
    end
  end # entries
end

#translate_jira_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/jira.rb', line 2

def translate_jira_publisher (xml, pdef)
  xml.tag! "hudson.plugins.jira.JiraIssueUpdater"
end

#translate_join_trigger_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
# File 'lib/cigale/publisher/join-trigger.rb', line 2

def translate_join_trigger_publisher (xml, pdef)
  xml.joinProjects pdef["projects"].join(",")
  translate_publishers xml, "joinPublishers", pdef["publishers"]

  xml.evenIfDownstreamUnstable pdef["even-if-unstable"]
end

#translate_junit_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cigale/publisher/junit.rb', line 2

def translate_junit_publisher (xml, pdef)
  xml.testResults pdef["results"]
  xml.keepLongStdio boolp(pdef["keep-long-stdio"], true)
  xml.healthScaleFactor pdef["health-scale-factor"] || 1.0

  stab = pdef["test-stability"]
  claim = pdef["claim-build"]
  plots = pdef["measurement-plots"]
  if stab || claim || plots
    xml.testDataPublishers do
      stab and xml.tag! "de.esailors.jenkins.teststability.StabilityTestDataPublisher"
      claim and xml.tag! "hudson.plugins.claim.ClaimTestDataPublisher"
      plots and xml.tag! "hudson.plugins.measurement__plots.TestDataPublisher"
    end
  else
    xml.testDataPublishers
  end
end

#translate_logparser_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
# File 'lib/cigale/publisher/logparser.rb', line 2

def translate_logparser_publisher (xml, pdef)
  xml.unstableOnWarning pdef["unstable-on-warning"]
  xml.failBuildOnError pdef["fail-on-error"]
  xml.parsingRulesPath pdef["parse-rules"]
end

#translate_logstash_publisher(xml, pdef) ⇒ Object



2
3
4
5
# File 'lib/cigale/publisher/logstash.rb', line 2

def translate_logstash_publisher (xml, pdef)
  xml.maxLines pdef["max-lines"] || 1000
  xml.failBuild boolp(pdef["fail-build"], false)
end

#translate_maven_deploy_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/cigale/publisher/maven-deploy.rb', line 2

def translate_maven_deploy_publisher (xml, pdef)
  xml.id pdef["id"]
  xml.url pdef["url"]
  xml.uniqueVersion pdef["unique-version"]
  xml.evenIfUnstable pdef["deploy-unstable"]
  xml.releaseEnvVar pdef["release-env-var"]
end

#translate_naginator_publisher(xml, pdef) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cigale/publisher/naginator.rb', line 3

def translate_naginator_publisher (xml, pdef)
  re = pdef["regular-expression"]
  xml.regexpForRerun re
  xml.checkRegexp !re.nil?

  xml.rerunIfUnstable boolp(pdef["rerun-unstable-builds"], false)

  pinc = pdef["progressive-delay-increment"]
  pmax = pdef["progressive-delay-maximum"]
  if pinc
    xml.delay :class => "com.chikli.hudson.plugin.naginator.ProgressiveDelay" do
      xml.increment pinc
      xml.max pmax
    end
  else
    xml.delay :class => "com.chikli.hudson.plugin.naginator.FixedDelay" do
      xml.delay pdef["fixed-delay"] || 0
    end
  end
  xml.maxSchedule pdef["max-failed-builds"] || 0
end

#translate_performance_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cigale/publisher/performance.rb', line 2

def translate_performance_publisher (xml, pdef)
  xml.errorFailedThreshold pdef["failed-threshold"]
  xml.errorUnstableThreshold pdef["unstable-threshold"]

  xml.parsers do
    for report in toa pdef["report"]
      k = report
      v = nil
      if Hash === report
        k, v = first_pair(report)
      end

      clazz = case k
      when "jmeter"
        v ||= "**/*.jtl"
        "JMeterParser"
      when "junit"
        v ||= "**/TEST-*.xml"
        "JUnitParser"
      else
        raise "Unknown performance parser: #{k}"
      end

      xml.tag! "hudson.plugins.performance.#{clazz}" do
        xml.glob v
      end
    end
  end # parsers
end

#translate_pipeline_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cigale/publisher/pipeline.rb', line 2

def translate_pipeline_publisher (xml, pdef)
  currpar = pdef["current-parameters"]
  predpar = pdef["predefined-parameters"]

  if currpar || predpar
    xml.configs do
      predpar and xml.tag! "hudson.plugins.parameterizedtrigger.PredefinedBuildParameters" do
        xml.properties predpar
      end
      currpar and xml.tag! "hudson.plugins.parameterizedtrigger.CurrentBuildParameters"
    end
  else
    xml.configs
  end

  xml.downstreamProjectNames pdef["project"]
end

#translate_plot_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cigale/publisher/plot.rb', line 2

def translate_plot_publisher (xml, pdef)
  xml.plots do
    for plot in pdef
      xml.tag! "hudson.plugins.plot.Plot" do
        if title = plot["title"] and not title.empty?
          xml.title title
        else
          xml.title
        end
        if yaxis = plot["yaxis"] and not yaxis.empty?
          xml.yaxis yaxis
        else
          xml.yaxis
        end
        xml.csvFileName plot["csv-file-name"]

        xml.series do
          for serie in plot["series"]
            case serie["format"]
            when "csv"
              xml.tag! "hudson.plugins.plot.CSVSeries" do
                xml.file serie["file"]
                xml.inclusionFlag serie["inclusion-flag"].upcase
                xml.exclusionValues
                if url = serie["url"] and not url.empty?
                  xml.url url
                else
                  xml.url
                end
                xml.displayTableFlag serie["display-table"]
                xml.fileType serie["format"]
              end
            when "properties"
              xml.tag! "hudson.plugins.plot.PropertiesSeries" do
                xml.file serie["file"]
                xml.label serie["label"]
                xml.fileType serie["format"]
              end
            when "xml"
              xml.tag! "hudson.plugins.plot.XMLSeries" do
                xml.file serie["file"]
                if url = serie["url"] and not url.empty?
                  xml.url url
                else
                  xml.url
                end
                xml.xpathString serie["xpath"]
                xml.nodeTypeString serie["xpath-type"].upcase
                xml.fileType serie["format"]
              end
            else
              raise "Unknown serie format for plot: #{serie["format"]}"
            end
          end
        end # series

        xml.group plot["group"]
        xml.useDescr plot["use-description"]
        xml.exclZero boolp(plot["exclude-zero-yaxis"], false)
        xml.logarithmic boolp(plot["logarithmic-yaxis"], false)
        xml.keepRecords boolp(plot["keep-records"], false)
        xml.numBuilds
        xml.style plot["style"]
      end # plot
    end # for plot in plots

  end # plots
end

#translate_pmd_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cigale/publisher/pmd.rb', line 2

def translate_pmd_publisher (xml, pdef)
  xml.healthy pdef["healthy"]
  xml.unHealthy pdef["unhealthy"]
  xml.thresholdLimit pdef["health-threshold"] || "low"
  xml.pluginName "[PMD] "
  xml.defaultEncoding pdef["default-encoding"]
  xml.canRunOnFailed boolp(pdef["can-run-on-failed"], false)
  xml.useStableBuildAsReference boolp(pdef["use-stable-build-as-reference"], false)
  xml.useDeltaValues boolp(pdef["use-delta-values"], false)

  xml.thresholds do
    thresholds = pdef["thresholds"] || {}
    uthresh = thresholds["unstable"] || {}
    fthresh = thresholds["failed"] || {}

    %w(unstable failed).each do |a|
      %w(total new).each do |b|
        %w(all high normal low).each do |c|
          val = (thresholds[a] || {})["#{b}-#{c}"]

          unless (b == "new" && !val)
            xml.tag! "#{a}#{b.capitalize}#{c.capitalize}", val
          end
        end
      end
    end
  end

  xml.shouldDetectModules boolp(pdef["should-detect-modules"], false)
  xml.dontComputeNew boolp(pdef["dont-compute-new"], true)
  xml.doNotResolveRelativePaths boolp(pdef["do-not-resolve-relative-paths"], false)
  xml.pattern pdef["pattern"]
end

#translate_post_tasks_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cigale/publisher/post-tasks.rb', line 2

def translate_post_tasks_publisher (xml, pdef)
  xml.tasks do
    for task in pdef
      xml.tag! "hudson.plugins.postbuildtask.TaskProperties" do
        log_texts = []
        for m in task["matches"]
          if m["log-text"]
            log_texts << m
          end
        end

        xml.logTexts do
          for lt in log_texts
            xml.tag! "hudson.plugins.postbuildtask.LogProperties" do
              xml.logText lt["log-text"]
              xml.operator lt["operator"]
            end
          end
        end

        xml.EscalateStatus task["escalate-status"]
        xml.RunIfJobSuccessful task["run-if-job-successful"]
        xml.script task["script"]
      end # TaskProperties
    end # for task in pdef
  end # xml.tasks
end

#translate_postbuildscript_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/postbuildscript.rb', line 2

def translate_postbuildscript_publisher (xml, pdef)
  if builders = pdef["builders"]
    translate_builders xml, "buildSteps", builders
  end

  if generic = pdef["generic-script"]
    xml.genericScriptFileList do
      for e in generic
        xml.tag! "org.jenkinsci.plugins.postbuildscript.GenericScript" do
          xml.filePath e
        end
      end
    end
  end

  if groovyscript = pdef["groovy-script"]
    xml.groovyScriptFileList do
      for e in groovyscript
        xml.tag! "org.jenkinsci.plugins.postbuildscript.GroovyScriptFile" do
          xml.filePath e
        end
      end
    end
  end

  if groovy = pdef["groovy"]
    xml.groovyScriptContentList do
      for e in groovy
        xml.tag! "org.jenkinsci.plugins.postbuildscript.GroovyScriptContent" do
          xml.content e
        end
      end
    end
  end

  xml.scriptOnlyIfSuccess boolp(pdef["script-only-if-succeeded"], true)
  xml.scriptOnlyIfFailure boolp(pdef["script-only-if-failed"], false)

  on = pdef["execute-on"] and xml.executeOn on.upcase
end

#translate_publishers(xml, tag, publishers) ⇒ Object



174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/cigale/publisher.rb', line 174

def translate_publishers (xml, tag, publishers)
  publishers = toa publishers
  if publishers.empty?
    return xml.tag! tag
  end

  xml.tag! tag do
    for p in publishers
      type, spec = asplode p
      translate("publisher", xml, type, spec)
    end # for p in publishers
  end

end

#translate_rich_text_publisher_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/cigale/publisher/rich-text-publisher.rb', line 2

def translate_rich_text_publisher_publisher (xml, pdef)
  xml.stableText pdef["stable-text"]
  xml.unstableText pdef["unstable-text"]
  xml.failedText pdef["failed"]
  xml.unstableAsStable (not pdef.has_key?("unstable-text"))
  xml.failedAsStable true
  xml.parserName pdef["parser-name"]
end

#translate_robot_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cigale/publisher/robot.rb', line 2

def translate_robot_publisher (xml, pdef)
  xml.outputPath pdef["output-path"]
  xml.logFileLink pdef["log-file-link"]
  xml.reportFileName pdef["report-html"]
  xml.logFileName pdef["log-html"]
  xml.outputFileName pdef["output-xml"]
  xml.passThreshold pdef["pass-threshold"]
  xml.unstableThreshold pdef["unstable-threshold"]
  xml.onlyCritical pdef["only-critical"]
  xml.otherFiles do
    for f in pdef["other-files"] do
      xml.string f
    end
  end

  xml.disableArchiveOutput !pdef["archive-output-xml"]
end

#translate_ruby_metrics_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cigale/publisher/ruby-metrics.rb', line 2

def translate_ruby_metrics_publisher (xml, pdef)
  xml.reportDir pdef["report-dir"]
  target = {}
  for t in pdef["target"]
    k, v = first_pair(t)
    target[k] = v
  end

  xml.targets do
    %w(total code).each do |a|
      covs = target["#{a}-coverage"] || {}

      xml.tag! "hudson.plugins.rubyMetrics.rcov.model.MetricTarget" do
        xml.metric "#{a.upcase}_COVERAGE"

        %w(healthy unhealthy unstable).each do |b|
          xml.tag! b, covs[b]
        end
      end
    end
  end
end

#translate_s3_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cigale/publisher/s3.rb', line 2

def translate_s3_publisher (xml, pdef)
  xml.profileName pdef["s3-profile"]

  xml.entries do
    for e in toa(pdef["entries"])
      xml.tag! "hudson.plugins.s3.Entry" do
        xml.bucket e["destination-bucket"]
        xml.sourceFile e["source-files"]
        xml.storageClass e["storage-class"] || "STANDARD"
        xml.selectedRegion e["bucket-region"] || "us-east-1"
        xml.noUploadOnFailure boolp(!e["upload-on-failure"], true)
        xml.uploadFromSlave boolp(e["upload-from-slave"], false)
        xml.managedArtifacts boolp(e["managed-artifacts"], false)
      end
    end
  end # entries

  xml. do
    for tag in toa(pdef["metadata-tags"])
      xml.tag! "hudson.plugins.s3.MetadataPair" do
        xml.key tag["key"]
        xml.value tag["value"]
      end
    end
  end # userMetadata

end

#translate_scan_build_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
# File 'lib/cigale/publisher/scan-build.rb', line 2

def translate_scan_build_publisher (xml, pdef)
  xml.markBuildUnstableWhenThresholdIsExceeded boolp(pdef["mark-unstable"], false)
  xml.bugThreshold pdef["threshold"] || 0
  xml.clangexcludedpaths pdef["exclude-paths"]
end

#translate_scoverage_publisher(xml, pdef) ⇒ Object



2
3
4
5
# File 'lib/cigale/publisher/scoverage.rb', line 2

def translate_scoverage_publisher (xml, pdef)
  xml.reportDir pdef["report-directory"]
  xml.reportFile pdef["report-file"]
end

#translate_scp_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cigale/publisher/scp.rb', line 2

def translate_scp_publisher (xml, pdef)
  xml.siteName pdef["site"]
  xml.entries do
    for f in pdef["files"]
      xml.tag! "be.certipost.hudson.plugin.Entry" do
        xml.filePath f["target"]
        xml.sourceFile f["source"]
        xml.keepHierarchy f["keep-hierarchy"]
        xml.copyConsoleLog false
        xml.copyAfterFailure f["copy-after-failure"]
      end # Entry
    end # for f in files
  end # entries

end

#translate_shining_panda_publisher(xml, pdef) ⇒ Object



2
3
4
# File 'lib/cigale/publisher/shining-panda.rb', line 2

def translate_shining_panda_publisher (xml, pdef)
  xml.htmlDir pdef["html-reports-directory"]
end

#translate_sitemonitor_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/cigale/publisher/sitemonitor.rb', line 2

def translate_sitemonitor_publisher (xml, pdef)
  xml.mSites do
    for site in pdef["sites"]
      xml.tag! "hudson.plugins.sitemonitor.model.Site" do
        xml.mUrl site["url"]
      end
    end # for site
  end # xml.mSites
end

#translate_sloccount_publisher(xml, pdef) ⇒ Object



2
3
4
5
# File 'lib/cigale/publisher/sloccount.rb', line 2

def translate_sloccount_publisher (xml, pdef)
  xml.pattern pdef["report-files"]
  xml.encoding pdef["charset"]
end

#translate_sonar_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cigale/publisher/sonar.rb', line 2

def translate_sonar_publisher (xml, pdef)
  xml.jdk pdef["jdk"]
  xml.branch pdef["branch"]
  xml.language pdef["language"]
  xml.rootPom pdef["root-pom"] || "pom.xml"
  xml.usePrivateRepository boolp(pdef["private-maven-repo"], false)
  xml.mavenOpts pdef["maven-opts"]
  xml.jobAdditionalProperties pdef["additional-properties"]

  skips = pdef["skip-global-triggers"]
  xml.triggers do
    xml.skipScmCause skips["skip-when-scm-change"]
    xml.skipUpstreamCause skips["skip-when-upstream-build"]
    xml.envVar skips["skip-when-envvar-defined"]
  end

  if set = pdef["settings"]
    xml.settings :class => "org.jenkinsci.plugins.configfiles.maven.job.MvnSettingsProvider" do
      xml.settingsConfigId set
    end
  else
    xml.settings :class => "jenkins.mvn.DefaultSettingsProvider"
  end

  if gset = pdef["global-settings"]
    xml.globalSettings :class => "org.jenkinsci.plugins.configfiles.maven.job.MvnGlobalSettingsProvider" do
      xml.settingsConfigId gset
    end
  else
    xml.globalSettings :class => "jenkins.mvn.DefaultGlobalSettingsProvider"
  end
end

#translate_ssh_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cigale/publisher/ssh.rb', line 2

def translate_ssh_publisher (xml, pdef)
  xml.consolePrefix "SSH: "

  xml.delegate do
    xml.publishers do
      xml.tag! "jenkins.plugins.publish__over__ssh.BapSshPublisher" do
        xml.configName pdef["site"]
        xml.verbose true
        xml.transfers do
          xml.tag! "jenkins.plugins.publish__over__ssh.BapSshTransfer" do
            xml.remoteDirectory pdef["target"]
            xml.sourceFiles pdef["source"]
            xml.execCommand pdef["command"]
            xml.execTimeout pdef["timeout"]
            xml.usePty pdef["use-pty"]
            xml.excludes pdef["excludes"]
            xml.removePrefix pdef["remove-prefix"]
            xml.remoteDirectorySDF false
            xml.flatten pdef["flatten"]
            xml.cleanRemote false
          end # BapSshTransfer
        end # transfers

        xml.useWorkspaceInPromotion false
        xml.usePromotionTimestamp false
      end # BapSshPublisher
    end # publishers

    xml.continueOnError false
    xml.failOnError false
    xml.alwaysPublishFromMaster false
    xml.hostConfigurationAccess :class => "jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin", :reference => "../.."
  end # delegate
end

#translate_stash_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/cigale/publisher/stash.rb', line 2

def translate_stash_publisher (xml, pdef)
  xml.stashServerBaseUrl pdef["url"]
  xml.stashUserName pdef["username"]
  xml.stashUserPassword pdef["password"]
  xml.ignoreUnverifiedSSLPeer pdef["ignore-ssl"]
  xml.commitSha1 pdef["commit-sha1"]
  xml.includeBuildNumberInKey pdef["include-build-number"]
end

#translate_tap_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/cigale/publisher/tap.rb', line 2

def translate_tap_publisher (xml, pdef)
  xml.testResults pdef["results"]
  xml.failIfNoResults false
  xml.failedTestsMarkBuildAsFailure false
  xml.outputTapToConsole true
  xml.enableSubtests true
  xml.discardOldReports false
  xml.todoIsFailure pdef["todo-is-failure"]
end

#translate_testng_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
# File 'lib/cigale/publisher/testng.rb', line 2

def translate_testng_publisher (xml, pdef)
  xml.reportFilenamePattern pdef["pattern"]
  xml.escapeTestDescp pdef["escape-test-description"]
  xml.escapeExceptionMsg pdef["escape-exception-msg"]
end

#translate_text_finder_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/cigale/publisher/text-finder.rb', line 2

def translate_text_finder_publisher (xml, pdef)
  xml.fileSet pdef["fileset"]
  xml.regexp pdef["regexp"]
  xml.alsoCheckConsoleOutput pdef["also-check-console-output"]
  xml.succeedIfFound pdef["succeed-if-found"]
  xml.unstableIfFound pdef["unstable-if-found"]
end

#translate_trigger_parameterized_builds_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
54
55
56
57
58
# File 'lib/cigale/publisher/trigger-parameterized-builds.rb', line 2

def translate_trigger_parameterized_builds_publisher (xml, pdef)
  xml.configs do
    for b in toa pdef
      xml.tag! "hudson.plugins.parameterizedtrigger.BuildTriggerConfig" do
        xml.configs do
          if current = b["current-parameters"]
            xml.tag! "hudson.plugins.parameterizedtrigger.CurrentBuildParameters"
          end
          if node = b["node-parameters"]
            xml.tag! "hudson.plugins.parameterizedtrigger.NodeParameters"
          end

          if predef = b["predefined-parameters"]
            xml.tag! "hudson.plugins.parameterizedtrigger.PredefinedBuildParameters" do
              xml.properties predef
            end
          end

          if propfile = b["property-file"]
            xml.tag! "hudson.plugins.parameterizedtrigger.FileBuildParameters" do
              xml.propertiesFile propfile
              xml.failTriggerOnMissing true
            end
          end

          if gitrev = b["git-revision"]
            xml.tag! "hudson.plugins.git.GitRevisionBuildParameters" do
              xml.combineQueuedCommits false
            end
          end

          if matrix = b["restrict-matrix-project"]
            xml.tag! "hudson.plugins.parameterizedtrigger.matrix.MatrixSubsetBuildParameters" do
              xml.filter matrix
            end
          end

          if b["node-label"] || b["node-label-name"]
            xml.tag! "org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger.NodeLabelBuildParameter" do
              xml.name b["node-label-name"]
              xml.nodeLabel b["node-label"]
            end
          end

        end # configs

        projects = b["project"]
        if Array === projects
          projects = projects.join(",")
        end
        xml.projects projects
        xml.condition (b["condition"] || "always").upcase
        xml.triggerWithNoParameters boolp(b["trigger-with-no-params"], false)
      end # BuildTriggerConfig
    end # for b in pdef
  end
end

#translate_trigger_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
# File 'lib/cigale/publisher/trigger.rb', line 2

def translate_trigger_publisher (xml, pdef)
  xml.childProjects pdef["project"]
  xml.threshold do
    translate_build_status xml, pdef["threshold"], false
  end
end

#translate_valgrind_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cigale/publisher/valgrind.rb', line 2

def translate_valgrind_publisher (xml, pdef)
  xml.valgrindPublisherConfig do
    xml.pattern pdef["pattern"]

    @valgrind_thresholds ||= {
      "invalid-read-write" => "InvalidReadWrite",
      "definitely-lost" => "DefinitelyLost",
      "total" => "Total",
    }

    thresholds = pdef["thresholds"] || {}
    %w(unstable fail).each do |a|
      aa = case a
      when "fail"
        "failed"
      else
        a
      end

      thresh = thresholds[aa] || {}

      %w(invalid-read-write definitely-lost total).each do |b|
        val = thresh[b] and xml.tag! "#{a}Threshold#{@valgrind_thresholds[b]}", val
      end
    end

    xml.failBuildOnMissingReports pdef["fail-no-reports"]
    xml.failBuildOnInvalidReports pdef["fail-invalid-reports"]
    xml.publishResultsForAbortedBuilds pdef["publish-if-aborted"]
    xml.publishResultsForFailedBuilds pdef["publish-if-failed"]
  end # valgrindPublisherConfig
end

#translate_violations_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/violations.rb', line 2

def translate_violations_publisher (xml, pdef)
  xml.config do
    xml.suppressions :class => "tree-set" do
      xml.tag! "no-comparator"
    end

    xml.typeConfigs do
      xml.tag! "no-comparator"

      %w(checkstyle codenarc cpd cpplint csslint findbugs fxcop gendarme jcreport jslint pep8 perlcritic pmd pylint simian stylecop).each do |type|
        spec = pdef[type] || {}

        xml.entry do
          xml.string type
          xml.tag! "hudson.plugins.violations.TypeConfig" do
            xml.type type
            xml.min spec["min"] || 10
            xml.max spec["max"] || 999
            xml.unstable spec["unstable"] || 999
            xml.usePattern false # XXX that sounds wrong..
            if pattern = spec["pattern"]
              xml.pattern pattern
            else
              xml.pattern
            end
          end # TypeConfig
        end # entry

      end # %w().each do |type|
    end # typeConfigs

    xml.limit 100
    xml.sourcePathPattern
    xml.fauxProjectPath
    xml.encoding "default"
  end # xml.config
end

#translate_warnings_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
# File 'lib/cigale/publisher/warnings.rb', line 2

def translate_warnings_publisher (xml, pdef)
  xml.consoleParsers do
    for parser in pdef["console-log-parsers"]
      xml.tag! "hudson.plugins.warnings.ConsoleParser" do
        xml.parserName parser
      end
    end
  end

  xml.parserConfigurations do
    for scanner in pdef["workspace-file-scanners"]
      xml.tag! "hudson.plugins.warnings.ParserConfiguration" do
        xml.pattern scanner["file-pattern"]
        xml.parserName scanner["scanner"]
      end
    end
  end

  xml.includePattern pdef["files-to-include"]
  xml.excludePattern pdef["files-to-ignore"]
  xml.canRunOnFailed pdef["run-always"]
  xml.shouldDetectModules pdef["detect-modules"]
  xml.doNotResolveRelativePaths !pdef["resolve-relative-paths"]
  xml.healthy pdef["health-threshold-high"]
  xml.unHealthy pdef["health-threshold-low"]
  xml.thresholdLimit pdef["health-priorities"].split("-").last # XXX wat

  xml.thresholds do
    %w(total new).each do |b|
      %w(unstable failed).each do |a|
        %w(all high normal low).each do |c|
          val = ((pdef["#{b}-thresholds"] || {})[a] || {})["#{b}-#{c}"]
          val and xml.tag! "#{a}#{b.capitalize}#{c.capitalize}", val
        end
      end
    end
  end

  xml.dontComputeNew false
  xml.useDeltaValues pdef["use-delta-for-new-warnings"]
  xml.useStableBuildAsReference pdef["only-use-stable-builds-as-reference"]
  xml.defaultEncoding pdef["default-encoding"]
end

#translate_workspace_cleanup_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cigale/publisher/workspace-cleanup.rb', line 2

def translate_workspace_cleanup_publisher (xml, pdef)
  translate_wscleanup_base xml, pdef
  xml.cleanupMatrixParent boolp(pdef["cleanup-parent"], false)

  clean = {}
  for c in pdef["clean-if"]
    k, v = first_pair(c)
    clean[k] = v
  end

  xml.cleanWhenSuccess boolp(clean["success"], false)
  xml.cleanWhenUnstable boolp(clean["unstable"], true)
  xml.cleanWhenFailure boolp(clean["failure"], true)
  xml.cleanWhenNotBuilt boolp(clean["not-built"], true)
  xml.cleanWhenAborted boolp(clean["aborted"], true)
  xml.notFailBuild true
end

#translate_wscleanup_base(xml, spec) ⇒ Object

translate



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cigale/publisher/workspace-cleanup.rb', line 20

def translate_wscleanup_base (xml, spec)
  xml.patterns do
    %w(include exclude).each do |k|
      for patt in toa(spec[k])
        xml.tag! "hudson.plugins.ws__cleanup.Pattern" do
          xml.pattern patt
          xml.type k.upcase
        end
      end
    end
  end

  xml.deleteDirs boolp(spec["delete-dirs"], false)
end

#translate_xml_summary_publisher(xml, pdef) ⇒ Object



2
3
4
5
# File 'lib/cigale/publisher/xml-summary.rb', line 2

def translate_xml_summary_publisher (xml, pdef)
  xml.name pdef["files"]
  xml.shownOnProjectPage boolp(pdef["shown-on-project-page"], false)
end

#translate_xunit_publisher(xml, pdef) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
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
54
55
56
57
58
59
# File 'lib/cigale/publisher/xunit.rb', line 2

def translate_xunit_publisher (xml, pdef)
  @xunit_test_types ||= {
    "phpunit" => "PHPUnitJunitHudsonTestType",
    "cppunit" => "CppUnitJunitHudsonTestType",
    "gtest" => "GoogleTestType",
    "ctest" => "CTestType",
  }

  xml.types do
    types = {}
    for t in pdef["types"] do
      k, v = first_pair(t)
      types[k] = v
    end

    %w(phpunit cppunit gtest ctest).each do |a|
      spec = types[a]
      next unless spec

      xml.tag! @xunit_test_types[a] do
        xml.pattern spec["pattern"]
        xml.failIfNotNew boolp(spec["fail-if-not-new"], true) # XXX
        xml.deleteOutputFiles boolp(spec["delete-output-files"], true) # XXX
        xml.skipNoTestFiles boolp(spec["skip-if-no-test-files"], false)
        xml.stopProcessingIfError boolp(spec["stop-on-error"], true)
      end
    end
  end

  xml.thresholds do
    thresholds = {}
    for t in pdef["thresholds"]
      k, v = first_pair(t)
      thresholds[k] = v
    end

    %w(failed skipped).each do |a|
      xml.tag! "org.jenkinsci.plugins.xunit.threshold.#{a.capitalize}Threshold" do
        %w(unstable failure).each do |b|
          ["", "new"].each do |c|
            val = (thresholds[a] || {})["#{b}#{c}"]
            val = nil if val == 0
            xml.tag! "#{b}#{c.capitalize}Threshold", val
          end
        end
      end
    end
  end

  @xunit_threshold_modes ||= {
    "number" => 1,
    "percent" => 2,
  }
  xml.thresholdMode @xunit_threshold_modes[pdef["thresholdmode"]]
  xml.extraConfiguration do
    xml.testTimeMargin pdef["test-time-margin"] || 3000
  end
end