Skip to content

Commit

Permalink
Fix zip/downloading bugs experimental feature :)
Browse files Browse the repository at this point in the history
  • Loading branch information
styczynski committed Oct 29, 2017
1 parent b8e290d commit 66d4a72
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,4 @@ Simple enough, right?

[screenshot 1]: https://raw.githubusercontent.com/styczynski/bash-universal-tester/master/static/screenshots/screenshot1.png

[link download latest]: https://github.com/styczynski/bash-universal-tester/archive/1.8.0.zip
[link download latest]: https://github.com/styczynski/bash-universal-tester/archive/1.9.0.zip
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bash-universal-tester",
"version": "1.8.0",
"version": "1.9.0",
"description": "Universal testing script for bash",
"keywords": "bash, testing, tester, utest, bash-test, testing, script",
"homepage": "https://github.com/styczynski/bash-universal-tester",
Expand Down
Empty file added test/utest.yaml
Empty file.
33 changes: 31 additions & 2 deletions utest.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION="1.8.0"
VERSION="1.9.0"
IFS=$'\n'

# Dependencies
Expand Down Expand Up @@ -421,8 +421,17 @@ function update_loc {

function prepare_input {


regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
if [[ ! "${param_prog}" = "" ]]; then
if [[ "${param_dir}" = "" ]]; then
if [[ $param_prog =~ $regex ]]
then
param_dir="$param_prog"
param_prog=""
fi
fi
fi

if [[ $param_dir =~ $regex ]]
then
# Link is valid URL so try to download file
Expand Down Expand Up @@ -460,6 +469,15 @@ function prepare_input {
stdout "${B_INFO}This may take a while...${E_INFO}\n"
mkdir "$folder_loc"
unzip -q "$param_dir" -d "$folder_loc"
unpackage_status=$?
if [[ ! "$unpackage_status" = "0" ]]; then
unrar "$param_dir" "$folder_loc"
unpackage_status=$?
fi
if [[ ! "$unpackage_status" = "0" ]]; then
unp "$param_dir" "$folder_loc"
unpackage_status=$?
fi
fi

update_loc "$folder_loc"
Expand All @@ -475,6 +493,17 @@ function prepare_input {
fi

fi

# Look for utest.yaml inside test directory
if [[ -f "${param_dir}/utest.yaml" ]]; then
if [[ -f "./utest.yaml" ]]; then
stdout "${B_DEBUG}Found utest.yaml inside tests folder. But yaml file is already present.${E_DEBUG}\n"
else
stdout "${B_DEBUG}Found utest.yaml inside tests folder. Copy it.${E_DEBUG}\n"
cp -n "${param_dir}/utest.yaml" "./utest.yaml"
load_global_configuration_file
fi
fi
}

function autofind_tests {
Expand Down

0 comments on commit 66d4a72

Please sign in to comment.