Преглед на файлове

[mod] travis build : travis uses ./manage.sh to install the geckodriver

Alexandre Flament преди 7 години
родител
ревизия
d87eb4da61
променени са 2 файла, в които са добавени 32 реда и са изтрити 22 реда
  1. 3
    4
      .travis.yml
  2. 29
    18
      manage.sh

+ 3
- 4
.travis.yml Целия файл

@@ -15,11 +15,10 @@ before_install:
15 15
   - "sh -e /etc/init.d/xvfb start"
16 16
   - npm install less less-plugin-clean-css grunt-cli
17 17
   - export PATH=`pwd`/node_modules/.bin:$PATH
18
-  - ./manage.sh grunt_packages
19
-  - mkdir -p ~/drivers; export PATH=~/drivers:$PATH;
20
-  - GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz";
21
-  - FILE=`mktemp`; wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C ~/drivers -f $FILE geckodriver; rm $FILE; chmod 777 ~/drivers/geckodriver;
18
+  - ./manage.sh install_geckodriver ~/drivers
19
+  - export PATH=~/drivers:$PATH
22 20
 install:
21
+  - ./manage.sh npm_packages
23 22
   - ./manage.sh update_dev_packages
24 23
   - pip install coveralls
25 24
 script:

+ 29
- 18
manage.sh Целия файл

@@ -25,7 +25,7 @@ install_geckodriver() {
25 25
 	return
26 26
     fi
27 27
     GECKODRIVER_VERSION="v0.18.0"
28
-    PLATFORM=`python -c "import platform; print platform.system().lower(), platform.architecture()[0]"`
28
+    PLATFORM=`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`
29 29
     case $PLATFORM in
30 30
 	"linux 32bit" | "linux2 32bit") ARCH="linux32";;
31 31
 	"linux 64bit" | "linux2 64bit") ARCH="linux64";;
@@ -34,16 +34,25 @@ install_geckodriver() {
34 34
 	"mac 64bit") ARCH="macos";;
35 35
     esac
36 36
     GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
37
-    if [ -z "$VIRTUAL_ENV" ]; then
38
-	echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
39
-	exit
37
+
38
+    if [ -z $1 ]; then
39
+	if [ -z "$VIRTUAL_ENV" ]; then
40
+	    echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
41
+	    exit    
42
+	else
43
+	    GECKODRIVER_DIR=$VIRTUAL_ENV/bin
44
+	fi
40 45
     else
41
-	echo "Installing $VIRTUAL_ENV from\n  $GECKODRIVER_URL"
42
-	FILE=`mktemp`
43
-	wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $VIRTUAL_ENV/bin/ -f $FILE geckodriver
44
-	rm $FILE
45
-	chmod 777 $VIRTUAL_ENV/bin/geckodriver
46
+	GECKODRIVER_DIR=$1
47
+	mkdir -p $GECKODRIVER_DIR
46 48
     fi
49
+
50
+    echo "Installing $GECKODRIVER_DIR from\n  $GECKODRIVER_URL"
51
+    
52
+    FILE=`mktemp`
53
+    wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $GECKODRIVER_DIR -f $FILE geckodriver
54
+    rm $FILE
55
+    chmod 777 $GECKODRIVER_DIR/geckodriver
47 56
 }
48 57
 
49 58
 pep8_check() {
@@ -91,18 +100,20 @@ styles() {
91 100
     build_style themes/courgette/less/style.less themes/courgette/css/style.css
92 101
     build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
93 102
     build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
94
-    build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
95
-    build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
96 103
     build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
97
-    build_style themes/simple/less/style.less themes/simple/css/searx.min.css
98
-    build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
104
+    # built using grunt
105
+    #build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
106
+    #build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
107
+    #build_style themes/simple/less/style.less themes/simple/css/searx.min.css
108
+    #build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
99 109
 }
100 110
 
101
-grunt_packages() {
102
-    echo '[!] Grunt packages: install dependencies'
111
+npm_packages() {
112
+    echo '[!] install NPM packages for oscar theme'
103 113
     cd $BASE_DIR/searx/static/themes/oscar
104 114
     npm install
105
-    
115
+
116
+    echo '[!] install NPM packages for simple theme'    
106 117
     cd $BASE_DIR/searx/static/themes/simple
107 118
     npm install
108 119
 }
@@ -124,7 +135,7 @@ help() {
124 135
 
125 136
 Commands
126 137
 ========
127
-    grunt_packages       - Download & install dependencies
138
+    npm_packages         - Download & install dependencies
128 139
     grunt_build          - Build js files
129 140
     help                 - This text
130 141
     locales              - Compile locales
@@ -142,4 +153,4 @@ Commands
142 153
 
143 154
 [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
144 155
     && help "action not found" \
145
-    || $ACTION
156
+    || $ACTION $2