Skip to content

Commit

Permalink
Abstract out build() method
Browse files Browse the repository at this point in the history
  • Loading branch information
welwood08 authored and isaacs committed Dec 15, 2011
1 parent 109f7aa commit 6c9e612
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions nave.sh
Expand Up @@ -127,19 +127,22 @@ nave_fetch () {
remove_dir "$src" remove_dir "$src"
ensure_dir "$src" ensure_dir "$src"


# fixme: use array here. local url
local url="http://nodejs.org/dist/v$version/node-v$version.tar.gz" local urls=(
local url2="http://nodejs.org/dist/node-v$version.tar.gz" "http://nodejs.org/dist/v$version/node-v$version.tar.gz"
local url3="http://nodejs.org/dist/node-$version.tar.gz" "http://nodejs.org/dist/node-v$version.tar.gz"
curl -# -L "$url" \ "http://nodejs.org/dist/node-$version.tar.gz"
| $tar xzf - -C "$src" --strip-components=1 \ )
|| curl -# -L "$url2" \ for url in "${urls[@]}"; do
| $tar xzf - -C "$src" --strip-components=1 \ curl -#Lf "$url" \
|| curl -# -L "$url3" \ | $tar xzf - -C "$src" --strip-components=1
| $tar xzf - -C "$src" --strip-components=1 \ if [ $? -eq 0 ]; then
|| fail "Couldn't fetch $version" return 0
fi
done


return 0 remove_dir "$src"
fail "Couldn't fetch $version"
} }


build () { build () {
Expand Down Expand Up @@ -176,7 +179,7 @@ nave_usemain () {
return 0 return 0
fi fi


build "$version in main env" "$prefix" build "$version" "$prefix"
} }


nave_install () { nave_install () {
Expand Down

0 comments on commit 6c9e612

Please sign in to comment.