diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh old mode 100755 new mode 100644 index 3268481c..c17a7348 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -1,12 +1,11 @@ #!/bin/bash set -e -declare -A aliases -aliases=( - [0.12]='0 latest' -) +hash git 2>/dev/null || { echo >&2 "git not found, exiting."; } -cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +array_0_12='0 latest'; + +cd $(cd ${0%/*} && pwd -P); versions=( */ ) versions=( "${versions[@]%/}" ) @@ -15,15 +14,17 @@ url='git://github.com/joyent/docker-node' echo '# maintainer: Joyent Image Team (@joyent)' for version in "${versions[@]}"; do + eval stub=$(echo "$version" | awk -F. '{ print "$array_" $1 "_" $2 }'); commit="$(git log -1 --format='format:%H' -- "$version")" fullVersion="$(grep -m1 'ENV NODE_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)" - versionAliases=( $fullVersion $version ${aliases[$version]} ) - - echo + + versionAliases=( $fullVersion $version ${stub} ) + + echo for va in "${versionAliases[@]}"; do echo "$va: ${url}@${commit} $version" done - + for variant in onbuild slim wheezy; do commit="$(git log -1 --format='format:%H' -- "$version/$variant")" echo diff --git a/update.sh b/update.sh old mode 100755 new mode 100644 index 041e0d88..b9881618 --- a/update.sh +++ b/update.sh @@ -1,7 +1,9 @@ #!/bin/bash set -e -cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +hash npm 2>/dev/null || { echo >&2 "npm not found, exiting."; } + +cd $(cd ${0%/*} && pwd -P); versions=( "$@" ) if [ ${#versions[@]} -eq 0 ]; then @@ -9,15 +11,18 @@ if [ ${#versions[@]} -eq 0 ]; then fi versions=( "${versions[@]%/}" ) -npmVersion="$(docker run --rm node npm show npm version)" +npmVersion="$(npm show npm version 2>/dev/null)" for version in "${versions[@]}"; do - fullVersion="$(curl -sSL --compressed 'http://nodejs.org/dist' | grep '