Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release jlen-installer #2

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# Don't track test scaffolding:
test/libs/*
test/libexec/bin
test/libexec/libexec
test/libexec/share

# Editor settings
.vscode/

# merge conflict artifacts
*.orig
5 changes: 5 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"default": true,
"MD003": { "style": "atx" },
"MD013": false
}
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sudo: false
language: bash
# Fail if any of these files have warnings
script:
- shellcheck libexec/*
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# jlenv installer & doctor scripts

[![Build Status](https://travis-ci.com/jlenv/jlenv-installer.svg?branch=master)](https://travis-ci.com/jlenv/jlenv-installer) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/dac67ef51fa34b25babb098b05145f72)](https://www.codacy.com/manual/taqtiqa-mark/jlenv-jlenv-installer?utm_source=github.com&utm_medium=referral&utm_content=jlenv/jlenv-installer&utm_campaign=Badge_Grade) [![CodeFactor](https://www.codefactor.io/repository/github/jlenv/jlenv-installer/badge)](https://www.codefactor.io/repository/github/jlenv/jlenv-installer)

## jlenv-installer

The `jlenv-installer` script idempotently installs or updates jlenv on your
Expand All @@ -11,10 +13,10 @@ installed if `jlenv install` is not already available.

```sh
# with curl
curl -fsSL https://github.com/jlenv/jlenv-installer/raw/master/bin/jlenv-installer | bash
curl -fsSL https://raw.githubusercontent.com/jlenv/jlenv-installer/master/libexec/jlenv-installer | bash

# alternatively, with wget
wget -q https://github.com/jlenv/jlenv-installer/raw/master/bin/jlenv-installer -O- | bash
wget -q https://raw.githubusercontent.com/jlenv/jlenv-installer/master/libexec/jlenv-installer -O- | bash
```

## jlenv-doctor
Expand All @@ -25,8 +27,8 @@ success of the installation and to detect common issues. You can run

```sh
# with curl
curl -fsSL https://github.com/jlenv/jlenv-installer/raw/master/bin/jlenv-doctor | bash
curl -fsSL https://raw.githubusercontent.com/jlenv/jlenv-installer/master/libexec/jlenv-doctor | bash

# alternatively, with wget
wget -q https://github.com/jlenv/jlenv-installer/raw/master/bin/jlenv-doctor -O- | bash
wget -q https://raw.githubusercontent.com/jlenv/jlenv-installer/master/libexec/jlenv-doctor -O- | bash
```
121 changes: 0 additions & 121 deletions bin/rbenv-installer

This file was deleted.

33 changes: 18 additions & 15 deletions bin/rbenv-doctor → libexec/jlenv-doctor
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
# shellcheck disable=SC2034
#
# Usage: jlenv doctor
#
# Summary: Detects common problems in jlenv installation

set -e
Expand All @@ -20,7 +23,7 @@ printc() {
fmt="${!color_name}${fmt}${color_reset}"
fi

printf "$fmt" "$@"
printf "%s %s" "$fmt" "$@"
}

if [ -t 1 ]; then
Expand All @@ -39,15 +42,15 @@ fi

warnings=0

if [ $(uname -s) = "Darwin" ]; then
if [ "$(uname -s)" = "Darwin" ]; then
bashrc=".bash_profile"
else
bashrc=".bashrc"
fi

echo -n "Checking for \`jlenv' in PATH: "
num_locations="$(which -a jlenv | uniq | wc -l)"
if [ $num_locations -eq 0 ]; then
echo -n "Checking for \`jlenv\` in PATH: "
num_locations="$(type -a jlenv | uniq | wc -l)"
if [ "$num_locations" -eq 0 ]; then
printc red "not found\n"
{ if [ -x ~/.jlenv/bin/jlenv ]; then
echo "You seem to have jlenv installed in \`$HOME/.jlenv/bin', but that"
Expand All @@ -58,14 +61,14 @@ if [ $num_locations -eq 0 ]; then
fi
} | indent
exit 1
elif [ $num_locations -eq 1 ]; then
printc green "%s\n" "$(which jlenv)"
elif [ "$num_locations" -eq 1 ]; then
printc green "%s\n" "$(command -v jlenv)"
else
printc yellow "multiple\n"
{ echo "You seem to have multiple jlenv installs in the following locations."
echo "Please pick just one installation and remove the others."
echo
which -a jlenv
type -a jlenv
} | indent
echo
: $((warnings++))
Expand Down Expand Up @@ -95,7 +98,7 @@ fi

echo -n "Checking \`jlenv install' support: "
jlenv_installs="$({ ls "$JLENV_ROOT"/plugins/*/bin/jlenv-install 2>/dev/null || true
which -a jlenv-install 2>/dev/null || true
type -a jlenv-install 2>/dev/null || true
} | uniq)"
num_installs="$(wc -l <<<"$jlenv_installs")"
if [ -z "$jlenv_installs" ]; then
Expand All @@ -105,7 +108,7 @@ if [ -z "$jlenv_installs" ]; then
}
echo
: $((warnings++))
elif [ $num_installs -eq 1 ]; then
elif [ "$num_installs" -eq 1 ]; then
printc green "$jlenv_installs"
if [[ $jlenv_installs == "$JLENV_ROOT"/plugins/* ]]; then
jlenv_install_cmd="${jlenv_installs##*/}"
Expand All @@ -126,22 +129,22 @@ else
fi

echo -n "Counting installed Julia versions: "
num_julies="$(jlenv versions --bare | wc -l)"
if [ $num_julies -eq 0 ]; then
num_julies="$(jlenv-versions --bare | wc -l)"
if [ "$num_julies" -eq 0 ]; then
printc yellow "none\n"
echo "There aren't any Julia versions installed under \`$JLENV_ROOT/versions'." | indent
[ $num_installs -eq 0 ] || {
[ "$num_installs" -eq 0 ] || {
echo -n "You can install Julia versions like so: "
printc bright "jlenv install 1.0.3\n"
} | indent
else
printc green "%d versions\n" $num_julies
printc green "%d versions\n" "$num_julies"
fi

echo -n "Auditing installed plugins: "
OLDIFS="$IFS"
IFS=$'\n'
hooks=(`jlenv hooks exec`)
hooks=$(jlenv hooks exec)
IFS="$OLDIFS"
plugin_broken=0
for hook in "${hooks[@]}"; do
Expand Down
Loading