forked from PenguinMod/PenguinMod-Blocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.sh
executable file
·101 lines (83 loc) · 2.45 KB
/
cleanup.sh
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# Script for cleaning up blockly-specific files when merging blockly into scratch-blocks
# Removes files and directories that scratch-blocks doesn't want.
# Rachel Fenichel (fenichel@google.com)
# Note: 'ours' is scratch-blocks, 'theirs' is blockly.
# Formatting helpers.
indent() { sed 's/^/ /'; }
indent_more() { sed 's/^/\t/'; }
empty_lines() { printf '\n\n'; }
empty_lines
echo Cleaning up a merge from Blockly to Scratch-Blocks...
# Get rid of Blockly's internationalization/messages. This is not usually worth
# scrolling up to look at.
empty_lines
echo Cleaning up Blockly message files...
# Turn on more powerful globbing
shopt -s extglob
# Having trouble with directories. Let's just go there.
cd msg/json
git rm -f !(en.json|synonyms.json) | indent_more
cd ../..
# Having trouble with directories. Let's just go there.
cd msg/js
git rm -f !(en.js) | indent_more
cd ../..
# Turn powerful globbing off again
shopt -u extglob
# Whole directories that we want to get rid of.
empty_lines
echo Removing blockly-specific directories...
dirslist="accessible demos tests/generators appengine blocks local_build"
for directory in $dirslist
do
echo 'Cleaning up' $directory | indent
git rm -rf $directory | indent_more
done
# Scratch-blocks does not use generators
empty_lines
echo Removing generators...
generated_langs="dart javascript lua php python"
for lang in $generated_langs
do
echo 'Cleaning up' $lang | indent
# Directories containing block generators.
git rm -rf generators/${lang} | indent_more
done
# Built stuff that we should get rid of.
empty_lines
echo Removing built files...
built_files="blockly_compressed.js \
blockly_uncompressed.js \
blockly_accessible_compressed.js \
blockly_accessible_uncompressed.js \
blocks_compressed.js \
dart_compressed.js \
php_compressed.js \
python_compressed.js \
javascript_compressed.js \
lua_compressed.js"
for filename in $built_files
do
git rm $filename | indent_more
done
empty_lines
echo Miscellaneous cleanup...
# Use ours.
keep_ours=".github/ISSUE_TEMPLATE.md \
.github/PULL_REQUEST_TEMPLATE.md \
.gitignore \
.travis.yml \
core/block_animations.js \
msg/messages.js \
msg/js/en.js \
msg/json/en.json"
for filename in $keep_ours
do
git checkout --ours $filename && git add $filename | indent_more
done
# Scratch-blocks has separate vertical and horizontal playgrounds and block
# rendering.
git rm -f tests/playground.html core/block_render_svg.js | indent_more
empty_lines
echo Done with cleanup.