예제 #1
0
파일: gploy.py 프로젝트: alshain/deploy-git
def run():
    print console.center("Running gploy v0.1")
    with open('meta.yml', 'r') as f:
        #Strip whitespace
        config = parse_config(f.readlines())

    call = lambda x: x()
    deps = map(modules.Module, config.iteritems())
    map(call, deps)
    if modules.Module.master:
        with open('run.py', 'w') as f:
            w = lambda str: f.write(str + '\n')
            w("#!/usr/bin/env python")
            w("from _gploy import venv")
            w("")
            w("# Setting up virtual environment")
            for line in venv.getCode():
                w(line)
            w("")
            w("# Starting application")
            w("import %s" % modules.Module.master)
            w("%s._gploy()" % modules.Module.master)
예제 #2
0
파일: gploy.py 프로젝트: alshain/deploy-git
            w("%s._gploy()" % modules.Module.master)

def check_git_version():
    print "Checking git version..."
    cmd = ['git', '--version']
    p = subprocess.PIPE
    version = subprocess.Popen(cmd, stdout = p, stderr = p).communicate()[0]
    version = version[len("git version "):]
    print "Detected: %s" % version
    if not version.startswith("1.7"):
        print "Incompatible GIT version! Expected >= 1.7"
        exit(1)

if __name__ == "__main__":
    new_path = lambda * args: os.path.join('_gploy', *args)
    print console.center("Welcome to gploy!")
    check_git_version()
    if os.path.isfile('../meta.yml'):
        raise RuntimeError("You probably do not want to do this: meta.yml detected in parent directory.")

    files = (
        'gploy.py',
        '.git',
        '.gitignore',
        'venv.py',
    )
    if not os.path.isdir(new_path()):
        print "Creating direcotry: _gploy"
        os.mkdir("_gploy")
    mv = lambda file: shutil.move(file, new_path(file))
    try: