ruby - 自制公式无法运行
问题描述
我正在尝试为我构建的 Go 服务构建 Homebrew 公式,并使其易于为我的同事安装。我是 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
解决方案
推荐阅读
- python - How to use beautifulSoup to get the image from a webpage
- azure-devops - Azure DevOps API 创建项目 TF400734 (OnPrem)
- vxml - 如何将预先录制的音频(wav)发送到 vxml 中的 api?
- python - wagtail-modeltranslation 模型已经包含字段
- javascript - 无法使用打字稿在表格中获取下拉值
- javascript - 从输入反应加载文件
- c# - 代码优化 - 删除这个总是评估为“真”的表达式
- laravel - Laravel在Like Query中合并2列
- python - Matplotlib 2 以不同的大小绘制在同一图形上
- mysql - 为什么这个 Join Table 代码在 Laravel 中不返回任何数据