File: setup

package info (click to toggle)
ruby-prometheus-client-mmap 1.2.9-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 700 kB
  • sloc: ruby: 3,149; sh: 54; makefile: 21
file content (39 lines) | stat: -rwxr-xr-x 1,174 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install
bundle exec rake compile

if cargo nextest --version > /dev/null 2>&1; then exit; fi

# Check if rust is managed by 'asdf'
if command -v cargo | grep '.asdf/shims'; then
    # This will fail if no rust version has been specified in asdf
    rust_path="$(asdf where rust)/bin"

# Check for $CARGO_HOME that may not be in $HOME
# We use '/dev/null' as a fallback value known to be present and not a directory
elif [ -d "${CARGO_HOME:-/dev/null}/bin" ]; then
    rust_path="${CARGO_HOME}/bin"

# Default path for rustup.rs
elif [ -d "${HOME}/.cargo/bin" ]; then
    rust_path="${HOME}/.cargo/bin"
else
    echo "No rust toolchain found, skipping installation of 'cargo nextest'"
    exit
fi

if [ "$(uname -s)" = 'Darwin' ]; then
    host_os='mac'
elif [ "$(uname -s)" = 'Linux' ] && [ "$(uname -m)" = 'x86_64' ]; then
    host_os='linux'
else
    echo "Auto-install for 'cargo nextest' only available on MacOS and x86_64 Linux. Download manually from https://nexte.st/"
    exit
fi

echo "Installing 'cargo nextest'..."
curl -LsSf "https://get.nexte.st/latest/${host_os}" | tar zxf - -C "${rust_path}"