Exemplo n.º 1
0
 def cmd_build(self):
     t0 = time.time()
     self.current_project().build(['html'])
     t1 = time.time()
     log.success("Project build time: %.2fms" % (1000.0 * (t1 - t0)))
     log.message("Run '%(name)s serve' command for serving or '%(name)s serve --watch'." %
         {'name': self.script_name()})
Exemplo n.º 2
0
 def on_any_event(self, event):
     """
     Filter file/dir events and schedule project rebuild.
     """
     if isinstance(event, self.events_file):
         name = fs.basename(event.src_path)
         if any([fs.match(name, mask) for mask in WATCH_PATTERNS_DEFAULT]):
             log.success("  %s" % "file updated: %s" % event.src_path)
             self.observer.needs_rebuild()
     elif isinstance(event, self.events_dirs):
         log.success("  %s" % "directory updated: %s" % event.src_path)
         self.observer.needs_rebuild()
Exemplo n.º 3
0
    def build(self, initial=False):
        """
        Build project and log time spent for operation.
        """
        if not self.rebuild_going:
            self.rebuild_going = True
            t0 = time.time()

            if not initial:
                self.unschedule_all()
            
            self.project.build(['html'])

            if not initial:
                self.schedule_all()

            t1 = time.time()
            self.rebuild_going = False
            log.success("  %s" % "rebuild time: %.2fms" % (1000.0 * (t1 - t0)))