Bläddra i källkod

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

Frida Tveit 9 år sedan
förälder
incheckning
edf9f27209
1 ändrade filer med 20 tillägg och 3 borttagningar
  1. 20
    3
      bin/journey-test.sh

+ 20
- 3
bin/journey-test.sh Visa fil

72
           echo "linux";;
72
           echo "linux";;
73
       (Windows*)
73
       (Windows*)
74
           echo "windows";;
74
           echo "windows";;
75
+      (MINGW*)
76
+          echo "windows";;
75
       (*)
77
       (*)
76
           echo "linux";;
78
           echo "linux";;
77
   esac
79
   esac
102
   # "curl..." :: HTTP 302 headers, including "Location" -- URL to redirect to.
104
   # "curl..." :: HTTP 302 headers, including "Location" -- URL to redirect to.
103
   # "awk..." :: pluck last path segment from "Location" (i.e. the version number)
105
   # "awk..." :: pluck last path segment from "Location" (i.e. the version number)
104
   local version="$(curl --head --silent ${latest} | awk -v FS=/ '/Location:/{print $NF}' | tr -d '\r')"
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
   mkdir -p ${exercism_home}
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
   echo "<<< download_exercism_cli()"
126
   echo "<<< download_exercism_cli()"
110
 }
127
 }
111
 
128
 
192
 
209
 
193
   local xjava=$( pwd )
210
   local xjava=$( pwd )
194
   local exercism_cli="./exercism --config ${exercism_configfile}"
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
   local total_exercises=`cat config.json | jq '.exercises | length'`
213
   local total_exercises=`cat config.json | jq '.exercises | length'`
197
   local current_exercise_number=1
214
   local current_exercise_number=1
198
   local tempfile="${TMPDIR:-/tmp}/journey-test.sh-unignore_all_tests.txt"
215
   local tempfile="${TMPDIR:-/tmp}/journey-test.sh-unignore_all_tests.txt"