예제 #1
0
def main(argv):
    parser = get_parser()

    # The parser arguments (cfg.args) are accessible everywhere after this call.
    cfg.args = parser.parse_args()

    # This initiates the global yml configuration instance so it will be
    # accessible everywhere after this call.
    cfg.initiate_config()

    jira, username = jiralogin.get_jira_instance(cfg.args.t)

    updates = list(enumerate_updates(jira))
    pendings = list(enumerate_pending(jira))

    assignees = sorted(set([u['assignee'] for u in updates]) | set([p['assignee'] for p in pendings]))
    # Move "Unassigned" issues to the end
    assignees.sort(key='Unassigned'.__eq__)

    template = Template(output)
    print(template.render(assignees=assignees, updates=updates, pendings=pendings))

    if cfg.args.html:
        f = open(cfg.args.html, 'w')
        template = Template(output_html)
        f.write(template.render(assignees=assignees, updates=updates, pendings=pendings))
        f.close()
예제 #2
0
def main(argv):
    parser = get_parser()

    # The parser arguments (cfg.args) are accessible everywhere after this call.
    cfg.args = parser.parse_args()

    # This initiates the global yml configuration instance so it will be
    # accessible everywhere after this call.
    initiate_config()

    key = "SWG"

    if cfg.args.test:
        test()
        exit()

    jira, username = jiralogin.get_jira_instance(cfg.args.t)

    if cfg.args.project:
        key = cfg.args.project


    # Open and initialize the file
    f = open_file(key + ".mm")
    root_nodes_start(f, key)

    # Temporary dictorionary to keep track the data (issues) that we already
    # have dealt with.
    d_handled = {}

    # Build the main tree with Initiatives beloninging to the project.
    nodes = build_initiatives_tree(jira, key, d_handled)

    # Take care of the orphans, i.e., those who has no connection to any
    # initiative in your project.
    nodes_orpans  = build_orphans_tree(jira, key, d_handled)

    # FIXME: We run through this once more since, when we run it the first time
    # we will catch Epics and Stories who are not linked with
    # "implements/implemented by" but instead uses the so called "Epic" link.
    nodes_orpans  = build_orphans_tree(jira, key, d_handled)

    # Dump the main tree to file
    for n in sorted(nodes):
        n.to_xml(f)

    orphan_node_start(f)
    for n in sorted(nodes_orpans):
        n.to_xml(f)
    orphan_node_end(f)

    # End the file
    root_nodes_end(f)
    f.close()
예제 #3
0
def main(argv):
    parser = get_parser()

    # The parser arguments (cfg.args) are accessible everywhere after this call.
    cfg.args = parser.parse_args()

    initialize_logger(cfg.args)

    # This initiates the global yml configuration instance so it will be
    # accessible everywhere after this call.
    cfg.initiate_config()

    if not cfg.args.file and not cfg.args.q:
        log.error("No file provided and not in query mode\n")
        parser.print_help()
        sys.exit(os.EX_USAGE)

    jira, username = jiralogin.get_jira_instance(cfg.args.t)

    if cfg.args.x or cfg.args.e:
        if not cfg.args.q:
            log.error(
                "Arguments '-x' and '-e' can only be used together with '-q'")
            sys.exit(os.EX_USAGE)

    if cfg.args.p and not cfg.args.q:
        log.error("Arguments '-p' can only be used together with '-q'")
        sys.exit(os.EX_USAGE)

    if cfg.args.q:
        (filename, issues) = get_jira_issues(jira, username)

        if cfg.args.p:
            print_status_file(filename)
            sys.exit(os.EX_OK)
    elif cfg.args.file is not None:
        filename = cfg.args.file
    else:
        log.error(
            "Trying to run script with unsupported configuration. Try using --help."
        )
        sys.exit(os.EX_USAGE)

    if get_editor():
        open_editor(filename)

    try:
        issues
    # issues is not defined, we haven't made any query yet.
    except NameError:
        parse_status_file(jira, filename, None)
    else:
        parse_status_file(jira, filename, issues)