Module: Cigale::Parameter
- Defined in:
- lib/cigale/parameter.rb,
lib/cigale/parameter/run.rb,
lib/cigale/parameter/bool.rb,
lib/cigale/parameter/node.rb,
lib/cigale/parameter/string.rb,
lib/cigale/parameter/dynamic-choice.rb,
lib/cigale/parameter/extended-choice.rb,
lib/cigale/parameter/matrix-combinations.rb
Defined Under Namespace
Classes: CustomParameter
Instance Method Summary collapse
- #parameter_classes ⇒ Object
- #translate_bool_parameter(xml, pdef) ⇒ Object
- #translate_dynamic_choice_parameter(xml, pdef) ⇒ Object
- #translate_extended_choice_parameter(xml, pdef) ⇒ Object
- #translate_matrix_combinations_parameter(xml, pdef) ⇒ Object
- #translate_node_parameter(xml, pdef) ⇒ Object
-
#translate_parameters_inner(xml, parameters) ⇒ Object
cf.
- #translate_run_parameter(xml, pdef) ⇒ Object
- #translate_string_parameter(xml, pdef) ⇒ Object
Instance Method Details
#parameter_classes ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# 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) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# 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) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 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) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 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) ⇒ Object
2 3 4 5 6 |
# 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) ⇒ 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/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) ⇒ Object
cf. property.rb — params are a different field in jjb but just as much properties for jenkins config
28 29 30 31 32 33 |
# 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) ⇒ Object
2 3 4 5 6 |
# 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) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# 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 |