Skip to content

Commit

Permalink
asdf: prepare for v0.16.0 release
Browse files Browse the repository at this point in the history
asdf v0.16.0 is written in Go, and the build and install process for it has changed.
  • Loading branch information
Stratus3D committed Jan 28, 2025
1 parent f933af4 commit 34d3f52
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions Formula/a/asdf.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class Asdf < Formula
desc "Extendable version manager with support for Ruby, Node.js, Erlang & more"
homepage "https://asdf-vm.com/"
url "https://github.com/asdf-vm/asdf/archive/refs/tags/v0.15.0.tar.gz"
sha256 "d0cafe61d27b5e3fcb53658821bfbf744fd040a8ea28b0e22277e032b8e8f7fe"
url "https://github.com/asdf-vm/asdf.git", revision: "78a00fc90345bd77d83bb9b2b61f85756fceb1a6"
# , tag: "v0.16.0" # uncomment this when v0.16.0 is tagged
version "0.16.0-dev"
license "MIT"
head "https://github.com/asdf-vm/asdf.git", branch: "master"

Expand All @@ -16,38 +17,40 @@ class Asdf < Formula
sha256 cellar: :any_skip_relocation, all: "a94dd362ce5c3a818f4fa56607eac3c616a3c1191e9f41480093bda2dc308af4"
end

depends_on "autoconf"
depends_on "automake"
depends_on "coreutils"
depends_on "libtool"
depends_on "libyaml"
depends_on "go" => :build

depends_on "openssl@3"
depends_on "readline"
depends_on "unixodbc"

def install
bash_completion.install "completions/asdf.bash" => "asdf"
fish_completion.install "completions/asdf.fish"
zsh_completion.install "completions/_asdf"
libexec.install Dir["*"]
system("go", "build", *std_go_args(ldflags: "-s -X main.version=#{version}"), "./cmd/asdf")
original_stdout=$stdout

$stdout = File.new("asdf.bash", "w")
system(bin/"asdf", "completion", "bash")
bash_completion.install "asdf.bash" => "asdf"

$stdout = File.new("asdf.fish", "w")
system(bin/"asdf", "completion", "fish")
fish_completion.install "asdf.fish"

bin.write_exec_script libexec/"bin/asdf"
$stdout = File.new("_asdf", "w")
system(bin/"asdf", "completion", "zsh")
zsh_completion.install "_asdf"
$stdout = original_stdout
end

def caveats
<<~EOS
To use asdf, add the following line (or equivalent) to your shell profile
e.g. ~/.profile or ~/.zshrc:
. #{opt_libexec}/asdf.sh
e.g. ~/.config/fish/config.fish
source #{opt_libexec}/asdf.fish
Restart your terminal for the settings to take effect.
To complete installation of asdf please follow the instructions on this page:
https://asdf-vm.com/guide/getting-started.html
Then restart your terminal for the settings to take effect.
EOS
end

test do
assert_match version.to_s, shell_output("#{bin}/asdf version")
output = shell_output("#{bin}/asdf plugin-list 2>&1")
assert_match "No plugins installed", output
assert_match "No plugins installed", shell_output("#{bin}/asdf plugin list 2>&1")
end
end

0 comments on commit 34d3f52

Please sign in to comment.