File tree Expand file tree Collapse file tree 11 files changed +38
-34
lines changed
librelingo-standalone-server Expand file tree Collapse file tree 11 files changed +38
-34
lines changed Original file line number Diff line number Diff line change 3
3
DIRNAME=$( dirname " $0 " )
4
4
DEFAULT_OUTPUT_DIR=" $DIRNAME /bin"
5
5
if [ -n " $1 " ]; then
6
- WEBSITE_DIR=" $1 "
6
+ WEBSITE_DIR=" $1 "
7
7
else
8
8
echo " This script packs the LibreLingo website into a single executable file"
9
9
echo " Usage: build.sh WEBSITE-DIR [OUTPUT-DIR]"
@@ -24,9 +24,9 @@ function cleanup {
24
24
trap cleanup EXIT
25
25
26
26
# copy the website files to the build directory
27
- cp -r " $WEBSITE_DIR " " $BUILD_DIR /static"
27
+ cp -r " $WEBSITE_DIR " " $BUILD_DIR /static"
28
28
# copy the go files to the build directory
29
- cd $DIRNAME
29
+ cd " $DIRNAME "
30
30
cp -r ./* " $BUILD_DIR "
31
31
32
32
set -eux
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- url=` echo $1 | cut -d' ,' -f2`
4
- image_name=` echo $1 | cut -d' ,' -f1`
5
- image_id=` echo $url | cut -d' /' -f5`
3
+ url=$( echo " $1 " | cut -d' ,' -f2)
4
+ image_name=$( echo " $1 " | cut -d' ,' -f1)
5
+ image_id=$( echo " $url " | cut -d' /' -f5)
6
6
download_url=" https://unsplash.com/photos/$image_id /download"
7
7
8
8
if [ -e " ./static/images/$image_name .jpg" ]; then
11
11
12
12
echo " Fetching URL $url "
13
13
echo " Image ID $image_id "
14
- wget $download_url -O " /tmp/$image_id .jpg"
14
+ wget " $download_url " -O " /tmp/$image_id .jpg"
15
15
convert " /tmp/$image_id .jpg" -resize 512x -resize ' x512<' -gravity center -crop 512x512+0+0 +repage " /tmp/$image_id \_cropped.jpg"
16
16
convert " /tmp/$image_id .jpg" -resize 240x -resize ' x240<' -gravity center -crop 240x240+0+0 +repage " /tmp/$image_id \_tiny.jpg"
17
17
convert " /tmp/$image_id .jpg" -resize 100x -resize ' x100<' -gravity center -crop 100x100+0+0 +repage " /tmp/$image_id \_tinier.jpg"
@@ -21,4 +21,3 @@ jpegoptim "/tmp/$image_id\_tinier.jpg" -d "./static/images/" -s -m55
21
21
mv " ./static/images/$image_id \_cropped.jpg" " ./static/images/$image_name .jpg"
22
22
mv " ./static/images/$image_id \_tiny.jpg" " ./static/images/$image_name " " _tiny.jpg"
23
23
mv " ./static/images/$image_id \_tinier.jpg" " ./static/images/$image_name " " _tinier.jpg"
24
-
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
3
tail -n +2 ../../docs/image_attributions.csv | while read -r photo_description; do \
4
- ./scripts/fetchPhoto.sh $photo_description ; \
4
+ ./scripts/fetchPhoto.sh " $photo_description " ; \
5
5
done
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
3
wget " $1 " -O temp.zip
4
- unzip temp.zip " */course/*" -d ../../courses/$2
5
- mv ../../courses/$2 /* /course/* ../../courses/$2
4
+ unzip temp.zip " */course/*" -d ../../courses/" $2 "
5
+ mv ../../courses/" $2 " /* /course/* ../../courses/" $2 "
6
6
rm temp.zip
Original file line number Diff line number Diff line change 2
2
3
3
ANY_FAILED=" 0"
4
4
for d in ./courses/* / ; do
5
- d=$( echo $d | sed ' s/[^/]*\/[^/]*\///' | sed ' s/\///' )
6
- ./scripts/exportYamlCourse.sh $d
5
+ d=$( echo " $d " | sed ' s/[^/]*\/[^/]*\///' | sed ' s/\///' )
6
+ ./scripts/exportYamlCourse.sh " $d "
7
7
if [ " $? " -eq " 1" ]; then
8
8
ANY_FAILED=" 1"
9
9
fi
@@ -13,4 +13,3 @@ if [ "$ANY_FAILED" -eq "1" ]; then
13
13
echo " 😿 Could not export all yaml courses"
14
14
exit 1
15
15
fi
16
-
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
echo -en " ⏳ Exporting course $1 "
4
- cd ./apps/librelingo_json_export/ > /dev/null
5
- poetry run export-cli ../../courses/$1 ../../apps/web/src/courses/$1
4
+ cd ./apps/librelingo_json_export/ ||
5
+ {
6
+ echo -en " \r⚠️ Wrong folder structure"
7
+ exit 1
8
+ }
9
+ poetry run export-cli ../../courses/" $1 " ../../apps/web/src/courses/" $1 "
6
10
if [ $? -eq 0 ]; then
7
11
echo -en " \r✅ Exported course $1 "
8
12
else
9
13
echo -en " \r⚠️ Couldn't export course $1 "
10
14
exit 1
11
15
fi
12
- cd - > /dev/null
13
16
echo
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
for d in ./courses/* / ; do
4
- d=$( echo $d | sed ' s/[^/]*\/[^/]*\///' | sed ' s/\///' )
5
- ./scripts/updateAudioForYamlCourse.sh $d " $@ "
4
+ d=$( echo " $d " | sed ' s/[^/]*\/[^/]*\///' | sed ' s/\///' )
5
+ ./scripts/updateAudioForYamlCourse.sh " $d " " $@ "
6
6
done
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
echo -en " ⏳ Updating audio for course $1 "
4
- cd ./apps/librelingo_audios/ > /dev/null
5
- poetry run python librelingo_audios/cli.py ../../courses/$1 ../../apps/web/static/voice $1 " ${@: 2} "
4
+ cd ./apps/librelingo_audios/ ||
5
+ {
6
+ echo -en " \r⚠️ Wrong folder structure"
7
+ exit 1
8
+ }
9
+ poetry run python librelingo_audios/cli.py ../../courses/" $1 " ../../apps/web/static/voice " $1 " " ${@: 2} "
6
10
if [ $? -eq 0 ]; then
7
11
echo -en " \r✅ Updated audio for course $1 "
8
12
else
9
13
echo -en " \r⚠️ Couldn't update audio for course $1 "
10
14
fi
11
- cd - > /dev/null
12
15
echo
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
for directory in $( find apps/ -name pyproject.toml | xargs -n1 dirname) ; do
4
- echo " Updating README.md for Python package '$( basename $directory ) '..."
5
- cd $directory
4
+ echo " Updating README.md for Python package '$( basename " $directory " ) '..."
5
+ cd " $directory " ||
6
+ {
7
+ echo -en " \r⚠️ Could not enter $directory "
8
+ exit 1
9
+ }
6
10
poetry install
7
- make README.md -B $1
11
+ make README.md -B " $1 "
8
12
cd -
9
13
echo
10
14
done
11
-
Original file line number Diff line number Diff line change 2
2
3
3
./scripts/updatePypiReadmeFiles.sh -B
4
4
5
- git diff --exit-code --name-only
6
-
7
- if [ " $? " -eq " 0" ]; then
5
+ if git diff --exit-code --name-only; then
8
6
echo " 🎉 Amazing, PyPi readme files are up to date"
9
7
else
10
8
echo " 😿 Outdated PyPi readme files detected."
11
9
echo " The following files were outdated:"
12
- git diff --name-only
10
+ git diff --name-only
13
11
echo
14
12
echo " See the full list of changes:"
15
13
git diff
16
14
echo " Run the following script to automatically update the readme files:"
17
15
echo
18
16
echo " ./scripts/updatePypiReadmeFiles.sh"
19
- exit 1
17
+ exit 1
20
18
fi
You can’t perform that action at this time.
0 commit comments