示例#1
0
 def write_line(self):
     result = ''
     for part in self.line:
         result += self.write_part(part)
     template = Template(file_to_str(self.TEMPLATE_LINE))
     return template.substitute(VALUE=result,\
            DIV_STYLE=' '.join([self.div_style, self.type_style]))
示例#2
0
 def write_properties(self):
     result = ''
     if len(self.properties) > 0:
         for property in self.properties:
             result += property.write()
         template = Template(file_to_str(Properties.TEMPLATE))
         result = template.substitute(VALUE=result,
                                      DIV_STYLE=self.div_style)
     return result
示例#3
0
文件: style.py 项目: mgaborit/pyven
 def write(self):
     if not os.path.isdir(Style.DIR):
         os.makedirs(Style.DIR)
     style_file = os.path.join(Style.DIR, self.name + '.css')
     if not os.path.isfile(style_file):
         self.name = 'default'
         self.generate_default()
         return self.default()
     else:
         return file_to_str(style_file)
示例#4
0
 def write_body(workspace):
     report_dir = os.path.join(workspace, 'report')
     html_str = ''
     if os.path.isdir(report_dir):
         report_parts = [
             f for f in os.listdir(report_dir)
             if os.path.splitext(f)[1] == '.html' and f != HTMLUtils.INDEX
         ]
         for report_part in report_parts:
             html_str += file_to_str(os.path.join(report_dir, report_part))
     return html_str
示例#5
0
文件: lines.py 项目: mgaborit/pyven
 def write_lines(self):
     result = ''
     if len(self.lines) > 0:
         i = 0
         while i < Lines.NB_LINES and i < len(self.lines):
             result += self.lines[i].write()
             i += 1
         template = Template(file_to_str(Lines.TEMPLATE))
         result = template.substitute(VALUE=result,
                                      DIV_STYLE=self.div_style)
     return result
示例#6
0
 def write_listing(self):
     template = Template(file_to_str(Listing.TEMPLATE))
     properties = ''
     if self.properties is not None:
         properties += self.properties.write()
     lines = ''
     if self.lines is not None:
         lines += self.lines.write()
     return template.substitute(TITLE=self.title.write(),\
            STATUS=self.status.write(),\
            PROPERTIES=properties,\
            LINES=lines,\
            LISTINGS='',\
            DIV_STYLE=Listing.join_styles([Style.get().listing['div_style'], self.div_style, self.status_style]))
示例#7
0
	def write_listing(self):
		template = Template(file_to_str(Listing.TEMPLATE))
		listings = ''
		if self.listings is not None:
			if self.status.status == pyven.constants.STATUS[1]:
				listings += Summary(self.status, self.listings).write()
			for listing in self.listings:
				listings += HTMLUtils.line_separator()
				listings += listing.write()
		return template.substitute(TITLE=self.title.write(),\
									STATUS=self.status.write(),\
									PROPERTIES='',\
									LINES='',\
									LISTINGS=listings,\
									DIV_STYLE=Listing.join_styles([Style.get().listing['div_style'], self.div_style, self.status_style]))
示例#8
0
文件: summary.py 项目: mgaborit/pyven
 def write_listing(self):
     template = Template(file_to_str(Listing.TEMPLATE))
     failures = []
     if self.listings is not None:
         for listing in self.listings:
             if listing.status.status == pyven.constants.STATUS[1]:
                 failures.append(
                     Line([HTMLUtils.link(listing.summary,
                                          listing.href())]))
     lines = Lines(failures)
     return template.substitute(TITLE=self.title.write(),\
            STATUS='',\
            PROPERTIES='',\
            LINES=lines.write(),\
            LISTINGS='',\
            DIV_STYLE=Listing.join_styles([Style.get().listing['div_style'], self.div_style, self.status_style]))
示例#9
0
 def aggregate(workspace):
     report_dir = os.path.join(workspace, 'report')
     if not os.path.isdir(report_dir):
         os.makedirs(report_dir)
     template_file = os.path.join(HTMLUtils.TEMPLATE_DIR,
                                  HTMLUtils.TEMPLATE_FILE)
     if not os.path.isfile(template_file):
         HTMLUtils.generate_template()
     template = Template(file_to_str(template_file))
     title = 'Build report'
     if 'BUILD_NUMBER' in os.environ:
         title = 'Jenkins - Build #' + os.environ.get('BUILD_NUMBER')
     str = template.substitute(STYLE=Style.get().write(),
                               TITLE=title,
                               CONTENT=HTMLUtils.write_body(workspace),
                               PVN_VERSION=pyven.constants.VERSION)
     str_to_file(str, os.path.join(report_dir, HTMLUtils.INDEX))
示例#10
0
 def write_title(self):
     template = Template(file_to_str(Title.TEMPLATE))
     result = template.substitute(VALUE=self.title,
                                  TITLE_STYLE=self.title_style)
     return result
示例#11
0
 def write_part(self, part):
     template = Template(file_to_str(self.TEMPLATE_PART))
     return template.substitute(VALUE=part,
                                PART_STYLE=' '.join(
                                    [self.part_style, self.type_style]))
示例#12
0
文件: status.py 项目: mgaborit/pyven
 def write_status(self):
     template = Template(file_to_str(Status.TEMPLATE))
     result = template.substitute(VALUE=self.status,\
            DIV_STYLE=' '.join([self.div_style, self.status.lower()]),\
            SPAN_STYLE=' '.join([self.span_style, self.status.lower()]))
     return result