Sfoglia il codice sorgente

Update journey-test so that it can run on windows 10

Frida Tveit 9 anni fa
parent
commit
edf9f27209
1 ha cambiato i file con 20 aggiunte e 3 eliminazioni
  1. 20
    3
      bin/journey-test.sh

+ 20
- 3
bin/journey-test.sh Vedi File

@@ -72,6 +72,8 @@ get_operating_system() {
72 72
           echo "linux";;
73 73
       (Windows*)
74 74
           echo "windows";;
75
+      (MINGW*)
76
+          echo "windows";;
75 77
       (*)
76 78
           echo "linux";;
77 79
   esac
@@ -102,10 +104,25 @@ download_exercism_cli() {
102 104
   # "curl..." :: HTTP 302 headers, including "Location" -- URL to redirect to.
103 105
   # "awk..." :: pluck last path segment from "Location" (i.e. the version number)
104 106
   local version="$(curl --head --silent ${latest} | awk -v FS=/ '/Location:/{print $NF}' | tr -d '\r')"
105
-  local download_url=${CLI_RELEASES}/download/${version}/exercism-${os}-${arch}.tgz
107
+
108
+  local download_url_suffix
109
+  local unzip_command
110
+  local unzip_from_file_option
111
+  if [[ ${os} == "windows" ]] ; then
112
+    download_url_suffix="zip"
113
+    unzip_command="unzip -d"
114
+    unzip_from_file_option=""
115
+  else
116
+    download_url_suffix="tgz"
117
+    unzip_command="tar xz -C"
118
+    unzip_from_file_option="-f"
119
+  fi
120
+  local download_url=${CLI_RELEASES}/download/${version}/exercism-${os}-${arch}.${download_url_suffix}
106 121
 
107 122
   mkdir -p ${exercism_home}
108
-  curl -s --location ${download_url} | tar xz -C ${exercism_home}
123
+  local temp=`mktemp`
124
+  curl -s --location ${download_url} > ${temp}
125
+  ${unzip_command} ${exercism_home} ${unzip_from_file_option} ${temp}
109 126
   echo "<<< download_exercism_cli()"
110 127
 }
111 128
 
@@ -192,7 +209,7 @@ solve_all_exercises() {
192 209
 
193 210
   local xjava=$( pwd )
194 211
   local exercism_cli="./exercism --config ${exercism_configfile}"
195
-  local exercises=`cat config.json | jq '.exercises[].slug' --raw-output`
212
+  local exercises=`cat config.json | jq '.exercises[].slug + " "' --join-output`
196 213
   local total_exercises=`cat config.json | jq '.exercises | length'`
197 214
   local current_exercise_number=1
198 215
   local tempfile="${TMPDIR:-/tmp}/journey-test.sh-unignore_all_tests.txt"