module Cigale::Parameter

Public Instance Methods

parameter_classes() click to toggle source
# File lib/cigale/parameter.rb, line 14
def parameter_classes
  @parameter_classes ||= {
    "dynamic-choice" => "com.seitenbau.jenkins.plugins.dynamicparameter.ChoiceParameterDefinition",
    "extended-choice" => "com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition",
    "matrix-combinations" => "hudson.plugins.matrix__configuration__parameter.MatrixCombinationsParameterDefinition",
    "node" => "org.jvnet.jenkins.plugins.nodelabelparameter.NodeParameterDefinition",
    "string" => "hudson.model.StringParameterDefinition",
    "bool" => "hudson.model.BooleanParameterDefinition",
    "run" => "hudson.model.RunParameterDefinition",
  }
end
translate_bool_parameter(xml, pdef) click to toggle source
# File lib/cigale/parameter/bool.rb, line 2
def translate_bool_parameter (xml, pdef)
  xml.name pdef["name"]
  xml.description pdef["description"]
  default = pdef["default"]
  if default.nil? || default == ''
    xml.defaultValue
  else
    xml.defaultValue default
  end
end
translate_dynamic_choice_parameter(xml, pdef) click to toggle source
# File lib/cigale/parameter/dynamic-choice.rb, line 2
def translate_dynamic_choice_parameter (xml, pdef)
  xml.name pdef["name"]
  xml.description pdef["description"]
  xml.__remote pdef["remote"]
  xml.__script pdef["script"]
  xml.__localBaseDirectory :serialization => "custom" do
    xml.tag! "hudson.FilePath" do
      xml.default do
        xml.remote "/var/lib/jenkins/dynamic_parameter/classpath"
      end
      xml.boolean true
    end
  end

  xml.__remoteBaseDirectory "dynamic_parameter_classpath"
  xml.__classPath
  xml.readonlyInputField false
end
translate_extended_choice_parameter(xml, pdef) click to toggle source
# File lib/cigale/parameter/extended-choice.rb, line 2
def translate_extended_choice_parameter (xml, pdef)
  xml.name pdef["name"]
  xml.description pdef["description"]
  xml.value pdef["value"]
  xml.visibleItemCount pdef["visible-item-count"] || 2
  xml.multiSelectDelimiter pdef["multi-select-delimiter"] || ","
  xml.quoteValue boolp(pdef["quote-value"], false)
  xml.defaultValue pdef["default-value"]
  type = pdef["type"]
  unless type.start_with? "PT_"
    type = "pt-#{type}".gsub("-", "_").upcase
  end
  xml.type type
  xml.propertyFile pdef["property-file"]
  xml.propertyKey pdef["property-key"]
  xml.defaultPropertyFile pdef["default-property-file"]
  xml.defaultPropertyKey pdef["default-property-key"]
end
translate_matrix_combinations_parameter(xml, pdef) click to toggle source
# File lib/cigale/parameter/matrix-combinations.rb, line 2
def translate_matrix_combinations_parameter (xml, pdef)
  xml.name pdef["name"]
  xml.description pdef["description"]
  xml.defaultCombinationFilter pdef["filter"]
end
translate_node_parameter(xml, pdef) click to toggle source
# File lib/cigale/parameter/node.rb, line 2
def translate_node_parameter (xml, pdef)
  xml.name pdef["name"]
  xml.description pdef["description"]

  ds = toa pdef["default-slaves"]
  if ds.empty?
    xml.defaultSlaves
  else
    xml.defaultSlaves do
      for s in ds
        xml.string s
      end
    end
  end

  as = toa pdef["allowed-slaves"]
  if as.empty?
    xml.allowedSlaves
  else
    xml.allowedSlaves do
      for s in as
        xml.string s
      end
    end
  end

  xml.ignoreOfflineNodes pdef["ignore-offline-nodes"]

  multi = pdef["allowed-multiselect"]
  trigger = if multi
    "allowMultiSelectionForConcurrentBuilds"
  else
    "multiSelectionDisallowed"
  end

  xml.triggerIfResult trigger
  xml.allowMultiNodeSelection multi
  xml.triggerConcurrentBuilds multi
end
translate_parameters_inner(xml, parameters) click to toggle source

cf. property.rb — params are a different field in jjb but just as much properties for jenkins config

# File lib/cigale/parameter.rb, line 28
def translate_parameters_inner (xml, parameters)
  for p in parameters
    type, spec = asplode p
    translate("parameter", xml, type, spec)
  end
end
translate_run_parameter(xml, pdef) click to toggle source
# File lib/cigale/parameter/run.rb, line 2
def translate_run_parameter (xml, pdef)
  xml.name pdef["name"]
  xml.description pdef["description"]
  xml.projectName pdef["project-name"]
end
translate_string_parameter(xml, pdef) click to toggle source
# File lib/cigale/parameter/string.rb, line 2
def translate_string_parameter (xml, pdef)
  xml.name pdef["name"]
  xml.description pdef["description"]
  default = pdef["default"]
  if default.nil? || default == ''
    xml.defaultValue
  else
    xml.defaultValue default
  end
end