Ruby Ruby Gem 打包发布问题

Kirisames · March 05, 2021 · Last by Kirisames replied at March 06, 2021 · 342 hits

rake install 成功后,require 无法找到

环境:
Kali 2004 (wsl2)
Ruby 3.0

报错图片:

gemspec:

参考文档

  • 贴上 gemspec 的内容。
  • 看看 gem 的安装目录里面有没有 lib/tests.rb 这个文件。

gem content tests 先看一下安装上了没有。

Reply to Rei

已经贴上了内容了 gem 的安装目录?不是 rake install 就能够导入了吗?

Reply to ericguo

没有返回值

顶楼 spec.files 的写法是把 git 包含的文件当作 gem 的文件,加上 gem content 内容为空,估计楼主没有把所需文件加到 git 管理。

楼主要把文件加到 git 里,或者修改 spec.files 的写法。

要让 spec.files 和 git 解耦,可以看官方文档的写法 https://guides.rubygems.org/specification-reference/#files

Reply to Rei

我把项目加到 git 本地仓库就行了,感谢

Kirisames closed this topic. 07 Mar 22:38
Rei in Ruby Gem 打包发布问题(多文件模块调用) mention this topic. 08 Mar 01:57
You need to Sign in before reply, if you don't have an account, please Sign up first.