|
| 1 | +class HelloWorld < Formula |
| 2 | + HELLO_WORLD_EXECUTABLE = "hello-world".freeze |
| 3 | + |
| 4 | + desc "Simple program that outputs 'Hello, World!'" |
| 5 | + homepage "https://app.lizardbyte.dev" |
| 6 | + url "https://github.com/LizardByte/actions.git" |
| 7 | + version "0.0.1" |
| 8 | + |
| 9 | + bottle do |
| 10 | + root_url "https://ghcr.io/v2/lizardbyte/homebrew" |
| 11 | + rebuild 1 |
| 12 | + sha256 arm64_tahoe: "0000000000000000000000000000000000000000000000000000000000000000" |
| 13 | + sha256 arm64_sequoia: "0000000000000000000000000000000000000000000000000000000000000000" |
| 14 | + sha256 arm64_sonoma: "0000000000000000000000000000000000000000000000000000000000000000" |
| 15 | + sha256 x86_64_linux: "0000000000000000000000000000000000000000000000000000000000000000" |
| 16 | + end |
| 17 | + |
| 18 | + def install |
| 19 | + # create hello world sh file with echo command |
| 20 | + (buildpath/HELLO_WORLD_EXECUTABLE).write <<~EOS |
| 21 | + #!/bin/sh |
| 22 | + echo "Hello, World!" |
| 23 | + EOS |
| 24 | + chmod "+x", buildpath/HELLO_WORLD_EXECUTABLE |
| 25 | + |
| 26 | + # install the hello-world file to the bin directory |
| 27 | + bin.install HELLO_WORLD_EXECUTABLE |
| 28 | + |
| 29 | + puts "buildpath: #{buildpath}" |
| 30 | + end |
| 31 | + |
| 32 | + test do |
| 33 | + assert_equal "Hello, World!", shell_output("#{bin}/#{HELLO_WORLD_EXECUTABLE}").strip |
| 34 | + |
| 35 | + puts "testpath: #{testpath}" |
| 36 | + |
| 37 | + # test the env |
| 38 | + if ENV["HOMEBREW_BUILDPATH"] |
| 39 | + dummy_filename = "dummy.txt" |
| 40 | + cd File.join(ENV["HOMEBREW_BUILDPATH"]) do |
| 41 | + # create a dummy file |
| 42 | + File.write(dummy_filename, "Hello, World!") |
| 43 | + assert_path_exists dummy_filename |
| 44 | + end |
| 45 | + assert_path_exists File.join(ENV["HOMEBREW_BUILDPATH"], dummy_filename) |
| 46 | + end |
| 47 | + end |
| 48 | +end |
| 49 | +# Created from LizardByte/actions@bbe95f05f3ce49532acf7677e0854998a1cbffaf |
0 commit comments