Skip to content

Commit

Permalink
Automated version bumping - splits formula into multiple files based …
Browse files Browse the repository at this point in the history
…on OS platform
  • Loading branch information
carmal891 committed Sep 23, 2024
1 parent 07ac754 commit 913e51d
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ build-iPhoneSimulator/

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*

#log file
pvsadm.log
36 changes: 17 additions & 19 deletions Formula/pvsadm.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
class Pvsadm < Formula
desc "Tool for managing the IBM Power Systems Virtual Servers"
homepage "https://github.com/ppc64le-cloud/pvsadm"
version "0.1.11"
license "Apache-2.0"
on_macos do
on_intel do
url "https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.11/pvsadm-darwin-amd64.tar.gz"
sha256 "7af9d26b61a032f874be6d5a040b762796651bfde1acf95188b23ad85de1a646"
end

on_arm do
url "https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.11/pvsadm-darwin-arm64.tar.gz"
sha256 "053068fbfe6b6ea83fe285a22e0c260651714a976aee3d2c2be6529f2fbfc5f3"
if OS.mac?
if Hardware::CPU.intel?
require_relative "pvsadm_darwin_amd64"
PvsadmDarwinAmd64.new
elsif Hardware::CPU.arm?
require_relative "pvsadm_darwin_arm64"
PvsadmDarwinArm64.new
end
end

on_linux do
on_intel do
url "https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.11/pvsadm-linux-amd64.tar.gz"
sha256 "b25e9453bdd75a11af3303783c250c93f05b3472cfe49e795bab200e5db04e03"
elsif OS.linux?
if Hardware::CPU.intel?
require_relative "pvsadm_linux_amd64"
PvsadmLinuxAmd64.new
end
end

def install
bin.install "pvsadm"
raise "Unsupported platform" unless defined? @formula

@formula.install
end

test do
output = shell_output("#{bin}/pvsadm get events 2>&1", 1)
assert_match "Error: --instance-name or --instance-name required", output
assert_match "Version: v#{version},", shell_output("#{bin}/pvsadm version | awk '{print $1, $2}'")
raise "Unsupported platform" unless defined? @formula

@formula.test
end
end
18 changes: 18 additions & 0 deletions Formula/pvsadm_darwin_amd64.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class PvsadmDarwinAmd64 < Formula
desc "Tool for managing the IBM Power Systems Virtual Servers"
homepage "https://github.com/ppc64le-cloud/pvsadm"
url "https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.11/pvsadm-darwin-amd64.tar.gz"
version "v0.1.11"
sha256 "7af9d26b61a032f874be6d5a040b762796651bfde1acf95188b23ad85de1a646"
license "Apache-2.0"

def install
bin.install "pvsadm"
end

test do
output = shell_output("#{bin}/pvsadm get events 2>&1", 1)
assert_match "Error: --instance-name or --instance-name required", output
assert_match "Version: v#{version},", shell_output("#{bin}/pvsadm version | awk '{print $1, $2}'")
end
end
18 changes: 18 additions & 0 deletions Formula/pvsadm_darwin_arm64.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class PvsadmDarwinArm64 < Formula
desc "Tool for managing the IBM Power Systems Virtual Servers"
homepage "https://github.com/ppc64le-cloud/pvsadm"
url "https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.11/pvsadm-darwin-arm64.tar.gz"
version "0.1.11"
sha256 "053068fbfe6b6ea83fe285a22e0c260651714a976aee3d2c2be6529f2fbfc5f3"
license "Apache-2.0"

def install
bin.install "pvsadm"
end

test do
output = shell_output("#{bin}/pvsadm get events 2>&1", 1)
assert_match "Error: --instance-name or --instance-name required", output
assert_match "Version: v#{version},", shell_output("#{bin}/pvsadm version | awk '{print $1, $2}'")
end
end
18 changes: 18 additions & 0 deletions Formula/pvsadm_linux_amd64.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class PvsadmLinuxAmd64 < Formula
desc "Tool for managing the IBM Power Systems Virtual Servers"
homepage "https://github.com/ppc64le-cloud/pvsadm"
url "https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.11/pvsadm-linux-amd64.tar.gz"
version "0.1.11"
sha256 "b25e9453bdd75a11af3303783c250c93f05b3472cfe49e795bab200e5db04e03"
license "Apache-2.0"

def install
bin.install "pvsadm"
end

test do
output = shell_output("#{bin}/pvsadm get events 2>&1", 1)
assert_match "Error: --instance-name or --instance-name required", output
assert_match "Version: v#{version},", shell_output("#{bin}/pvsadm version | awk '{print $1, $2}'")
end
end

0 comments on commit 913e51d

Please sign in to comment.