Skip to content

Commit ed79ac4

Browse files
authored
Merge pull request #46 from Heshdude/platform-specific-installers
Platform specific installers
2 parents 5ae5cfa + 4f34e0d commit ed79ac4

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

functions/index.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,30 @@ const storage = new Storage();
1010
const bucket = storage.bucket('installer-to.appspot.com');
1111

1212
app.get('/', (req, res) => {
13-
res.json({ status: 'OK' });
13+
res.set('Content-Type', 'application/json');
14+
res.json({ status: 'OK' });
15+
});
16+
17+
app.get('/health', (req, res) => {
18+
res.set('Content-Type', 'application/json');
19+
res.json({ status: 'OK' });
1420
});
1521

1622
app.get('/:package', (req, res) => {
1723
try {
18-
const file = bucket.file(req.params.package + '/installer.sh');
24+
const minParam = req.query.min;
25+
const withParam = req.query.with;
26+
const fileName = ['installer'];
27+
28+
if (minParam){
29+
fileName.push('min');
30+
}
31+
if (withParam){
32+
fileName.push(withParam);
33+
}
34+
fileName.push('sh');
35+
const fileNameString = fileName.join(".");
36+
const file = bucket.file(req.params.package + '/'+fileNameString);
1937
res.set('Content-Type', 'text/plain');
2038
const readStream = file.createReadStream();
2139
readStream.pipe(res);

generate.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def generate_individual_installers(method, lines):
151151
installer_sh_path = path + "/installer."+method+".sh"
152152
try:
153153
with open(installer_sh_path, "w") as installer_sh:
154+
installer_sh.write("""#!/bin/sh
155+
""")
154156
write_sudo_fix_commands(installer_sh)
155157
write_logger_commands(installer_sh)
156158
write_installer_commands(installer_sh, lines)

minify.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@ done
88

99
CHANGED=$(echo $X | tr ' ' '\n' | sort | uniq | xargs)
1010

11-
echo "minifying $CHANGED"
11+
echo "Minifying $CHANGED"
1212
#shellspec $CHANGED
1313

14-
for word in $CHANGED; do
15-
./minifier.sh -f="$word/installer.sh" > "$word/installer.min.sh"
14+
for directory in $CHANGED; do
15+
echo "Minifying direcory is: $directory"
16+
for file in $directory/installer*.sh; do
17+
case "$file" in
18+
(*.min.sh) continue;;
19+
esac
20+
filename=${file##*/}
21+
filename=${filename%.sh}
22+
echo "Minifying $directory/$filename.sh"
23+
./minifier.sh -f="$directory/$filename.sh" > "$directory/$filename.min.sh"
24+
done
1625
done

0 commit comments

Comments
 (0)