Skip to content

Commit

Permalink
racket
Browse files Browse the repository at this point in the history
  • Loading branch information
vic committed Jun 29, 2017
1 parent e6c9a5b commit 2bafbb6
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: generic

matrix:
include:
- os: linux
services:
- docker
script:
- |
bash -c "while true; do echo \$(date) - travis building ...; sleep 540; done" &
export PING_LOOP_PID=$!
- |
cat <<-EOF | docker run -i ubuntu bash -
set -e
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq && apt-get install -qq git curl build-essential unzip m4
git clone https://github.com/asdf-vm/asdf.git
. asdf/asdf.sh
asdf plugin-test racket https://github.com/vic/asdf-racket.git 'racket --help'
EOF
after_script:
- kill -9 $PING_LOOP_PID

- os: osx
before_script:
- git clone https://github.com/asdf-vm/asdf.git
- . asdf/asdf.sh
script:
- |
bash -c "while true; do echo \$(date) - travis building ...; sleep 540; done" &
export PING_LOOP_PID=$!
- asdf plugin-test racket https://github.com/vic/asdf-racket.git 'racket --help'
after_script:
- kill -9 $PING_LOOP_PID
56 changes: 56 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash

racket_pkg() {
local version=$1
local platform="src-builtpkgs"
if [ "${ASDF_RACKET_MINIMAL}" == "true" ]; then
platform="src"
fi
echo "https://mirror.racket-lang.org/installers/${version}/racket-${version}-${platform}.tgz"
}

racket_install() {
local install_type=$1
local release=$2
local install_path=$3

local tmp_dir=$(mktemp -d -t racket_XXXXXXX)

local current_script_path=$(dirname ${BASH_SOURCE[0]})
local plugin_path=$(dirname $current_script_path)

# running this in a subshell
# we don't want to disturb current working dir
(
set -e
cd $tmp_dir

ASDF_RACKET_CONFIG_FLAGS="${ASDF_RACKET_CONFIG_FLAGS} --prefix ${install_path}"

if [ "$(uname -s)" == "Darwin" ]; then
ASDF_RACKET_CONFIG_FLAGS="${ASDF_RACKET_CONFIG_FLAGS} --enable-macprefix"
fi

if [ "$install_type" != "version" ]; then
echo "asdf-racket supports release installs only."
exit 1
fi

echo ${racket_pkg}
curl -L "$(racket_pkg $release)" > racket-${release}.tgz
tar -xf racket-${release}.tgz
cd racket-${release}/src/
./configure ${ASDF_RACKET_CONFIG_FLAGS}
make
make install

if [ "${ASDF_RACKET_MINIMAL}" != "true" ]; then
$install_path/bin/raco pkg install --auto -i main-distribution
fi

echo "Installed Racket ${release}"

) || (rm -rf $install_path; exit 1)
}

racket_install $ASDF_INSTALL_TYPE $ASDF_INSTALL_VERSION $ASDF_INSTALL_PATH
10 changes: 10 additions & 0 deletions bin/list-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# stolen from https://github.com/rbenv/ruby-build/pull/631/files#diff-fdcfb8a18714b33b07529b7d02b54f1dR942
function sort_versions() {
sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | \
LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}'
}

curl -s https://download.racket-lang.org/all-versions.html | grep -E -o 'Version [0-9.]+' | cut -d' ' -f 2 | sort_versions

0 comments on commit 2bafbb6

Please sign in to comment.