소스 검색

:wrench: Make FTP distant dirs

Awful boilerplate code to create dirs before putting files.
DricomDragon 1 년 전
부모
커밋
6442d5452c
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      undeployed/scripts/deploy-to-ovh.fish

+ 7 - 2
undeployed/scripts/deploy-to-ovh.fish

@@ -4,7 +4,7 @@ echo 'Deploy website through FTP'
 
 function require
         set var $argv[1]
-        if not set -q $var
+        if not set -q $var; or test -z "$var"
                 echo "Please provide a value for $var"
                 echo "Did you run the command source against your .env.local?"
                 exit
@@ -15,17 +15,22 @@ require FTP_USER
 require FTP_DEST
 require DIST_DIR
 
+set make_dirs (find $DIST_DIR -type d -printf "mkdir $FTP_DEST/%P\n")
 set files (find $DIST_DIR -type f)
+echo 'Directories to be created :'
+echo $make_dirs
 echo 'Files to be sent :'
-echo "$files"
+echo $files
 
 echo "FTP to $FTP_HOST"
 read --prompt-str "[deploy] password for $FTP_USER: " --silent password
 echo
+require password
 
 # ftp operation
 set ftp_cmd "\
 user $FTP_USER $password
+$make_dir
 nmap $DIST_DIR/\$1 $FTP_DEST/\$1
 mput $files
 bye