Skip to content

Commit

Permalink
Adds formula for gradle-wiper (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ubiratansoares authored Apr 30, 2024
1 parent 6b164f4 commit 7c07510
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
12 changes: 6 additions & 6 deletions e2e/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSTALL_UPGRADE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1

tap_formulas() {
brew tap dotanuki-labs/tap "/home/linuxbrew/dotanuki-taps"
Expand All @@ -25,7 +26,7 @@ test_formula() {

echo
echo "Installing $name ($url)"
brew install "$name"
brew install "$name" -q

echo
echo "Testing installation ($name) --help"
Expand All @@ -35,9 +36,8 @@ test_formula() {
echo
}

tap_formulas
test_formula "gwv" "https://github.com/dotanuki-labs/gradle-wrapper-validator"
readonly dotanuki="https://github.com/dotanuki-labs"

echo
echo "🔥 Done!"
echo
tap_formulas
test_formula "gwv" "$dotanuki/gradle-wrapper-validator"
test_formula "gradle-wiper" "$dotanuki/gradle-wiper"
43 changes: 43 additions & 0 deletions gradle-wiper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

class GradleWiper < Formula
desc "Easily reclaim machine resources (RAM, Disk) taken by Gradle builds"
homepage "https://github.com/dotanuki-labs/gradle-wiper"
version "0.1.0"

os = OS.mac? ? "apple-darwin" : "unknown-linux-gnu"
arch = case Hardware::CPU.arch
when :x86_64 then "x86_64"
when :arm64 then "aarch64"
else
raise "gradle-wiper: Unsupported system architecture #{Hardware::CPU.arch}"
end

@@filename = "gradle-wiper-#{arch}-#{os}"
@@url = "#{homepage}/releases/download/#{version}/#{@@filename}"
@@using = :nounzip

@@sha256 = case "#{arch}-#{os}"
when "x86_64-unknown-linux-gnu" then "66cdb629934e4b114520685260ce7074f75702f9a92de820b0a5da0fd1678d00"
when "x86_64-apple-darwin" then "307e40c054502b656d568b306a397c6ae79f57ecc7cf0a559effab3f36624a02"
when "aarch64-unknown-linux-gnu" then "10c51bbb0613bfc45bb7a9f0e56500031a166e432e9f8449dc1f2f0af45a7adb"
when "aarch64-apple-darwin" then "72aecebcd5fe423d6de2f59c0e73102e31d14f0b765beb2bac94e5f830c382c4"
else
raise "gradle-wiper: Unsupported target : #{arch}-#{os}"
end

sha256 @@sha256
url @@url,
using: @@using


def install
filename = @@filename
bin.install filename => "gradle-wiper"
end

test do
system "#{bin}/gradle-wiper", "--version"
end
end

0 comments on commit 7c07510

Please sign in to comment.