corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | #!/usr/bin/env bash |
2 | |||
3 | REL_SCRIPT_DIR="`dirname \"$0\"`" |
||
4 | SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`" |
||
5 | PROJECT_DIR="`( cd \"$SCRIPT_DIR/..\" && pwd )`" |
||
6 | |||
7 | build_help() |
||
8 | { |
||
9 | echo "build.sh <action>" |
||
10 | echo " full - build and test of all implementations" |
||
11 | echo " all - build of both implementations" |
||
12 | echo " js - build of javascript" |
||
13 | echo " py - build of python" |
||
14 | echo " alltest - test both implementations, js and python" |
||
15 | echo " pytest - test python implementation" |
||
16 | echo " jstest - test javascript implementation" |
||
17 | } |
||
18 | |||
19 | build_ci() |
||
20 | { |
||
21 | build_full |
||
22 | build_git_status |
||
23 | } |
||
24 | |||
25 | build_full() |
||
26 | { |
||
27 | build_all |
||
28 | build_alltest |
||
29 | } |
||
30 | |||
31 | build_all() |
||
32 | { |
||
33 | build_py |
||
34 | build_js |
||
35 | } |
||
36 | |||
37 | build_py() |
||
38 | { |
||
39 | echo Building python module... |
||
40 | pip install -e ./python || exit 1 |
||
41 | } |
||
42 | |||
43 | build_js() |
||
44 | { |
||
45 | echo Building javascript... |
||
46 | npm install || exit 1 |
||
47 | generate_tests |
||
48 | # jshint |
||
49 | $PROJECT_DIR/node_modules/.bin/jshint 'js' 'test' || exit 1 |
||
50 | |||
51 | # beautify test and data |
||
52 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/test/amd-beautify-tests.js || exit 1 |
||
53 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/test/node-beautify-html-perf-tests.js || exit 1 |
||
54 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/test/node-beautify-perf-tests.js || exit 1 |
||
55 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/test/node-beautify-tests.js || exit 1 |
||
56 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/test/sanitytest.js || exit 1 |
||
57 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/test/data/css/tests.js || exit 1 |
||
58 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/test/data/html/tests.js || exit 1 |
||
59 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/test/data/javascript/inputlib.js || exit 1 |
||
60 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/test/data/javascript/tests.js || exit 1 |
||
61 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/test/generate-tests.js || exit 1 |
||
62 | |||
63 | # beautify product code |
||
64 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/unpackers/javascriptobfuscator_unpacker.js || exit 1 |
||
65 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/unpackers/myobfuscate_unpacker.js || exit 1 |
||
66 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/unpackers/p_a_c_k_e_r_unpacker.js || exit 1 |
||
67 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/unpackers/urlencode_unpacker.js || exit 1 |
||
68 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/beautify-css.js || exit 1 |
||
69 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/beautify-html.js || exit 1 |
||
70 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/beautify.js || exit 1 |
||
71 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/lib/cli.js || exit 1 |
||
72 | $PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $PROJECT_DIR/js/index.js || exit 1 |
||
73 | |||
74 | |||
75 | # html not ready yet |
||
76 | # $PROJECT_DIR/js/bin/html-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r index.html |
||
77 | |||
78 | # jshint again to make sure things haven't changed |
||
79 | $PROJECT_DIR/node_modules/.bin/jshint 'js' 'test' || exit 1 |
||
80 | } |
||
81 | |||
82 | generate_tests() |
||
83 | { |
||
84 | node test/generate-tests.js || exit 1 |
||
85 | } |
||
86 | |||
87 | build_alltest() |
||
88 | { |
||
89 | build_jstest |
||
90 | build_pytest |
||
91 | } |
||
92 | |||
93 | build_pytest() |
||
94 | { |
||
95 | echo Testing python implementation... |
||
96 | generate_tests |
||
97 | cd python |
||
98 | python --version |
||
99 | ./jsbeautifier/tests/shell-smoke-test.sh || exit 1 |
||
100 | } |
||
101 | |||
102 | build_jstest() |
||
103 | { |
||
104 | echo Testing javascript implementation... |
||
105 | generate_tests |
||
106 | node --version |
||
107 | ./js/test/shell-smoke-test.sh || exit 1 |
||
108 | } |
||
109 | |||
110 | build_git_status() |
||
111 | { |
||
112 | $SCRIPT_DIR/git-status-clear.sh || exit 1 |
||
113 | } |
||
114 | |||
115 | build_update-codemirror() |
||
116 | { |
||
117 | rm -rf node_modules/codemirror |
||
118 | npm install codemirror |
||
119 | rm -rf ./web/third-party/codemirror/* |
||
120 | cp ./node_modules/codemirror/LICENSE ./web/third-party/codemirror/ |
||
121 | cp ./node_modules/codemirror/README.md ./web/third-party/codemirror/ |
||
122 | cp -r ./node_modules/codemirror/lib ./web/third-party/codemirror/ |
||
123 | mkdir -p ./web/third-party/codemirror/mode |
||
124 | cp -r ./node_modules/codemirror/mode/javascript ./web/third-party/codemirror/mode/ |
||
125 | git add -Av ./web/third-party/codemirror |
||
126 | } |
||
127 | |||
128 | main() { |
||
129 | cd $PROJECT_DIR |
||
130 | local ACTION |
||
131 | ACTION=build_${1:-full} |
||
132 | if [ -n "$(type -t $ACTION)" ] && [ "$(type -t $ACTION)" = "function" ]; then |
||
133 | $ACTION |
||
134 | else |
||
135 | build_help |
||
136 | fi |
||
137 | |||
138 | } |
||
139 | |||
140 | (main $*) |