def ruby_metrics(registry, xml_parent, data):
 metrics = XML.SubElement(xml_parent, 'hudson.plugins.rubyMetrics.rcov.RcovPublisher')
 report_dir = data.get('report-dir', '')
 XML.SubElement(metrics, 'reportDir').text = report_dir
 targets = XML.SubElement(metrics, 'targets')
 if ('target' in data):
  for t in data['target']:
   if (not (('code-coverage' in t) or ('total-coverage' in t))):
    raise JenkinsJobsException('Unrecognized target name')
   el = XML.SubElement(targets, 'hudson.plugins.rubyMetrics.rcov.model.MetricTarget')
   if ('total-coverage' in t):
    XML.SubElement(el, 'metric').text = 'TOTAL_COVERAGE'
   else:
    XML.SubElement(el, 'metric').text = 'CODE_COVERAGE'
   for (threshold_name, threshold_value) in next(iter(t.values())).items():
    elname = threshold_name.lower()
    XML.SubElement(el, elname).text = str(threshold_value)
 else:
  raise JenkinsJobsException('Coverage metric targets must be set')

def ruby_metrics ( registry , xml_parent , data ) : metrics = XML . SubElement ( xml_parent , 'hudson.plugins.rubyMetrics.rcov.RcovPublisher' ) report_dir = data . get ( 'report-dir' , '' ) XML . SubElement ( metrics , 'reportDir' ) . text = report_dir targets = XML . SubElement ( metrics , 'targets' ) if ( 'target' in data ) : for t in data [ 'target' ] : if ( not ( ( 'code-coverage' in t ) or ( 'total-coverage' in t ) ) ) : raise JenkinsJobsException ( 'Unrecognized target name' ) el = XML . SubElement ( targets , 'hudson.plugins.rubyMetrics.rcov.model.MetricTarget' ) if ( 'total-coverage' in t ) : XML . SubElement ( el , 'metric' ) . text = 'TOTAL_COVERAGE' else : XML . SubElement ( el , 'metric' ) . text = 'CODE_COVERAGE' for ( threshold_name , threshold_value ) in next ( iter ( t . values ( ) ) ) . items ( ) : elname = threshold_name . lower ( ) XML . SubElement ( el , elname ) . text = str ( threshold_value ) else : raise JenkinsJobsException ( 'Coverage metric targets must be set' )
yaml: ruby-metrics rcov plugin parses rcov html report files and shows it in jenkins with a trend graph .