Exemple #1
0
def main():
    help_text = usage

    if len(sys.argv) == 2 and sys.argv[1] == 'init':
        init_project(None, 'init')
    elif len(sys.argv) >= 2 and sys.argv[1] == 'create':
        options, args = init_options()
        project_name = sys.argv[2]
        if re.match('^[a-zA-Z0-9_]+$', project_name):
            create_project(project_name, options.template)
        else:
            print u'无效工程名: ' + project_name
    elif len(sys.argv) >= 2 and sys.argv[1] == 'init':
        options, args = init_options()
        project_name = sys.argv[2]
        if re.match('^[a-zA-Z0-9_]+$', project_name):
            init_project(project_name, options.template)
        else:
            print u'无效工程名: ' + project_name
    elif len(sys.argv) >= 2 and sys.argv[1] == 'pinstall':
        if len(sys.argv) == 2 or sys.argv[2] == '-h':
            print "es pinstall <package>"
            return

        args = sys.argv[1:]
        args[0] = 'install'
        args.append('-i %s' % env.PYPI_INDEX)
        pip.main(args)
    else:
        if len(sys.argv) == 2 and '-h' in sys.argv:
            print help_text
        pip.main()
Exemple #2
0
def main():
    help_text = usage

    if len(sys.argv) == 2 and sys.argv[1] == 'init':
        init_project(None, 'init')
    elif len(sys.argv) >= 2 and sys.argv[1] == 'create':
        options, args = init_options()
        project_name = sys.argv[2]
        if re.match('^[a-zA-Z0-9_]+$', project_name):
            create_project(project_name, options.template)
        else:
            sys.stdout.write('无效工程名: ' + project_name)
    elif len(sys.argv) >= 2 and sys.argv[1] == 'init':
        options, args = init_options()
        project_name = sys.argv[2]
        if re.match('^[a-zA-Z0-9_]+$', project_name):
            init_project(project_name, options.template)
        else:
            sys.stdout.write('无效工程名: ' + project_name)
    elif len(sys.argv) >= 2 and sys.argv[1] == 'pinstall':
        if len(sys.argv) == 2 or sys.argv[2] == '-h':
            sys.stdout.write("es pinstall <package>")
            return

        args = sys.argv[1:]
        args[0] = 'install'
        args.append('-i %s' % env.PYPI_INDEX)
        pip.main(args)
    else:
        if len(sys.argv) == 2 and '-h' in sys.argv:
            sys.stdout.write(help_text)
        pip.main()
Exemple #3
0
def create_project(project, template='default'):
    """创建本地工程"""
    init_project(project, template)
    with lcd(project):
        git.command('git init', in_local=True)
        git.add(add_all=True, in_local=True)
        git.commit(u'初始化工程结构', in_local=True)
        repos = prompt('请输入Git仓库地址:')
        if repos:
            git.command('git remote add origin %s' % repos, in_local=True)
            git.command('git push -u origin master', in_local=True)
Exemple #4
0
def create_project(project, template='default'):
    """创建本地工程"""
    init_project(project, template)
    with lcd(project):
        git.command('git init', in_local=True)
        git.add(add_all=True, in_local=True)
        git.commit(u'初始化工程结构', in_local=True)
        repos = prompt('请输入Git仓库地址:')
        if repos:
            git.command('git remote add origin %s' % repos, in_local=True)
            git.command('git push -u origin master', in_local=True)