Skip to content

Commit

Permalink
Discover tar.gz asset URL
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasgarciaisaia committed Aug 7, 2017
1 parent 8f70f63 commit b87c910
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ else
CRYSTAL_VERSION_REASON='due to latest release at https://github.com/crystal-lang/crystal'
fi

CRYSTAL_URL="https://github.com/crystal-lang/crystal/releases/download/$CRYSTAL_VERSION/crystal-$CRYSTAL_VERSION-1-linux-x86_64.tar.gz"
CRYSTAL_RELEASE_ID=`${CURL} https://api.github.com/repos/crystal-lang/crystal/releases/tags/${CRYSTAL_VERSION} | json_value id 1`

CRYSTAL_URL=`${CURL} https://api.github.com/repos/crystal-lang/crystal/releases/${CRYSTAL_RELEASE_ID}/assets | grep 'https://github.com/crystal-lang/crystal/releases/download/.*-linux-x86_64.tar.gz' | sed 's/.*: "\(.*\)"/\1/'`
CRYSTAL_DIR=/tmp/crystal
unset GIT_DIR

# Install Crystal
mkdir -p $CRYSTAL_DIR
start "Installing Crystal ($CRYSTAL_VERSION $CRYSTAL_VERSION_REASON)"
start "Installing Crystal ($CRYSTAL_VERSION $CRYSTAL_VERSION_REASON) from $CRYSTAL_URL"
${CURL} $CRYSTAL_URL | tar xz -C $CRYSTAL_DIR --strip-component=1
finished
PATH="${PATH}:${CRYSTAL_DIR}/bin"
Expand Down

0 comments on commit b87c910

Please sign in to comment.