Exemple #1
0
    def __call__(self):

        with clepy.spinning_distraction():

            p = self.setup_p()

            # Call to the first specialized function.
            self.handle_p(p)

            options, args = self.setup_options_and_args(p)

            pitz.setup_logging(getattr(logging, options.log_level))

            # Call the second specialized function.
            self.handle_options_and_args(p, options, args)

            proj = self.setup_proj(p, options, args)

        # Third special function.
        if options.pdb:
            clepy.into_debugger(self.handle_proj)(p, options, args, proj)
        else:
            self.handle_proj(p, options, args, proj)

        if self.save_proj:
            proj.save_entities_to_yaml_files()

        os.remove(proj.pidfile)
Exemple #2
0
def pitz_html():
    """
    Write out a bunch of HTML files.
    """

    with clepy.spinning_distraction():

        p = setup_options()
        p.set_usage('%prog [options] directory')
        p.add_option('--force',
            help='Ignore timestamps and regenerate all files',
            action='store_true',
            default=False)

        options, args = p.parse_args()

        if options.version:
            print_version()
            return

        if not args:
            p.print_usage()
            sys.exit()

        pitzdir = Project.find_pitzdir(options.pitzdir)

        proj = Project.from_pitzdir(pitzdir)
        proj.find_me()

        htmldir = args[0]

        proj.to_html(htmldir)

        proj.todo.to_html(htmldir)
        proj.milestones.to_html(htmldir)
        proj.tasks.to_html(htmldir)
        proj.components.to_html(htmldir)

        print("Wrote %d html files out of %d entities in project."
            % (
                len([e for e in proj
                    if e.to_html_file(htmldir, options.force)]),
                len(proj)))

        # Record that we rebuilt all the HTML files.
        proj.save_entities_to_yaml_files()