使用 Bundler 进行 Gem 开发:包含还是排除 Gemfile?
我正在本地开发一个 gem。它是一个只有测试依赖项的命令行实用程序,我的 Gemfile 如下所示:
source :rubygems
gemspec
group :test do
gem "cucumber"
gem "aruba"
gem "rspec"
end
我的 gemspec 如下所示:
Gem::Specification.new do |s|
# authorship stuff...
s.files = `git ls-files`.split("\n")
end
这是 Bundler 创建的默认 gemspec。我知道我们应该将 Gemfile 和 Gemfile.lock 保留在源代码管理中,但我想知道如何通过 Gem::Specification#files
属性将它们包含在打包的 gem 中。是否有支持/反对在分布式 gem 中包含 Gemfile 和 Gemfile.lock 的争论?这对我来说似乎很奇怪或者至少没有必要。
I'm developing a gem locally. It's a command-line utility that only has test dependencies, and my Gemfile looks like this:
source :rubygems
gemspec
group :test do
gem "cucumber"
gem "aruba"
gem "rspec"
end
My gemspec looks like this:
Gem::Specification.new do |s|
# authorship stuff...
s.files = `git ls-files`.split("\n")
end
That's the default gemspec created by Bundler. I know we're supposed to keep Gemfile and Gemfile.lock in source control, but I'm wondering about including them in the packaged gem through the Gem::Specification#files
attribute. Are there arguments for/against including Gemfile and Gemfile.lock in the distributed gem? It seems weird or at least unnecessary to me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Yehuda Katz 刚刚在博客中讨论了这个主题! : 澄清 . gemspec 和 Gemfile
Yehuda Katz just blogged on this topic! : Clarifying the Roles of the .gemspec and Gemfile