Я пытаюсь создать формулу Homebrew для службы Go, которую я создал, и облегчаю ее установку для моих коллег. Я полностью новичок ie до Ruby. Формула, которую я пишу, не запускается со следующей ошибкой
my-server.rb:1:in `<main>': uninitialized constant Formula (NameError)
Код формулы, как показано ниже
class My < Formula
desc "My Server"
homepage "https://my.io/"
url "https://github.com/my-server/archive/v1.0.8.tar.gz"
sha256 "f9c7b083f19ba1ff2ec3bebc69102ac053cb4f4e0002c6c8df7b3969d46a275b"
head "https://github.com/my-server.git"
version "1.0.8"
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
bin_path = buildpath/"src/github.com/my-server"
# Copy all files from their current location (GOPATH root)
# to $GOPATH/src/github.com/my-server
bin_path.install Dir["*"]
Language::Go.stage_deps resources, buildpath/"src"
cd bin_path do
# Install the compiled binary into Homebrew's `bin` - a pre-existing
# global variable
system "go", "build", "./..."
system "go", "build", "-o", bin/"my-server", "main.go"
end
end
test do
assert_match "[GIN-debug] Listening and serving HTTP on 0.0.0.0:3636", shell_output("#{bin}/my-server", 2)
end
end