Skip to content

Commit

Permalink
bee-download: added some tests to guess repository type
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Dreyer authored and mariux committed Dec 16, 2011
1 parent 00d9a8d commit 2f2c48c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/bee-download.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,20 @@ function usage() {
EOF
}

function guess_type() {
repository_url=${1}

[ "${repository_url##*.}" = "git" ] && echo "git" && return
[ -d "${repository_url}/.git" ] && echo "git" && return

echo ${repository_url%%:*}
}

function download() {
repository_url=${1}
repository_type=${2}

: ${repository_type:=${repository_url%%:*}}
: ${repository_type:=$(guess_type ${repository_url})}

case "${repository_type}" in
http|https)
Expand Down

0 comments on commit 2f2c48c

Please sign in to comment.