Browse Source

Check if user has docker installed, txpull/txpush

rafalp 6 years ago
parent
commit
6a216474ac
1 changed files with 30 additions and 5 deletions
  1. 30 5
      dev

+ 30 - 5
dev

@@ -50,7 +50,7 @@ docker_down() {
     docker-compose down --remove-orphans
 }
 
-require_docker() {
+require_in_docker() {
     if [[ ! $IN_DOCKER = 1 ]]; then
         error "This command can only be ran inside the running Misago container."
         exit 1
@@ -58,7 +58,7 @@ require_docker() {
 }
 
 wait_for_db() {
-    require_docker
+    require_in_docker
 
     export PGPASSWORD=$POSTGRES_PASSWORD
     RETRIES=10
@@ -69,6 +69,16 @@ wait_for_db() {
     done
 }
 
+# Check if user has docker-compose
+if ! command -v docker-compsose >/dev/null 2>&1; then
+    error "You need to have Docker installed to use this tool."
+    echo
+    echo "Docker release for your system can be downloaded for free from this page:"
+    echo "https://www.docker.com/get-started"
+    echo
+    exit 1
+fi
+
 # Commands
 intro() {
     echo "Usage: ./dev [arg] ..."
@@ -132,7 +142,7 @@ init() {
 
 # Initialization step that has to occur inside docker
 init_in_docker() {
-    require_docker
+    require_in_docker
     wait_for_db
     # initialize django project
     python misago/bin/misago-start-devproject.py
@@ -229,7 +239,7 @@ makemessages() {
 
 # Docker part of makemessages
 makemessages_in_docker() {
-    require_docker
+    require_in_docker
     
     echo "Extracting messages for $1 language:"
     cd ./misago
@@ -248,11 +258,22 @@ compilemessages() {
 
 # Docker part of compile messages
 compilemessages_in_docker() {
-    require_docker
+    require_in_docker
     cd ./misago
     django-admin.py compilemessages
 }
 
+# Pull translation files from transifex
+txpull() {
+    tx pull
+    compilemessages
+}
+
+# Push translation files to transifex
+txpush() {
+    tx push --source
+}
+
 # Command dispatcher
 if [[ $1 ]]; then
     if [[ $1 = "init" ]]; then
@@ -273,6 +294,10 @@ if [[ $1 ]]; then
         compilemessages
     elif [[ $1 = "compilemessages_in_docker" ]]; then
         compilemessages_in_docker
+    elif [[ $1 = "txpull" ]]; then
+        txpull
+    elif [[ $1 = "txpush" ]]; then
+        txpush
     else
         invalid_argument $1
     fi