Skip to content

Commit

Permalink
Updating onesignal-cli.rb to use the gemspec
Browse files Browse the repository at this point in the history
The url and sha will be updated to a release version once a new release is made with the proper tarball.
  • Loading branch information
emawby committed May 23, 2022
1 parent bfccf64 commit e39a9c2
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions Formula/onesignal-cli.rb
Original file line number Diff line number Diff line change
@@ -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

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

0 comments on commit e39a9c2

Please sign in to comment.