if options.rebuild:
            for osname in supported_os:
                rm_and_build('%s' % osname, 'amplify-agent-%s' % osname)

        runcmd = 'docker-compose -f docker/agents.yml up'
    else:
        shell_call('docker-compose -f docker/%s.yml stop' % options.os,
                   terminal=True)

        if options.rebuild:
            rm_and_build('%s' % options.os, 'amplify-agent-%s' % options.os)

        if options.shell:
            rows, columns = os.popen('stty size', 'r').read().split()
            color_print("\n= USEFUL COMMANDS =" + "=" * (int(columns) - 20))
            for helper in (
                    "service nginx start", "service php7.0-fpm start",
                    "service mysql start"
                    "python /amplify/nginx-amplify-agent.py start --config=/amplify/etc/agent.conf.development",
                    "python /amplify/nginx-amplify-agent.py stop --config=/amplify/etc/agent.conf.development"
            ):
                color_print(helper, color='yellow')
            color_print("=" * int(columns) + "\n")

            runcmd = 'docker-compose -f docker/%s.yml run agent bash' % options.os
        else:
            runcmd = 'docker-compose -f docker/%s.yml up' % options.os

    if options.background and not options.shell:
        runcmd += ' -d'
option_list = (
    Option(
        '--plus',
        action='store_true',
        dest='plus',
        help='Run with nginx+ (false by default)',
        default=False,
    ),
)

parser = OptionParser(usage, option_list=option_list)
(options, args) = parser.parse_args()

if __name__ == '__main__':
    if options.plus:
        yml, image, path = 'docker/test-plus.yml', 'amplify-agent-test-plus', 'docker/test-plus'
    else:
        yml, image, path = 'docker/test.yml', 'amplify-agent-test', 'docker/test'

    shell_call('find . -name "*.pyc" -type f -delete', terminal=True)
    shell_call('docker build -t %s %s' % (image, path), terminal=True)

    rows, columns = os.popen('stty size', 'r').read().split()
    color_print("\n= RUN TESTS =" + "="*(int(columns)-13))
    color_print("py.test test/", color="yellow")
    color_print("="*int(columns)+"\n")
    shell_call('docker-compose -f %s run test bash' % yml, terminal=True)


Exemple #3
0
        dest='vanilla',
        help='Run plain Ubuntu',
        default=False,
    ),
)

parser = OptionParser(usage, option_list=option_list)
(options, args) = parser.parse_args()

if __name__ == '__main__':
    if options.plus:
        yml, image, path = 'docker/test-plus.yml', 'amplify-agent-test-plus', 'docker/test-plus'
    elif options.vanilla:
        yml, image, path = 'docker/test-vanilla.yml', 'amplify-agent-test-vanilla', 'docker/test-vanilla'
    else:
        yml, image, path = 'docker/test.yml', 'amplify-agent-test', 'docker/test'

    shell_call('find . -name "*.pyc" -type f -delete', terminal=True)
    shell_call('cat packages/*/requirements.txt >> %s/requirements.txt' % path)
    shell_call('cp -pf %s/.dockerignore .' % path)
    shell_call('docker build -t %s -f %s/Dockerfile .' % (image, path),
               terminal=True)
    shell_call('rm %s/requirements.txt' % path)
    shell_call('rm .dockerignore')

    rows, columns = os.popen('stty size', 'r').read().split()
    color_print("\n= RUN TESTS =" + "=" * (int(columns) - 13))
    color_print("py.test test/", color="yellow")
    color_print("=" * int(columns) + "\n")
    shell_call('docker-compose -f %s run test bash' % yml, terminal=True)
        shell_call("docker-compose -f docker/agents.yml stop", terminal=True)

        if options.rebuild:
            for osname in supported_os:
                rm_and_build("%s" % osname, "amplify-agent-%s" % osname)

        runcmd = "docker-compose -f docker/agents.yml up"
    else:
        shell_call("docker-compose -f docker/%s.yml stop" % options.os, terminal=True)

        if options.rebuild:
            rm_and_build("%s" % options.os, "amplify-agent-%s" % options.os)

        if options.shell:
            rows, columns = os.popen("stty size", "r").read().split()
            color_print("\n= USEFUL COMMANDS =" + "=" * (int(columns) - 20))
            for helper in (
                "nginx",
                "python /amplify/nginx-amplify-agent.py start --config=/amplify/etc/agent.conf.development",
                "python /amplify/nginx-amplify-agent.py stop --config=/amplify/etc/agent.conf.development",
            ):
                color_print(helper, color="yellow")
            color_print("=" * int(columns) + "\n")

            runcmd = "docker-compose -f docker/%s.yml run agent bash" % options.os
        else:
            runcmd = "docker-compose -f docker/%s.yml up" % options.os

    if options.background and not options.shell:
        runcmd += " -d"