summaryrefslogtreecommitdiff
path: root/service/go
blob: 196841baf2b02facce4682592f1c12c98febf929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

NUM_OF_CORES=''

function resolveNumOfCores {
        if [ "$(uname)" ==  "Darwin" ]; then
                NUM_OF_CORES="$(sysctl -n hw.ncpu)"
        else
                NUM_OF_CORES="$(nproc)"
        fi
}

function setuppy {
        pip install -r test_requirements.txt
        python setup.py develop $*
	pip uninstall -y scrypt; pip install scrypt
	pip uninstall -y gnupg; pip install gnupg==1.2.5
}

function setupjs {
        cd ../web-ui
        npm install
        node_modules/bower/bin/bower install --config.interactive=false --allow-root
        LC_ALL=en_US.UTF-8 ./go build
        cd -
}

function runIntegrationTests {
        resolveNumOfCores
        echo $NUM_OF_CORES
        trial -j $NUM_OF_CORES --reporter=text $* test.integration
}

function runUnitTests {
        trial --reporter=text $* test.unit
}

function runPep8 {
        pep8 pixelated test --ignore=E501
}

function runJSHint {
        cd ../web-ui
        LC_ALL=en_US.UTF-8 ./go jshint
        cd -
}

if [ "$1" == 'test' ]; then
        runJSHint
        runPep8
        runUnitTests "${@:2}"
        runIntegrationTests "${@:2}"
elif [ "$1" == 'unit' ]; then
        runUnitTests
elif [ "$1" == 'integration' ]; then
        runIntegrationTests
elif [ "$1" == 'pep8' ]; then
        runPep8
elif [ "$1" == 'setuppy' ]; then
        setuppy
elif [ "$1" == 'setupjs' ]; then
        setupjs
elif [ "$1" == 'setup' ]; then
        setupjs
        setuppy "${@:2}"
elif [ "$1" == 'start' ]; then
        /usr/bin/env pixelated-user-agent "${@:2}"
else
        python setup.py $*
fi