コード例 #1
0
ファイル: run.py プロジェクト: cloud9ers/j25framework
def newApp(args, options):
    from j25.Configuration import Configuration

    if len(args) < 2:
        print >> sys.stderr, "you must supply the name of the app"
        exit(1)
    _checkProject(AUTO_PROJECT_DIRS)
    appName = args[1]
    appDirectory = os.path.join('apps', appName)
    print Server.getBanner()
    print COLOR_SEQ % 33
    try:
        _createPythonPackage(HERE, appDirectory, True)
        f = open(os.path.join(appDirectory, 'config.py'), 'w')
        f.write(app_config_template)
        f.close()
        f = open(os.path.join(appDirectory, 'routing.py'), 'w')
        f.write(app_routing_template % appName)
        f.close()
        for directory, is_python_package in AUTO_APP_DIRS:
            _createPythonPackage(appDirectory, directory, is_python_package)
        #update configuration
        config = Configuration.load_file("server.ini", False)
        currentApps = eval(config.main.applications)
        assert isinstance(currentApps, list)
        currentApps.append('apps.%s' % appName)
        config.main.applications = str(list(set(currentApps)))
        Configuration.dump_file("server.ini", config)
        logger.info("Application %s has been created. Current project has been configured." % appName)
    finally:
        print RESET_SEQ
コード例 #2
0
ファイル: run.py プロジェクト: cloud9ers/j25framework
def installApp(args, options):
    from j25.Configuration import Configuration
    if len(args) < 2:
        print >> sys.stderr, "you must supply the name of the app"
        exit(1)
    _checkProject(AUTO_PROJECT_DIRS)
    appName = args[1]
    print Server.getBanner()
    print COLOR_SEQ % 33
    config = Configuration.load_file('server.ini', False)
    currentApps = eval(config.main.applications)
    assert isinstance(currentApps, list)
    if not appName in currentApps:
        currentApps.append(appName)
        config.main.applications = str(currentApps)
        Configuration.dump_file('server.ini', config)
        logger.info("\033[1;33mApplication %s added to project.\033[0m"% appName)
    else:
        logger.info("\033[1;33mApplication %s already installed in the project.\033[0m" % appName)
コード例 #3
0
ファイル: run.py プロジェクト: cloud9ers/j25framework
def runServer(args, options):
    _checkProject(AUTO_PROJECT_DIRS)
    _addPythonPath()
    args.pop(0)
    j25.project_directory = HERE
    Server.Main("server.ini")