[fix] travis build : various fix about grunt builds

This commit is contained in:
Alexandre Flament 2017-08-13 12:17:26 +02:00
parent d0cebd6e77
commit 57dc6b625f
4 changed files with 36 additions and 21 deletions

View File

@ -15,10 +15,7 @@ before_install:
- "sh -e /etc/init.d/xvfb start"
- npm install less less-plugin-clean-css grunt-cli
- export PATH=`pwd`/node_modules/.bin:$PATH
- ls -l $VIRTUAL_ENV
- ls -l $VIRTUAL_ENV/bin
- ( cd searx/static/themes/oscar;npm install; cd - )
- ( cd searx/static/themes/simple;npm install; cd - )
- ./manage.sh grunt_packages
- mkdir -p ~/drivers; export PATH=~/drivers:$PATH;
- GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz";
- FILE=`mktemp`; wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C ~/drivers -f $FILE geckodriver; rm $FILE; chmod 777 ~/drivers/geckodriver;

View File

@ -5,6 +5,8 @@ PYTHONPATH=$BASE_DIR
SEARX_DIR="$BASE_DIR/searx"
ACTION=$1
cd $BASE_DIR
update_packages() {
pip install -r "$BASE_DIR/requirements.txt"
}
@ -14,7 +16,7 @@ update_dev_packages() {
pip install -r "$BASE_DIR/requirements-dev.txt"
}
check_geckodriver() {
install_geckodriver() {
echo '[!] Checking geckodriver'
set -e
geckodriver -V 2>1 > /dev/null || NOTFOUND=1
@ -73,37 +75,47 @@ tests() {
set -e
pep8_check
unit_tests
check_geckodriver
install_geckodriver
robot_tests
set +e
}
build_style() {
# lessc -x "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
}
styles() {
echo '[!] Building styles'
build_style themes/legacy/less/style.less themes/legacy/css/style.css
build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
build_style themes/courgette/less/style.less themes/courgette/css/style.css
build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
build_style themes/simple/less/style.less themes/simple/css/searx.min.css
build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
build_style themes/legacy/less/style.less themes/legacy/css/style.css
build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
build_style themes/courgette/less/style.less themes/courgette/css/style.css
build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
build_style themes/simple/less/style.less themes/simple/css/searx.min.css
build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
}
grunt_packages() {
echo '[!] Grunt packages: install dependencies'
cd $BASE_DIR/searx/static/themes/oscar
npm install
cd $BASE_DIR/searx/static/themes/simple
npm install
}
grunt_build() {
grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
echo '[!] Grunt build : oscar theme'
grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
echo '[!] Grunt build : simple theme'
grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
}
locales() {
pybabel compile -d "$SEARX_DIR/translations"
pybabel compile -d "$SEARX_DIR/translations"
}
help() {
@ -112,6 +124,7 @@ help() {
Commands
========
grunt_packages - Download & install dependencies
grunt_build - Build js files
help - This text
locales - Compile locales
@ -123,7 +136,7 @@ Commands
unit_tests - Run unit tests
update_dev_packages - Check & update development and production dependency changes
update_packages - Check & update dependency changes
check_geckodriver - Check & download geckodriver (required for robot_tests)
install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
"
}

View File

@ -24,6 +24,7 @@ module.exports = function(grunt) {
jshint: {
files: ['gruntfile.js', 'js/searx_src/*.js'],
options: {
reporterOutput: "",
// options here to override JSHint defaults
globals: {
jQuery: true,
@ -51,6 +52,8 @@ module.exports = function(grunt) {
files: {"css/pointhi.min.css": "less/pointhi/oscar.less",
"css/logicodev.min.css": "less/logicodev/oscar.less"}
},
/*
// built with ./manage.sh styles
bootstrap: {
options: {
paths: ["less/bootstrap"],
@ -58,6 +61,7 @@ module.exports = function(grunt) {
},
files: {"css/bootstrap.min.css": "less/bootstrap/bootstrap.less"}
},
*/
},
watch: {
scripts: {

View File

@ -34,6 +34,7 @@ module.exports = function(grunt) {
jshint: {
files: ['js/searx_src/*.js'],
options: {
reporterOutput: "",
proto: true,
// options here to override JSHint defaults
globals: {