Skip to content

Commit 603793a

Browse files
committed
Merge pull request #51 from HashNuke/HashNuke-hex-path-patch
Check for hex archive file names in order
2 parents eb360f6 + 87f51db commit 603793a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/app_funcs.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,23 @@ 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 [ -n "$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+
full_hex_file_path=$(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 "$full_hex_file_path" ]; then
26+
full_hex_file_path=${HOME}/.mix/archives/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+
output_section "Copying hex from $full_hex_file_path"
33+
cp $full_hex_file_path ${build_path}/.mix/archives
2834
}
2935

3036

0 commit comments

Comments
 (0)