Skip to content

Commit a9a1dce

Browse files
authored
Merge pull request #2269 from crazyserver/MOBILE-3333
Mobile 3333
2 parents b82e641 + 7c2fbdb commit a9a1dce

File tree

6 files changed

+210
-87
lines changed

6 files changed

+210
-87
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sudo: required
1+
os: linux
22
dist: bionic
33
group: edge
44

@@ -23,4 +23,3 @@ script:
2323

2424
after_success:
2525
- scripts/ci.sh
26-

gulpfile.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ var gulp = require('gulp'),
99
flatten = require('gulp-flatten'),
1010
npmPath = require('path'),
1111
concat = require('gulp-concat'),
12-
bufferFrom = require('buffer-from')
12+
htmlmin = require('gulp-htmlmin'),
13+
bufferFrom = require('buffer-from'),
1314
exec = require('child_process').exec,
1415
license = '' +
1516
'// (C) Copyright 2015 Moodle Pty Ltd.\n' +
@@ -293,6 +294,12 @@ gulp.task('copy-component-templates', function(done) {
293294

294295
gulp.src(templatesSrc, { allowEmpty: true })
295296
.pipe(flatten())
297+
// Check options here: https://github.com/kangax/html-minifier
298+
.pipe(htmlmin({
299+
collapseWhitespace: true,
300+
removeComments: true,
301+
caseSensitive: true
302+
}))
296303
.pipe(gulp.dest(templatesDest))
297304
.on('end', done);
298305
});

package-lock.json

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
"gulp-clip-empty-files": "^0.1.2",
134134
"gulp-concat": "^2.6.1",
135135
"gulp-flatten": "^0.4.0",
136+
"gulp-htmlmin": "^5.0.1",
136137
"gulp-rename": "^1.3.0",
137138
"gulp-slash": "^1.1.3",
138139
"lodash.template": "^4.5.0",

scripts/aot.sh

Lines changed: 0 additions & 81 deletions
This file was deleted.

scripts/ci.sh

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,81 @@
11
#!/bin/bash
2+
source "scripts/functions.sh"
23

3-
if [ $TRAVIS_EVENT_TYPE == 'cron' ] ; then
4+
if [ "$TRAVIS_EVENT_TYPE" == 'cron' ] ; then
45
# Tests scripts.
5-
echo 'CRON NOT IMPLEMENTED YET'
6+
print_error 'CRON NOT IMPLEMENTED YET'
67
else
7-
./scripts/aot.sh
8+
if [ -z $GIT_ORG_PRIVATE ] || [ -z $GIT_TOKEN ]; then
9+
print_error "Env vars not correctly defined"
10+
exit 1
11+
fi
12+
13+
# List first level of installed libraries so we can check the installed versions.
14+
print_title "NPM packages list"
15+
npm list --depth=0
16+
17+
if [ "$TRAVIS_REPO_SLUG" == 'moodlehq/moodleapp' ]; then
18+
if [ "$TRAVIS_BRANCH" == 'master' ]; then
19+
print_title "Update langpacks"
20+
cd scripts
21+
./update_lang.sh
22+
cd ..
23+
24+
print_title "Update generated lang files"
25+
git remote set-url origin https://$GIT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
26+
git fetch -q origin
27+
git add -A src/assets/lang
28+
git add */en.json
29+
git add src/config.json
30+
git commit -m 'Update lang files [ci skip]'
31+
32+
print_title "Update Licenses"
33+
npm install -g license-checker
34+
35+
jq --version
36+
license-checker --json --production --relativeLicensePath > licenses.json
37+
jq 'del(.[].path)' licenses.json > licenses_old.json
38+
mv licenses_old.json licenses.json
39+
licenses=`jq -r 'keys[]' licenses.json`
40+
echo "{" > licensesurl.json
41+
first=1
42+
for license in $licenses; do
43+
obj=`jq --arg lic $license '.[$lic]' licenses.json`
44+
licensePath=`echo $obj | jq -r '.licenseFile'`
45+
file=""
46+
if [[ ! -z "$licensePath" ]] || [[ "$licensePath" != "null" ]]; then
47+
file=$(basename $licensePath)
48+
if [ $first -eq 1 ] ; then
49+
first=0
50+
echo "\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
51+
else
52+
echo ",\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
53+
fi
54+
fi
55+
done
56+
echo "}" >> licensesurl.json
57+
58+
jq -s '.[0] * .[1]' licenses.json licensesurl.json > licenses_old.json
59+
mv licenses_old.json licenses.json
60+
rm licensesurl.json
61+
62+
git add licenses.json
63+
git commit -m 'Update licenses [ci skip]'
64+
65+
git push origin HEAD:$TRAVIS_BRANCH
66+
fi
67+
68+
if [ "$TRAVIS_BRANCH" == 'integration' ] || [ "$TRAVIS_BRANCH" == 'master' ] || [ "$TRAVIS_BRANCH" == 'desktop' ] ; then
69+
print_title "Mirror repository"
70+
git remote add mirror https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/moodleapp.git
71+
git fetch -q mirror
72+
git push -f mirror HEAD:$TRAVIS_BRANCH
73+
git push mirror --tags
74+
fi
75+
elif [ "$TRAVIS_REPO_SLUG" == "$GIT_ORG_PRIVATE/moodleapp" ]; then
76+
print_title "Run scripts"
77+
git clone --depth 1 https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/apps-scripts.git ../scripts
78+
cp ../scripts/build.sh scripts/
79+
./scripts/build.sh
80+
fi
881
fi

0 commit comments

Comments
 (0)