From e39a9c2d4c02633f6a23465ad0037ff98e180653 Mon Sep 17 00:00:00 2001 From: emawby Date: Mon, 23 May 2022 10:15:51 -0700 Subject: [PATCH] Updating onesignal-cli.rb to use the gemspec The url and sha will be updated to a release version once a new release is made with the proper tarball. --- Formula/onesignal-cli.rb | 48 +++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/Formula/onesignal-cli.rb b/Formula/onesignal-cli.rb index babcb2c..6625300 100644 --- a/Formula/onesignal-cli.rb +++ b/Formula/onesignal-cli.rb @@ -1,23 +1,31 @@ class OnesignalCli < Formula - desc "The OneSignal CLI is a tool to work with OneSignal projects." - homepage "https://github.com/OneSignal/cli" - url "https://github.com/OneSignal/cli/archive/refs/tags/0.0.4.tar.gz" - sha256 "0ebfc2ce74af73421828bc03e5c7f11367c42903b2123655a7ec2ace004db3d4" - license "MIT" - version "0.0.4" + desc "The OneSignal CLI is a tool to work with OneSignal projects." + homepage "https://github.com/OneSignal/cli" + url "https://github.com/OneSignal/cli/archive/refs/tags/gemspec-test.tar.gz" + sha256 "102cab6438af575932dc9e8c81e5198c3d499754ff4c5f39f1e78da685002c43" + license "MIT" + version "gemspec-test" - def install - prefix.install 'Gemfile' - include.install Dir["include/*"] - lib.install Dir["lib/*"] - bin.install Dir["bin/*"] - end - - def postinstall - - end - test do - version_output = shell_output("#{bin}/onesignal version 2>&1") - assert_match("cli Version: #{version}", version_output) + depends_on "ruby" if Hardware::CPU.arm? + uses_from_macos "ruby", since: :catalina + + def install + if MacOS.version >= :mojave && MacOS::CLT.installed? + ENV["SDKROOT"] = ENV["HOMEBREW_SDKROOT"] = MacOS::CLT.sdk_path(MacOS.version) end - end \ No newline at end of file + + ENV["GEM_HOME"] = libexec + + system "gem", "build", "onesignal-cli.gemspec" + system "gem", "install", "onesignal-cli-1.0.0.gem" + + bin.install libexec/"bin/onesignal" + # onesignal executable is now run from the libexec/bin folder + bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV["GEM_HOME"]) + end + + test do + version_output = shell_output("#{bin}/onesignal version 2>&1") + assert_match("cli Version: #{version}", version_output) + end +end \ No newline at end of file