Example #1
0
def your_detail(cmd, opt):
    conf = tools.load_configure(cmd.configure_filename)
    xml_data_path = conf["URL"] + "users/current.xml?key=" + conf["API_KEY"]
    xml = etree.parse(urllib.urlopen(xml_data_path))
    print("\n\nHi!! Mr.%s :)" % (xml.find(".//firstname").text))
    print("Redmine URL is " + conf["URL"])
    print("Your Redmine Id is " + xml.find(".//id").text)
    print("\n\n")
Example #2
0
def daily_report(cmd,opt):
    conf = tools.load_configure(cmd.configure_filename)
    xml  = redmine.load_redmine_xml(conf,opt)
    lines = dict_line(cmd,xml)
    if cmd.filepath is not None:
        report_string = redmine.build_daily_report(cmd.filepath,lines)
    else:
        report_string = redmine.build_daily_report(conf['TEMPLATE'],lines)
    print(report_string)
Example #3
0
def project_list(cmd, opt):
    conf = tools.load_configure(cmd.configure_filename)
    xml_data_path = conf["URL"] + "projects.xml?key=" + conf["API_KEY"]
    xml = etree.parse(urllib.urlopen(xml_data_path)).findall(".//project")
    for x in xml:
        print("[" + x.find("./id").text + "]" + x.find("./name").text)
        if cmd.flag_detail:
            print("--------------------")
            print(x.find("./description").text)
            print("\n")
Example #4
0
def show_tickets(cmd,opt):
    print('''
   ____    U _____ u ____     _                  _   _   U _____ u 
U |  _"\ u \| ___"|/|  _"\   |"|        ___     | \ |"|  \| ___"|/ 
 \| |_) |/  |  _|" /| | | |U | | u     |_"_|   <|  \| |>  |  _|"   
  |  _ <    | |___ U| |_| |\\\\| |/__     | |    U| |\  |u  | |___   
  |_| \_\   |_____| |____/ u |_____|  U/| |\u   |_| \_|   |_____|  
  //   \\\\_  <<   >>  |||_    //  \\\\.-,_|___|_,-.||   \\\\,-.<<   >>  
 (__)  (__)(__) (__)(__)_)  (_")("_)\_)-' '-(_/ (_")  (_/(__) (__) 
            ''')
    conf = tools.load_configure(cmd.configure_filename)
    xml = redmine.load_redmine_xml(conf,opt)
    lines = dict_line(cmd,xml)
    for key,value in lines.items():
        print("---> " + key)
        for line in value:
            print(line)
Example #5
0
def assign(cmd, opt):
    conf = tools.load_configure(cmd.configure_filename)
    if not "REDMINE_ID" in conf:
        xml_data_path = conf["URL"] + "users/current.xml?key=" + conf["API_KEY"]
        xml = etree.parse(urllib.urlopen(xml_data_path)).find(".//id")
        print(
            """Oops!! :(
Your Redmine Id is not found by Configure Yaml.

your_home_dir/.redline
-> REDMINE_ID: 666

oh,don't you know your redmine id ?
your redmine id is %s :) Have a fun!!
"""
            % (xml.text)
        )
        exit()
    xml = __prexml("<assigned_to_id>%i</assigned_to_id>" % (conf["REDMINE_ID"]))
    tools.put(ticket_url(cmd), xml)
    print("ticket %s is Assigned by you." % (cmd.ticket))
Example #6
0
def create(cmd, opt):
    import urllib

    conf = tools.load_configure(cmd.configure_filename)
    if cmd.make_template:
        parser.TicketTemplateOutput()
        exit()
    if cmd.filepath is not None:
        file_result = parser.TicketFile(open(cmd.filepath))
        cmd.subject_text = file_result["subject"]
        cmd.project_id = file_result["project_id"]
        cmd.tracker_id = file_result["tracker_id"]
        cmd.priority_id = file_result["priority_id"]
        cmd.description = file_result["description"]
    if cmd.subject_text is None or cmd.project_id is None:
        print("Oops !! Subject and Project_id is not found :(")
        exit()
    xml = create_xml(cmd.subject_text, cmd.project_id, cmd.priority_id, cmd.description, cmd.tracker_id)
    print("Post xml now :)")
    print(xml)
    tools.post(conf["URL"] + "issues.xml?key=" + conf["API_KEY"], xml)
    print("create Issue :)")
Example #7
0
def ticket_url(cmd):
    conf = tools.load_configure(cmd.configure_filename)
    return conf["URL"] + ("issues/%s.xml?key=%s" % (isTicket(cmd.ticket), conf["API_KEY"]))
Example #8
0
            "* #"
            + i.find("./id").text
            + " ["
            + i.find("./status").get("name")
            + "]["
            + i.find("./priority").get("name")
            + "]"
            + "["
            + i.find("tracker").get("name")
            + "] "
            + i.find("./done_ratio").text
            + "%"
            + i.find("./subject").text
            + "\n=============\n\n"
            + (i.find("./description").text if i.find("./description").text is not None else "")
            + "\n\n"
        )
    return lines_issue


if __name__ == "__main__":
    import tools

    conf = tools.load_configure()
    xml = load_redmine_xml(conf, None)
    lines = line_issue_short(xml)
    for key, value in lines.items():
        print("---> " + key)
        for line in value:
            print(line)