Sha256: b1294ce1c7f400120d8e4cdc6d6d4a93c46c4558ec99cf7bf069b9f5400bcbf9

Contents?: true

Size: 872 Bytes

Versions: 123

Compression:

Stored size: 872 Bytes

Contents

#!/usr/bin/ruby
require 'xml/smart'

Dir['*.xml'].each do |f|
  XML::Smart.modify(f) do |doc|
    p f
    doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
    doc.register_namespace 'p', 'http://riddl.org/ns/common-patterns/properties/1.0'
    if doc.root.qname.name == 'testset'
      doc.find('//d:call').each do |e|
        x = e.find('d:finalize')
        if x.length > 0
          code = x.first.add_before 'code'
          code.add x
          code.add e.find('d:update')
        end
        x = e.find('d:_timing')
        if x.length > 0
          code = x.first.add_before 'annotations'
          code.add x
          code.add e.find('d:_notes')
        end
      end
      begin
        if doc.find('//attributes/p:theme').any?
          doc.find('//attributes/p:theme').first.text = 'preset'
        end
      rescue
      end
    end
  end
end

Version data entries

123 entries across 110 versions & 1 rubygems

Version Path
cpee-2.1.79 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.78 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.77 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.75 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.74 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.73 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.71 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.70 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.69 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.68 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.67 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.66 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.64 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.63 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.62 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.61 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.60 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.59 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.58 cockpit/templates.legacy/convert_preset.rb
cpee-2.1.57 cockpit/templates.legacy/convert_preset.rb