mirror of
https://github.com/searxng/searxng.git
synced 2024-12-26 03:00:28 +00:00
commit
d4aa1dccee
5 changed files with 63 additions and 34 deletions
|
@ -14,12 +14,11 @@ before_install:
|
||||||
- "export DISPLAY=:99.0"
|
- "export DISPLAY=:99.0"
|
||||||
- "sh -e /etc/init.d/xvfb start"
|
- "sh -e /etc/init.d/xvfb start"
|
||||||
- npm install less less-plugin-clean-css grunt-cli
|
- npm install less less-plugin-clean-css grunt-cli
|
||||||
- ( cd searx/static/themes/oscar;npm install; cd - )
|
- export PATH=`pwd`/node_modules/.bin:$PATH
|
||||||
- ( cd searx/static/themes/simple;npm install; cd - )
|
- ./manage.sh install_geckodriver ~/drivers
|
||||||
- mkdir -p ~/drivers; export PATH=~/drivers:$PATH;
|
- export PATH=~/drivers:$PATH
|
||||||
- GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/v0.14.0/geckodriver-v0.14.0-linux64.tar.gz";
|
|
||||||
- FILE=`mktemp`; wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C ~/drivers -f $FILE geckodriver; rm $FILE; chmod 777 ~/drivers/geckodriver;
|
|
||||||
install:
|
install:
|
||||||
|
- ./manage.sh npm_packages
|
||||||
- ./manage.sh update_dev_packages
|
- ./manage.sh update_dev_packages
|
||||||
- pip install coveralls
|
- pip install coveralls
|
||||||
script:
|
script:
|
||||||
|
|
81
manage.sh
81
manage.sh
|
@ -5,6 +5,8 @@ PYTHONPATH=$BASE_DIR
|
||||||
SEARX_DIR="$BASE_DIR/searx"
|
SEARX_DIR="$BASE_DIR/searx"
|
||||||
ACTION=$1
|
ACTION=$1
|
||||||
|
|
||||||
|
cd "$BASE_DIR"
|
||||||
|
|
||||||
update_packages() {
|
update_packages() {
|
||||||
pip install -r "$BASE_DIR/requirements.txt"
|
pip install -r "$BASE_DIR/requirements.txt"
|
||||||
}
|
}
|
||||||
|
@ -14,16 +16,17 @@ update_dev_packages() {
|
||||||
pip install -r "$BASE_DIR/requirements-dev.txt"
|
pip install -r "$BASE_DIR/requirements-dev.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_geckodriver() {
|
install_geckodriver() {
|
||||||
echo '[!] Checking geckodriver'
|
echo '[!] Checking geckodriver'
|
||||||
|
# TODO : check the current geckodriver version
|
||||||
set -e
|
set -e
|
||||||
geckodriver -V 2>1 > /dev/null || NOTFOUND=1
|
geckodriver -V 2>1 > /dev/null || NOTFOUND=1
|
||||||
set +e
|
set +e
|
||||||
if [ -z $NOTFOUND ]; then
|
if [ -z $NOTFOUND ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
GECKODRIVER_VERSION="v0.14.0"
|
GECKODRIVER_VERSION="v0.18.0"
|
||||||
PLATFORM=`python -c "import platform; print platform.system().lower(), platform.architecture()[0]"`
|
PLATFORM=`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`
|
||||||
case $PLATFORM in
|
case $PLATFORM in
|
||||||
"linux 32bit" | "linux2 32bit") ARCH="linux32";;
|
"linux 32bit" | "linux2 32bit") ARCH="linux32";;
|
||||||
"linux 64bit" | "linux2 64bit") ARCH="linux64";;
|
"linux 64bit" | "linux2 64bit") ARCH="linux64";;
|
||||||
|
@ -32,16 +35,25 @@ check_geckodriver() {
|
||||||
"mac 64bit") ARCH="macos";;
|
"mac 64bit") ARCH="macos";;
|
||||||
esac
|
esac
|
||||||
GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
|
GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
|
||||||
if [ -z "$VIRTUAL_ENV" ]; then
|
|
||||||
echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL"
|
if [ -z "$1" ]; then
|
||||||
exit
|
if [ -z "$VIRTUAL_ENV" ]; then
|
||||||
|
echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Installing $VIRTUAL_ENV from\n $GECKODRIVER_URL"
|
GECKODRIVER_DIR="$1"
|
||||||
FILE=`mktemp`
|
mkdir -p "$GECKODRIVER_DIR"
|
||||||
wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $VIRTUAL_ENV/bin/ -f $FILE geckodriver
|
|
||||||
rm $FILE
|
|
||||||
chmod 777 $VIRTUAL_ENV/bin/geckodriver
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Installing $GECKODRIVER_DIR/geckodriver from\n $GECKODRIVER_URL"
|
||||||
|
|
||||||
|
FILE=`mktemp`
|
||||||
|
wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C "$GECKODRIVER_DIR" -f $FILE geckodriver
|
||||||
|
rm $FILE
|
||||||
|
chmod 777 "$GECKODRIVER_DIR/geckodriver"
|
||||||
}
|
}
|
||||||
|
|
||||||
pep8_check() {
|
pep8_check() {
|
||||||
|
@ -73,37 +85,49 @@ tests() {
|
||||||
set -e
|
set -e
|
||||||
pep8_check
|
pep8_check
|
||||||
unit_tests
|
unit_tests
|
||||||
check_geckodriver
|
install_geckodriver
|
||||||
robot_tests
|
robot_tests
|
||||||
set +e
|
set +e
|
||||||
}
|
}
|
||||||
|
|
||||||
build_style() {
|
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"
|
lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
styles() {
|
styles() {
|
||||||
echo '[!] Building styles'
|
echo '[!] Building styles'
|
||||||
build_style themes/legacy/less/style.less themes/legacy/css/style.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/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.less themes/courgette/css/style.css
|
||||||
build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.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 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/pix-art/less/style.less themes/pix-art/css/style.css
|
||||||
build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
|
# built using grunt
|
||||||
build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
|
#build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
|
||||||
build_style themes/simple/less/style.less themes/simple/css/searx.min.css
|
#build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
|
||||||
build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.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
|
||||||
|
}
|
||||||
|
|
||||||
|
npm_packages() {
|
||||||
|
echo '[!] install NPM packages for oscar theme'
|
||||||
|
cd $BASE_DIR/searx/static/themes/oscar
|
||||||
|
npm install
|
||||||
|
|
||||||
|
echo '[!] install NPM packages for simple theme'
|
||||||
|
cd $BASE_DIR/searx/static/themes/simple
|
||||||
|
npm install
|
||||||
}
|
}
|
||||||
|
|
||||||
grunt_build() {
|
grunt_build() {
|
||||||
grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
|
echo '[!] Grunt build : oscar theme'
|
||||||
grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
|
grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
|
||||||
|
echo '[!] Grunt build : simple theme'
|
||||||
|
grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
locales() {
|
locales() {
|
||||||
pybabel compile -d "$SEARX_DIR/translations"
|
pybabel compile -d "$SEARX_DIR/translations"
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
@ -112,6 +136,7 @@ help() {
|
||||||
|
|
||||||
Commands
|
Commands
|
||||||
========
|
========
|
||||||
|
npm_packages - Download & install dependencies
|
||||||
grunt_build - Build js files
|
grunt_build - Build js files
|
||||||
help - This text
|
help - This text
|
||||||
locales - Compile locales
|
locales - Compile locales
|
||||||
|
@ -123,10 +148,10 @@ Commands
|
||||||
unit_tests - Run unit tests
|
unit_tests - Run unit tests
|
||||||
update_dev_packages - Check & update development and production dependency changes
|
update_dev_packages - Check & update development and production dependency changes
|
||||||
update_packages - Check & update 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)
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
|
[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
|
||||||
&& help "action not found" \
|
&& help "action not found" \
|
||||||
|| $ACTION
|
|| $ACTION "$2"
|
||||||
|
|
|
@ -7,4 +7,4 @@ splinter==0.7.5
|
||||||
transifex-client==0.12.2
|
transifex-client==0.12.2
|
||||||
unittest2==1.1.0
|
unittest2==1.1.0
|
||||||
zope.testrunner==4.5.1
|
zope.testrunner==4.5.1
|
||||||
selenium==3.0.1
|
selenium==3.5.0
|
||||||
|
|
|
@ -24,6 +24,7 @@ module.exports = function(grunt) {
|
||||||
jshint: {
|
jshint: {
|
||||||
files: ['gruntfile.js', 'js/searx_src/*.js'],
|
files: ['gruntfile.js', 'js/searx_src/*.js'],
|
||||||
options: {
|
options: {
|
||||||
|
reporterOutput: "",
|
||||||
// options here to override JSHint defaults
|
// options here to override JSHint defaults
|
||||||
globals: {
|
globals: {
|
||||||
jQuery: true,
|
jQuery: true,
|
||||||
|
@ -51,6 +52,8 @@ module.exports = function(grunt) {
|
||||||
files: {"css/pointhi.min.css": "less/pointhi/oscar.less",
|
files: {"css/pointhi.min.css": "less/pointhi/oscar.less",
|
||||||
"css/logicodev.min.css": "less/logicodev/oscar.less"}
|
"css/logicodev.min.css": "less/logicodev/oscar.less"}
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
|
// built with ./manage.sh styles
|
||||||
bootstrap: {
|
bootstrap: {
|
||||||
options: {
|
options: {
|
||||||
paths: ["less/bootstrap"],
|
paths: ["less/bootstrap"],
|
||||||
|
@ -58,6 +61,7 @@ module.exports = function(grunt) {
|
||||||
},
|
},
|
||||||
files: {"css/bootstrap.min.css": "less/bootstrap/bootstrap.less"}
|
files: {"css/bootstrap.min.css": "less/bootstrap/bootstrap.less"}
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
scripts: {
|
scripts: {
|
||||||
|
|
|
@ -34,6 +34,7 @@ module.exports = function(grunt) {
|
||||||
jshint: {
|
jshint: {
|
||||||
files: ['js/searx_src/*.js'],
|
files: ['js/searx_src/*.js'],
|
||||||
options: {
|
options: {
|
||||||
|
reporterOutput: "",
|
||||||
proto: true,
|
proto: true,
|
||||||
// options here to override JSHint defaults
|
// options here to override JSHint defaults
|
||||||
globals: {
|
globals: {
|
||||||
|
|
Loading…
Reference in a new issue