예제 #1
0
파일: post-receive.py 프로젝트: hn0/gith
def main():
    """
		Perform the stuff
	"""
    Log = conf.Log
    # check for basic git info first
    git_dir = conf.run_command('git rev-parse --git-dir', True).strip()
    git_project = 'Project ' + conf.repo_details(git_dir, 'project')

    cfg = conf.get_configuration()
    if cfg is None:
        Log('Valid configuration missing')
        return

    msg = ''
    # check for modified files
    for args in conf.read_commits():
        if not args is None:
            git_project += ' branch: ' + args[2][args[2].rfind('/') + 1:]
            msg += emsg.read_commit(args[0], args[1], args[2])

    # send a message to all recipients
    if not cfg['server'] is None:
        for r in cfg['recipient_lst']:
            # res = send_message(r, git_project, msg, cfg['server'])
            res = emsg.send_message(r, git_project, msg, cfg['server'])
            if not res is None:
                Log(res)
예제 #2
0
def copy_files(project, doc, doc_package, icon=None):
    config = conf.get_configuration()
    # copy and unpack data
    basedir = os.path.join(config.docserver_dropbox, project, doc["id"])
    dst = os.path.join(basedir, doc["version"])
    local("mkdir -p {}".format(dst))
    local("cp {} {}.zip".format(doc_package, dst))
    with lcd(dst):
        local("unzip {}".format(basedir + "/" + doc["version"] + ".zip"))
    if icon:
        shutil.copyfile(icon, os.path.join(basedir, "icon.png"))
        local("cp {} {}/icon.png".format(icon, basedir))
예제 #3
0
def publish_project(title, github=None, project=None):
    """ Create meta data for the project and create a new directory in the Dropbox
        folder specified in $HOME/.nxdocserver
    """

    config = conf.get_configuration()

    p = api.Project({"parent_id": project, "title": title, "github": github or "https://github.com/nexiles/" + title})

    # save meta data
    p.save()

    # create directory
    local("mkdir -p {}".format(os.path.join(config.docserver_dropbox, p["id"])))

    return p
예제 #4
0
    d["doc_icon"] = "foo.jpg"
    d.save()
    assert d["doc_icon"].endswith("foo.jpg")

    # CLEANUP
    # -------

    # delete docmeta
    d.delete()

    # delete project
    p.delete()

    print "Test completed successfully"

config = conf.get_configuration()

DOCSERVER_URL = config.docserver_url
DROPBOX       = config.docserver_dropbox
username      = config.login_username
password      = config.login_password

folder_api  = api.FolderAPI(DOCSERVER_URL, username, password)
doc_api     = api.DocmetaAPI(DOCSERVER_URL, username, password)
project_api = api.ProjectAPI(DOCSERVER_URL, username, password)

cli.add_command(version)
cli.add_command(list_docs)
cli.add_command(create_doc)
cli.add_command(update_doc)
cli.add_command(delete_doc)