Class: JenkinsApi::Client::PluginSettings::WorkspaceCleanup
- Defined in:
- lib/improved_jenkins_client/plugin_settings/workspace_cleanup.rb
Instance Method Summary collapse
-
#configure(xml_doc) ⇒ Nokogiri::XML::Document
Create or Update a job with params given as a hash instead of the xml This gives some flexibility for creating/updating simple jobs so the user doesn’t have to learn about handling xml.
-
#initialize(params = {}) ⇒ WorkspaceCleanup
constructor
A new instance of WorkspaceCleanup.
Constructor Details
#initialize(params = {}) ⇒ WorkspaceCleanup
Returns a new instance of WorkspaceCleanup.
10 11 12 |
# File 'lib/improved_jenkins_client/plugin_settings/workspace_cleanup.rb', line 10 def initialize(params={}) @params = params end |
Instance Method Details
#configure(xml_doc) ⇒ Nokogiri::XML::Document
Create or Update a job with params given as a hash instead of the xml This gives some flexibility for creating/updating simple jobs so the user doesn’t have to learn about handling xml.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/improved_jenkins_client/plugin_settings/workspace_cleanup.rb', line 21 def configure(xml_doc) xml_doc.tap do |doc| Nokogiri::XML::Builder.with(doc.at('buildWrappers')) do |build_wrappers| build_wrappers.send('hudson.plugins.ws__cleanup.PreBuildCleanup') do |x| x.deleteDirs @params.fetch(:delete_dirs) { false } x.cleanupParameter @params.fetch(:cleanup_parameter) { '' } x.externalDelete @params.fetch(:external_delete) { '' } end end end end |