-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·26 lines (25 loc) · 942 Bytes
/
build.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
#!/bin/sh
name=2chan-utils
#extact comments info
sed -n '/^\/\//p' "src/${name}.js" > "${name}.meta.js"
desc=$(sed -n 's/.*@description\s*//p' src/${name}.js)
version=$(sed -n 's/.*@version\s*//p' src/${name}.js)
#uglify
uglifyjs "src/${name}.js" --screw-ie8 --stats --lint -mvc -o "/tmp/${name}.ugly.js"
#merge info and uglified script
cat "${name}.meta.js" "/tmp/${name}.ugly.js" > "src/includes/${name}.js"
#make config.xml
#cat << 'EOF' > src/config.xml #doesnt eval output
(cat << EOF
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" version="${version}" id="extensions:${name}">
<name>${name}</name>
<description>${desc}</description>
<author href="https://gist.github.com/h-collector/">h-collector <[email protected]></author>
</widget>
EOF
) > src/config.xml
#zip to opera extension
cd src
zip "../build/${name}.oex" config.xml index.html options.html "includes/${name}.js"
cd ..