Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Rico <[email protected]>
  • Loading branch information
SferaDev committed Jul 23, 2024
0 parents commit c745fbf
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test CLI homebrew install

on: push

jobs:
test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- run: |
brew update
brew cleanup
brew update
brew install Formula/xata.rb
xata help
54 changes: 54 additions & 0 deletions Formula/xata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class Xata < Formula
desc "Everything you need to get started with Xata"
homepage "https://xata.io"
url "https://xata-cli-assets.s3.us-east-1.amazonaws.com/versions/0.15.15/fa4cda37/xata-v0.15.15-fa4cda37-darwin-x64.tar.xz"
sha256 "c854b515d6f6f5109733f3d2a35a016409f5affbdf7bf3e0f85c3b1a88f80bfa"
version "0.15.15"
version_scheme 1

on_macos do
on_arm do
url "https://xata-cli-assets.s3.us-east-1.amazonaws.com/versions/0.15.15/fa4cda37/xata-v0.15.15-fa4cda37-darwin-arm64.tar.xz"
sha256 "3f39941b9c7be8907a741bd31db8a9ee1b55ae06720216acc6e93325418ece9e"
end
end

on_linux do
on_intel do
url "https://xata-cli-assets.s3.us-east-1.amazonaws.com/versions/0.15.15/fa4cda37/xata-v0.15.15-fa4cda37-linux-x64.tar.xz"
sha256 "50e65420c8c1a27ddb52fb831a316fa44cf9e414f7304b75140f35b0366bb756"
end
on_arm do
url "https://xata-cli-assets.s3.us-east-1.amazonaws.com/versions/0.15.15/fa4cda37/xata-v0.15.15-fa4cda37-linux-arm.tar.xz"
sha256 "bb611ec67bc9ec0fff1ac9a1965de904a7f5ea49271c233f78f6a43cdcffab46"
end
end

def install
inreplace "bin/xata", /^CLIENT_HOME=/, "export XATA_OCLIF_CLIENT_HOME=#{lib/"client"}\nCLIENT_HOME="
libexec.install Dir["*"]
bin.install_symlink libexec/"bin/xata"

bash_completion.install libexec/"autocomplete-scripts/brew/bash" => "xata"
zsh_completion.install libexec/"autocomplete-scripts/brew/zsh/_xata"
end

def caveats; <<~EOS
To use the Xata CLI's autocomplete --
Via homebrew's shell completion:
1) Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion
NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded
and called, either explicitly or via a framework like oh-my-zsh.
2) Then run
$ xata autocomplete --refresh-cache
OR
Use our standalone setup:
1) Run and follow the install steps:
$ xata autocomplete
EOS
end

test do
system bin/"xata", "version"
end
end
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Xata Homebrew Tap

![GitHub Actions CI](https://github.com/xataio/homebrew-brew/actions/workflows/test.yml/badge.svg)

Install the Heroku CLI with

$ brew tap xataio/brew && brew install xata

For more information, visit https://xata.io
54 changes: 54 additions & 0 deletions Template/xata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class Xata < Formula
desc "Everything you need to get started with Xata"
homepage "https://xata.io"
url "__CLI_MAC_INTEL_DOWNLOAD_URL__"
sha256 "__CLI_MAC_INTEL_SHA256__"
version "__CLI_VERSION__"
version_scheme 1

on_macos do
on_arm do
url "__CLI_MAC_ARM_DOWNLOAD_URL__"
sha256 "__CLI_MAC_ARM_SHA256__"
end
end

on_linux do
on_intel do
url "__CLI_LINUX_DOWNLOAD_URL__"
sha256 "__CLI_LINUX_SHA256__"
end
on_arm do
url "__CLI_LINUX_ARM_DOWNLOAD_URL__"
sha256 "__CLI_LINUX_ARM_SHA256__"
end
end

def install
inreplace "bin/xata", /^CLIENT_HOME=/, "export XATA_OCLIF_CLIENT_HOME=#{lib/"client"}\nCLIENT_HOME="
libexec.install Dir["*"]
bin.install_symlink libexec/"bin/xata"

bash_completion.install libexec/"autocomplete-scripts/brew/bash" => "xata"
zsh_completion.install libexec/"autocomplete-scripts/brew/zsh/_xata"
end

def caveats; <<~EOS
To use the Xata CLI's autocomplete --
Via homebrew's shell completion:
1) Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion
NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded
and called, either explicitly or via a framework like oh-my-zsh.
2) Then run
$ xata autocomplete --refresh-cache
OR
Use our standalone setup:
1) Run and follow the install steps:
$ xata autocomplete
EOS
end

test do
system bin/"xata", "version"
end
end

0 comments on commit c745fbf

Please sign in to comment.