示例#1
0
def install_module():
    base.print_info('Install')
    base.cmd('npm', ['install'])
示例#2
0
def install_module(path):
    base.print_info('Install: ' + path)
    base.cmd_in_dir(path, 'npm', ['install'])
示例#3
0
def run_integration_example():
    install_module()
    base.set_env('NODE_CONFIG_DIR', './config')
    base.print_info('run integration example')
    base.run_nodejs(['bin/www'])
示例#4
0
  else:
    base.print_info('Missing rabbitmqctl.bat')

def start_mac_services():
  base.print_info('Restart MySQL Server')
  base.run_process(['mysql.server', 'restart'])
  base.print_info('Start RabbitMQ Server')
  base.run_process(['rabbitmq-server'])
  base.print_info('Start Redis')
  base.run_process(['redis-server'])

def run_integration_example():
  base.cmd_in_dir('../document-server-integration/web/documentserver-example/nodejs', 'python', ['run-develop.py'])

try:
  base.print_info('check Node.js version')
  if (True != check_nodejs_version()):
    exit(0)

  platform = base.host_platform()
  if ("windows" == platform):
    restart_win_rabbit()
  elif ("mac" == platform):
    start_mac_services()

  base.print_info('Build modules')
  base.cmd_in_dir('../build_tools', 'python', ['configure.py', '--branch', 'develop', '--module', 'develop', '--update', '1', '--update-light', '1', '--clean', '0', '--sdkjs-addon', 'comparison', '--sdkjs-addon', 'content-controls', '--web-apps-addon', 'mobile', '--sdkjs-addon', 'sheet-views'])
  base.cmd_in_dir('../build_tools', 'python', ['make.py'])
  
  run_integration_example()
  
示例#5
0
def start_linux_services():
    base.print_info('Restart MySQL Server')
示例#6
0
def start_linux_services():
    base.print_info('Restart MySQL Server')
    os.system('sudo service mysql restart')
    base.print_info('Restart RabbitMQ Server')
    os.system('sudo service rabbitmq-server restart')
示例#7
0
def start_mac_services():
    base.print_info('Restart MySQL Server')
    base.run_process(['mysql.server', 'restart'])
    base.print_info('Start RabbitMQ Server')
    base.run_process(['rabbitmq-server'])
示例#8
0
def check_redis():
    dependence = CDependencies()
    base.print_info('Check Redis server')

    if (host_platform == 'windows'):
        if (len(get_programUninstalls('Redis on Windows')) == 0):
            print('Redis not found')
            dependence.append_install('RedisServer')
            return dependence

        checkService = base.run_command('sc query Redis')['stdout']
        if (checkService.find('Redis') != -1) and (checkService.find('STOPPED')
                                                   != -1):
            print('Installed Redis is not valid')
            dependence.append_uninstall('Redis on Windows')
            dependence.append_install('RedisServer')
            return dependence

        redis_cli = find_redis(os.environ['PROGRAMW6432']) or find_redis(
            os.environ['ProgramFiles(x86)'])
    elif (host_platform == 'linux'):
        checkService = base.run_command(
            'service redis-server status')['stderr']
        if (checkService == ''):
            print('Redis not found')
            dependence.append_install('Redis')
            return dependence
        redis_cli = 'redis-cli'

    if (redis_cli == None):
        print('Redis not found in default folder')
        dependence.append_uninstall('Redis on Windows')
        dependence.append_install('RedisServer')
        return dependence

    result = base.run_command('"' + redis_cli + '"' + ' info server')['stdout']
    if (result == ''):
        print('Redis client is invalid')
        if (host_platform == 'windows'):
            dependence.append_uninstall('Redis on Windows')
            dependence.append_install('RedisServer')
        else:
            dependence.append_uninstall('redis-server')
            dependence.append_install('Redis')
        return dependence

    info = result.split('tcp_port:')[1]
    tcp_port = info.split('\r', 1)[0]
    config_port = install_params['Redis'].split('PORT=', 1)[1]
    config_port = config_port.split(' ', 1)[0]
    if (tcp_port != config_port):
        print('Invalid Redis port, need reinstall')
        if (host_platform == 'windows'):
            dependence.append_uninstall('Redis on Windows')
            dependence.append_install('RedisServer')
        else:
            dependence.append_uninstall('redis-server')
            dependence.append_install('Redis')
        return dependence

    print('Installed Redis is valid')
    return dependence