Skip to content

Commit

Permalink
Merge branch 'master' into global-justfile
Browse files Browse the repository at this point in the history
  • Loading branch information
neunenak authored Mar 2, 2024
2 parents b36c828 + b4d8e5b commit 44d76e6
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 105 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ jobs:
git diff --no-ext-diff --quiet --exit-code
./tests/completions/just.bash
- name: Check for Forbidden Words
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install ripgrep
./bin/forbid
sudo apt-get install ripgrep shellcheck
- name: Check for Forbidden Words
run: ./bin/forbid

- name: Check Install Script
run: shellcheck www/install.sh

pages:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ targets = ["x86_64-unknown-linux-gnu"]

[profile.release]
lto = true
codegen-units = 1

[[test]]
name = "integration"
Expand Down
164 changes: 85 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,10 @@ most Windows users.)
</thead>
<tbody>
<tr>
<td><a href=https://forge.rust-lang.org/release/platform-support.html>Various</a></td>
<td><a href=https://www.rust-lang.org>Cargo</a></td>
<td><a href=https://crates.io/crates/just>just</a></td>
<td><code>cargo install just</code></td>
</tr>
<tr>
<td><a href=https://en.wikipedia.org/wiki/Microsoft_Windows>Microsoft Windows</a></td>
<td><a href=https://scoop.sh>Scoop</a></td>
<td><a href=https://github.com/ScoopInstaller/Main/blob/master/bucket/just.json>just</a></td>
<td><code>scoop install just</code></td>
</tr>
<tr>
<td><a href=https://docs.brew.sh/Installation>Various</a></td>
<td><a href=https://brew.sh>Homebrew</a></td>
<td><a href=https://formulae.brew.sh/formula/just>just</a></td>
<td><code>brew install just</code></td>
</tr>
<tr>
<td><a href=https://en.wikipedia.org/wiki/MacOS>macOS</a></td>
<td><a href=https://www.macports.org>MacPorts</a></td>
<td><a href=https://ports.macports.org/port/just/summary>just</a></td>
<td><code>port install just</code></td>
<td><a href=https://alpinelinux.org>Alpine Linux</a></td>
<td><a href=https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management>apk-tools</a></td>
<td><a href=https://pkgs.alpinelinux.org/package/edge/community/x86_64/just>just</a></td>
<td><code>apk add just</code></td>
</tr>
<tr>
<td><a href=https://www.archlinux.org>Arch Linux</a></td>
Expand All @@ -166,47 +148,36 @@ most Windows users.)
<td><code>pacman -S just</code></td>
</tr>
<tr>
<td><a href=https://nixos.org/download.html#download-nix>Various</a></td>
<td><a href=https://nixos.org/nix/>Nix</a></td>
<td><a href=https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/just/default.nix>just</a></td>
<td><code>nix-env -iA nixpkgs.just</code></td>
</tr>
<tr>
<td><a href=https://nixos.org/nixos/>NixOS</a></td>
<td><a href=https://nixos.org/nix/>Nix</a></td>
<td><a href=https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/just/default.nix>just</a></td>
<td><code>nix-env -iA nixos.just</code></td>
<td><a href=https://debian.org>Debian</a> and <a href=https://ubuntu.com>Ubuntu</a> derivatives</td>
<td><a href=https://mpr.makedeb.org>MPR</a></td>
<td><a href=https://mpr.makedeb.org/packages/just>just</a></td>
<td>
<code>git clone https://mpr.makedeb.org/just</code><br>
<code>cd just</code><br>
<code>makedeb -si</code>
</td>
</tr>
<tr>
<td><a href=https://getsol.us>Solus</a></td>
<td><a href=https://getsol.us/articles/package-management/basics/en>eopkg</a></td>
<td><a href=https://dev.getsol.us/source/just/>just</a></td>
<td><code>eopkg install just</code></td>
<td><a href=https://debian.org>Debian</a> and <a href=https://ubuntu.com>Ubuntu</a> derivatives</td>
<td><a href=https://docs.makedeb.org/prebuilt-mpr>Prebuilt-MPR</a></td>
<td><a href=https://mpr.makedeb.org/packages/just>just</a></td>
<td>
<sup><b>You must have the <a href=https://docs.makedeb.org/prebuilt-mpr/getting-started/#setting-up-the-repository>Prebuilt-MPR set up</a> on your system in order to run this command.</b></sup><br>
<code>sudo apt install just</code>
</td>
</tr>
<tr>
<td><a href=https://voidlinux.org>Void Linux</a></td>
<td><a href=https://wiki.voidlinux.org/XBPS>XBPS</a></td>
<td><a href=https://github.com/void-linux/void-packages/blob/master/srcpkgs/just/template>just</a></td>
<td><code>xbps-install -S just</code></td>
<td><a href=https://getfedora.org>Fedora Linux</a></td>
<td><a href=https://dnf.readthedocs.io/en/latest/>DNF</a></td>
<td><a href=https://src.fedoraproject.org/rpms/rust-just>just</a></td>
<td><code>dnf install just</code></td>
</tr>
<tr>
<td><a href=https://www.freebsd.org>FreeBSD</a></td>
<td><a href=https://www.freebsd.org/doc/handbook/pkgng-intro.html>pkg</a></td>
<td><a href=https://www.freshports.org/deskutils/just/>just</a></td>
<td><code>pkg install just</code></td>
</tr>
<tr>
<td><a href=https://alpinelinux.org>Alpine Linux</a></td>
<td><a href=https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management>apk-tools</a></td>
<td><a href=https://pkgs.alpinelinux.org/package/edge/community/x86_64/just>just</a></td>
<td><code>apk add just</code></td>
</tr>
<tr>
<td><a href=https://getfedora.org>Fedora Linux</a></td>
<td><a href=https://dnf.readthedocs.io/en/latest/>DNF</a></td>
<td><a href=https://src.fedoraproject.org/rpms/rust-just>just</a></td>
<td><code>dnf install just</code></td>
</tr>
<tr>
<td><a href=https://www.gentoo.org>Gentoo Linux</a></td>
<td><a href=https://wiki.gentoo.org/wiki/Portage>Portage</a></td>
Expand All @@ -218,10 +189,10 @@ most Windows users.)
</td>
</tr>
<tr>
<td><a href=https://docs.conda.io/en/latest/miniconda.html#system-requirements>Various</a></td>
<td><a href=https://docs.conda.io/projects/conda/en/latest/index.html>Conda</a></td>
<td><a href=https://anaconda.org/conda-forge/just>just</a></td>
<td><code>conda install -c conda-forge just</code></td>
<td><a href=https://en.wikipedia.org/wiki/MacOS>macOS</a></td>
<td><a href=https://www.macports.org>MacPorts</a></td>
<td><a href=https://ports.macports.org/port/just/summary>just</a></td>
<td><code>port install just</code></td>
</tr>
<tr>
<td><a href=https://en.wikipedia.org/wiki/Microsoft_Windows>Microsoft Windows</a></td>
Expand All @@ -230,10 +201,34 @@ most Windows users.)
<td><code>choco install just</code></td>
</tr>
<tr>
<td><a href=https://snapcraft.io/docs/installing-snapd>Various</a></td>
<td><a href=https://snapcraft.io>Snap</a></td>
<td><a href=https://snapcraft.io/just>just</a></td>
<td><code>snap install --edge --classic just</code></td>
<td><a href=https://en.wikipedia.org/wiki/Microsoft_Windows>Microsoft Windows</a></td>
<td><a href=https://scoop.sh>Scoop</a></td>
<td><a href=https://github.com/ScoopInstaller/Main/blob/master/bucket/just.json>just</a></td>
<td><code>scoop install just</code></td>
</tr>
<tr>
<td><a href=https://en.wikipedia.org/wiki/Microsoft_Windows>Microsoft Windows</a></td>
<td><a href=https://learn.microsoft.com/en-us/windows/package-manager/>Windows Package Manager</a></td>
<td><a href=https://github.com/microsoft/winget-pkgs/tree/master/manifests/c/Casey/Just>Casey/Just</a></td>
<td><code>winget install --id Casey.Just --exact</code></td>
</tr>
<tr>
<td><a href=https://nixos.org/nixos/>NixOS</a></td>
<td><a href=https://nixos.org/nix/>Nix</a></td>
<td><a href=https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/just/default.nix>just</a></td>
<td><code>nix-env -iA nixos.just</code></td>
</tr>
<tr>
<td><a href=https://opensuse.org>openSUSE</a></td>
<td><a href=https://en.opensuse.org/Portal:Zypper>Zypper</a></td>
<td><a href=https://build.opensuse.org/package/show/Base:System/just>just</a></td>
<td><code>zypper in just</code></td>
</tr>
<tr>
<td><a href=https://getsol.us>Solus</a></td>
<td><a href=https://getsol.us/articles/package-management/basics/en>eopkg</a></td>
<td><a href=https://dev.getsol.us/source/just/>just</a></td>
<td><code>eopkg install just</code></td>
</tr>
<tr>
<td><a href=https://github.com/casey/just/releases>Various</a></td>
Expand All @@ -245,29 +240,40 @@ most Windows users.)
</td>
</tr>
<tr>
<td><a href=https://debian.org>Debian</a> and <a href=https://ubuntu.com>Ubuntu</a> derivatives</td>
<td><a href=https://mpr.makedeb.org>MPR</a></td>
<td><a href=https://mpr.makedeb.org/packages/just>just</a></td>
<td>
<code>git clone https://mpr.makedeb.org/just</code><br>
<code>cd just</code><br>
<code>makedeb -si</code>
</td>
<td><a href=https://forge.rust-lang.org/release/platform-support.html>Various</a></td>
<td><a href=https://www.rust-lang.org>Cargo</a></td>
<td><a href=https://crates.io/crates/just>just</a></td>
<td><code>cargo install just</code></td>
</tr>
<tr>
<td><a href=https://debian.org>Debian</a> and <a href=https://ubuntu.com>Ubuntu</a> derivatives</td>
<td><a href=https://docs.makedeb.org/prebuilt-mpr>Prebuilt-MPR</a></td>
<td><a href=https://mpr.makedeb.org/packages/just>just</a></td>
<td>
<sup><b>You must have the <a href=https://docs.makedeb.org/prebuilt-mpr/getting-started/#setting-up-the-repository>Prebuilt-MPR set up</a> on your system in order to run this command.</b></sup><br>
<code>sudo apt install just</code>
</td>
<td><a href=https://docs.conda.io/en/latest/miniconda.html#system-requirements>Various</a></td>
<td><a href=https://docs.conda.io/projects/conda/en/latest/index.html>Conda</a></td>
<td><a href=https://anaconda.org/conda-forge/just>just</a></td>
<td><code>conda install -c conda-forge just</code></td>
</tr>
<tr>
<td><a href=https://en.wikipedia.org/wiki/Microsoft_Windows>Microsoft Windows</a></td>
<td><a href=https://learn.microsoft.com/en-us/windows/package-manager/>Windows Package Manager</a></td>
<td><a href=https://github.com/microsoft/winget-pkgs/tree/master/manifests/c/Casey/Just>Casey/Just</a></td>
<td><code>winget install --id Casey.Just --exact</code></td>
<td><a href=https://docs.brew.sh/Installation>Various</a></td>
<td><a href=https://brew.sh>Homebrew</a></td>
<td><a href=https://formulae.brew.sh/formula/just>just</a></td>
<td><code>brew install just</code></td>
</tr>
<tr>
<td><a href=https://nixos.org/download.html#download-nix>Various</a></td>
<td><a href=https://nixos.org/nix/>Nix</a></td>
<td><a href=https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/just/default.nix>just</a></td>
<td><code>nix-env -iA nixpkgs.just</code></td>
</tr>
<tr>
<td><a href=https://snapcraft.io/docs/installing-snapd>Various</a></td>
<td><a href=https://snapcraft.io>Snap</a></td>
<td><a href=https://snapcraft.io/just>just</a></td>
<td><code>snap install --edge --classic just</code></td>
</tr>
<tr>
<td><a href=https://voidlinux.org>Void Linux</a></td>
<td><a href=https://wiki.voidlinux.org/XBPS>XBPS</a></td>
<td><a href=https://github.com/void-linux/void-packages/blob/master/srcpkgs/just/template>just</a></td>
<td><code>xbps-install -S just</code></td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ build:
fmt:
cargo fmt --all

shellcheck:
shellcheck www/install.sh

man:
cargo build --features help4help2man
help2man \
Expand Down
3 changes: 2 additions & 1 deletion src/load_dotenv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ pub(crate) fn load_dotenv(
.as_ref()
.or(settings.dotenv_path.as_ref());

if !settings.dotenv_load.unwrap_or(false) && dotenv_filename.is_none() && dotenv_path.is_none() {
if !settings.dotenv_load.unwrap_or_default() && dotenv_filename.is_none() && dotenv_path.is_none()
{
return Ok(BTreeMap::new());
}

Expand Down
48 changes: 26 additions & 22 deletions www/install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

set -euo pipefail
set -eu

if [ ! -z ${GITHUB_ACTIONS-} ]; then
if [ -n "${GITHUB_ACTIONS-}" ]; then
set -x
fi

# Check pipefail support in a subshell, ignore if unsupported
# shellcheck disable=SC3040
(set -o pipefail 2> /dev/null) && set -o pipefail

help() {
cat <<'EOF'
Install a binary release of a just hosted on GitHub
Expand All @@ -24,26 +28,25 @@ OPTIONS:
EOF
}

git=casey/just
crate=just
url=https://github.com/casey/just
releases=$url/releases

say() {
echo "install: $@" >&2
echo "install: $*" >&2
}

err() {
if [ ! -z ${td-} ]; then
if [ -n "${td-}" ]; then
rm -rf "$td"
fi

say "error: $@"
say "error: $*"
exit 1
}

need() {
if ! command -v $1 > /dev/null 2>&1; then
if ! command -v "$1" > /dev/null 2>&1; then
err "need $1 (command not found)"
fi
}
Expand Down Expand Up @@ -82,20 +85,20 @@ need mkdir
need mktemp
need tar

if [ -z ${tag-} ]; then
if [ -z "${tag-}" ]; then
need grep
need cut
fi

if [ -z ${target-} ]; then
if [ -z "${target-}" ]; then
need cut
fi

if [ -z ${dest-} ]; then
if [ -z "${dest-}" ]; then
dest="$HOME/bin"
fi

if [ -z ${tag-} ]; then
if [ -z "${tag-}" ]; then
tag=$(
curl --proto =https --tlsv1.2 -sSf \
https://api.github.com/repos/casey/just/releases/latest |
Expand All @@ -104,12 +107,12 @@ if [ -z ${tag-} ]; then
)
fi

if [ -z ${target-} ]; then
if [ -z "${target-}" ]; then
# bash compiled with MINGW (e.g. git-bash, used in github windows runners),
# unhelpfully includes a version suffix in `uname -s` output, so handle that.
# e.g. MINGW64_NT-10-0.19044
kernel=$(uname -s | cut -d- -f1)
uname_target="`uname -m`-$kernel"
uname_target="$(uname -m)-$kernel"

case $uname_target in
aarch64-Linux) target=aarch64-unknown-linux-musl;;
Expand All @@ -119,7 +122,8 @@ if [ -z ${target-} ]; then
x86_64-MINGW64_NT) target=x86_64-pc-windows-msvc;;
x86_64-Windows_NT) target=x86_64-pc-windows-msvc;;
*)
err 'Could not determine target from output of `uname -m`-`uname -s`, please use `--target`:' $uname_target
# shellcheck disable=SC2016
err 'Could not determine target from output of `uname -m`-`uname -s`, please use `--target`:' "$uname_target"
;;
esac
fi
Expand All @@ -141,17 +145,17 @@ say "Archive: $archive"
td=$(mktemp -d || mktemp -d -t tmp)

if [ "$extension" = "zip" ]; then
curl --proto =https --tlsv1.2 -sSfL $archive > $td/just.zip
unzip -d $td $td/just.zip
curl --proto =https --tlsv1.2 -sSfL "$archive" > "$td/just.zip"
unzip -d "$td" "$td/just.zip"
else
curl --proto =https --tlsv1.2 -sSfL $archive | tar -C $td -xz
curl --proto =https --tlsv1.2 -sSfL "$archive" | tar -C "$td" -xz
fi

if [ -e "$dest/just" ] && [ $force = false ]; then
if [ -e "$dest/just" ] && [ "$force" = false ]; then
err "\`$dest/just\` already exists"
else
mkdir -p $dest
install -m 755 "$td/just" $dest
mkdir -p "$dest"
install -m 755 "$td/just" "$dest"
fi

rm -rf $td
rm -rf "$td"

0 comments on commit 44d76e6

Please sign in to comment.