Explorar el Código

[mod] ./manage.sh can download geckodriver and install it into the virtual environment

Alexandre Flament hace 8 años
padre
commit
6db25fc5c2
Se han modificado 1 ficheros con 32 adiciones y 0 borrados
  1. 32
    0
      manage.sh

+ 32
- 0
manage.sh Ver fichero

@@ -14,6 +14,36 @@ update_dev_packages() {
14 14
     pip install --upgrade -r "$BASE_DIR/requirements-dev.txt"
15 15
 }
16 16
 
17
+check_geckodriver() {
18
+    echo '[!] Checking geckodriver'
19
+    set -e
20
+    geckodriver -V 2>1 > /dev/null || NOTFOUND=1
21
+    set +e
22
+    if [ -z $NOTFOUND ]; then
23
+	return
24
+    fi
25
+    GECKODRIVER_VERSION="v0.11.1"
26
+    PLATFORM=`python -c "import platform; print platform.system().lower(), platform.architecture()[0]"`
27
+    case $PLATFORM in
28
+	"linux 32bit" | "linux2 32bit") ARCH="linux32";;
29
+	"linux 64bit" | "linux2 64bit") ARCH="linux64";;
30
+	"windows 32 bit") ARCH="win32";;
31
+	"windows 64 bit") ARCH="win64";;
32
+	"mac 64bit") ARCH="macos";;
33
+    esac
34
+    GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
35
+    if [ -z "$VIRTUAL_ENV" ]; then
36
+	echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
37
+	exit
38
+    else
39
+	echo "Installing $VIRTUAL_ENV from\n  $GECKODRIVER_URL"
40
+	FILE=`mktemp`
41
+	wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $VIRTUAL_ENV/bin/ -f $FILE geckodriver
42
+	rm $FILE
43
+	chmod 777 $VIRTUAL_ENV/bin/geckodriver
44
+    fi
45
+}
46
+
17 47
 pep8_check() {
18 48
     echo '[!] Running pep8 check'
19 49
     # ignored rules:
@@ -43,6 +73,7 @@ tests() {
43 73
     set -e
44 74
     pep8_check
45 75
     unit_tests
76
+    check_geckodriver
46 77
     robot_tests
47 78
     set +e
48 79
 }
@@ -88,6 +119,7 @@ Commands
88 119
     unit_tests           - Run unit tests
89 120
     update_dev_packages  - Check & update development and production dependency changes
90 121
     update_packages      - Check & update dependency changes
122
+    check_geckodriver    - Check & download geckodriver (required for robot_tests)
91 123
 "
92 124
 }
93 125