Skip to content

Commit a55cc71

Browse files
committed
Check for hex archive file names in order
* First check for file name in $hex_source if specified * Then check for first hex file in the new hex-<version>.ez format * Fall back to old hex.ez file (very unlikely to hit this condition)
1 parent eb360f6 commit a55cc71

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

lib/app_funcs.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,24 @@ function restore_app() {
1414
function copy_hex() {
1515
mkdir -p ${build_path}/.mix/archives
1616
mkdir -p ${build_path}/.hex
17-
hex_file=`basename ${hex_source:-hex-*.ez}`
1817

19-
# For older versions of hex which have no version name in file
20-
if [ -z "$hex_file" ]; then
21-
hex_file="hex.ez"
18+
if [ -z "$hex_source" ]; then
19+
hex_file=`basename ${hex_source}`
20+
else
21+
# hex file names after elixir-1.1 in the hex-<version>.ez form
22+
hex_file=$(ls -t ${HOME}/.mix/archives/hex-*.ez | head -n 1)
23+
24+
# For older versions of hex which have no version name in file
25+
if [ -z "$hex_file" ]; then
26+
hex_file="hex.ez"
27+
fi
2228
fi
2329

2430
cp ${HOME}/.hex/registry.ets ${build_path}/.hex/
25-
26-
output_section "Copying hex from $hex_file"
27-
cp ${HOME}/.mix/archives/${hex_file} ${build_path}/.mix/archives
31+
32+
full_hex_file_path=${HOME}/.mix/archives/${hex_file}
33+
output_section "Copying hex from $full_hex_file_path"
34+
cp $full_hex_file_path ${build_path}/.mix/archives
2835
}
2936

3037

0 commit comments

Comments
 (0)