Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions Formula/cli.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
class Cli < Formula
desc "CLI tool for Hotdata.dev"
homepage "https://www.hotdata.dev"
version "0.1.3"
version "0.1.4"
if OS.mac?
if Hardware::CPU.arm?
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.3/hotdata-cli-aarch64-apple-darwin.tar.xz"
sha256 "d13b1a58ea3123b5a55f749a7a88a9798553c729a5155746c8bed5f4aa85599e"
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.4/hotdata-cli-aarch64-apple-darwin.tar.xz"
sha256 "6d9f61413d622f4ddf3c255f9da418107dd8c6dc2e6864b4fd79ed849212fa84"
end
if Hardware::CPU.intel?
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.3/hotdata-cli-x86_64-apple-darwin.tar.xz"
sha256 "3a5c4b3b2953e62ff9422c97a50d9f066b6a1d13e0003414e90e0c82aa42f84b"
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.4/hotdata-cli-x86_64-apple-darwin.tar.xz"
sha256 "aaade49ddf25065d855ca5e4c2438a79326a9b24b980e7802aee5af41e83c543"
end
end
if OS.linux?
if Hardware::CPU.arm?
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.3/hotdata-cli-aarch64-unknown-linux-gnu.tar.xz"
sha256 "44013ffe18ec8056d3fe3880fd5ac43654a509b2169ea9138a07f71242d30171"
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.4/hotdata-cli-aarch64-unknown-linux-gnu.tar.xz"
sha256 "78560beae08e76fee030ccdf4a67d1a8fd52d326d98a087a60c02fe6777c2722"
end
if Hardware::CPU.intel?
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.3/hotdata-cli-x86_64-unknown-linux-gnu.tar.xz"
sha256 "3702f9c1b09331c1bf3a0a0124e967dd40c5cd8be13fb3f1f2a7e297537e0d43"
url "https://github.com/hotdata-dev/hotdata-cli/releases/download/v0.1.4/hotdata-cli-x86_64-unknown-linux-gnu.tar.xz"
sha256 "dc77d5aacf31773d4715c1237030bc2f1d5644ac83d8ed23195a90844a17e29a"
end
end

BINARY_ALIASES = {
"aarch64-apple-darwin": {},
"aarch64-apple-darwin": {},
"aarch64-unknown-linux-gnu": {},
"x86_64-apple-darwin": {},
"x86_64-unknown-linux-gnu": {},
}.freeze
"x86_64-apple-darwin": {},
"x86_64-unknown-linux-gnu": {}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: .freeze was removed from this constant. Freezing constants prevents accidental mutation at runtime — worth restoring.

Suggested change
}
}.freeze


def target_triple
cpu = Hardware::CPU.arm? ? "aarch64" : "x86_64"
Expand All @@ -46,10 +46,18 @@ def install_binary_aliases!
end

def install
bin.install "hotdata" if OS.mac? && Hardware::CPU.arm?
bin.install "hotdata" if OS.mac? && Hardware::CPU.intel?
bin.install "hotdata" if OS.linux? && Hardware::CPU.arm?
bin.install "hotdata" if OS.linux? && Hardware::CPU.intel?
if OS.mac? && Hardware::CPU.arm?
bin.install "hotdata"
end
if OS.mac? && Hardware::CPU.intel?
bin.install "hotdata"
end
if OS.linux? && Hardware::CPU.arm?
bin.install "hotdata"
end
if OS.linux? && Hardware::CPU.intel?
bin.install "hotdata"
end
Comment on lines +49 to +60

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All four branches do the same thing. Since every supported OS/CPU combination installs the same binary, these can be collapsed to a single unconditional call:

Suggested change
if OS.mac? && Hardware::CPU.arm?
bin.install "hotdata"
end
if OS.mac? && Hardware::CPU.intel?
bin.install "hotdata"
end
if OS.linux? && Hardware::CPU.arm?
bin.install "hotdata"
end
if OS.linux? && Hardware::CPU.intel?
bin.install "hotdata"
end
bin.install "hotdata"


install_binary_aliases!

Expand Down
Loading