-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Package | ||
|
||
on: | ||
release: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
brew: | ||
name: Update tap | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: code | ||
|
||
- name: Checkout tap | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: pls-rs/homebrew-pls | ||
path: tap | ||
|
||
- name: Update tap | ||
working-directory: code | ||
run: | | ||
./pkg/brew/update_formula.sh "pkg/brew/pls.template" "$GITHUB_WORKSPACE/tap/Formula/pls.rb" | ||
if ! git diff-index --quiet HEAD; then | ||
git config user.name "Dhruv Bhanushali" | ||
git config user.email "[email protected]" | ||
git commit --all --message "Update formula" | ||
git push origin main | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class Pls < Formula | ||
desc "Prettier and powerful ls for the pros" | ||
homepage "https://pls.cli.rs/" | ||
version "{{ VERSION }}" | ||
license "GPL-3.0-or-later" | ||
|
||
if OS.mac? | ||
url "{{ MAC_URL }}" | ||
sha256 "{{ MAC_SHA }}" | ||
elsif OS.linux? | ||
url "{{ LINUX_URL }}" | ||
sha256 "{{ LINUX_SHA }}" | ||
end | ||
|
||
depends_on "libgit2" | ||
|
||
def install | ||
bin.install "pls" | ||
end | ||
|
||
test do | ||
linkage_with_libgit2 = (bin/"pls").dynamically_linked_libraries.any? do |dll| | ||
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s) | ||
|
||
File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s | ||
end | ||
|
||
assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version." | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
REPO="pls-rs/pls" | ||
RELEASE=$(curl -s "https://api.github.com/repos/$REPO/releases" | jq -r '.[0]') | ||
|
||
VERSION=$(echo "$RELEASE" | jq -r '.name' | cut -c 2-) | ||
echo "Latest release is $VERSION." | ||
|
||
MAC_URL=$(echo "$RELEASE" | jq -r '.assets[] | select(.name | contains("apple-darwin")).browser_download_url') | ||
echo "Downloading macOS asset from $MAC_URL." | ||
|
||
curl -sL "$MAC_URL" -o /tmp/mac_asset | ||
MAC_SHA=$(shasum -a 256 /tmp/mac_asset | awk '{ print $1 }') | ||
echo "SHA256 for macOS asset is $MAC_SHA." | ||
|
||
LINUX_URL=$(echo "$RELEASE" | jq -r '.assets[] | select(.name | contains("unknown-linux-musl")).browser_download_url') | ||
echo "Downloading Linux asset from $LINUX_URL." | ||
|
||
curl -sL "$LINUX_URL" -o /tmp/linux_asset | ||
LINUX_SHA=$(shasum -a 256 /tmp/linux_asset | awk '{ print $1 }') | ||
echo "SHA256 for Linux asset is $LINUX_SHA." | ||
|
||
sed -e "s|{{ VERSION }}|$VERSION|g" \ | ||
-e "s|{{ MAC_URL }}|$MAC_URL|g" \ | ||
-e "s|{{ MAC_SHA }}|$MAC_SHA|g" \ | ||
-e "s|{{ LINUX_URL }}|$LINUX_URL|g" \ | ||
-e "s|{{ LINUX_SHA }}|$LINUX_SHA|g" "$1" > "$2" | ||
|
||
echo "Formula written!" |