我读到我们不应该用 Ruby Gem 打包测试文件。
现在我想知道,我们是否应该打包 Gemspec。
例如,给定以下 Ruby Gem:
tree .
.
├── LICENSE.txt
├── README.md
├── lib
│ └── simplegem.rb
├── simplegem.gemspec
└── test
├── simplegem_test.rb
└── thing_test.rb
2 directories, 6 files
如果我的Gem::Specification看起来像:
$LOAD_PATH.unshift 'lib'
require 'simplegem'
Gem::Specification.new do |s|
s.name = 'simplegem'
s.version = Simplegem::VERSION
s.licenses = ['MIT']
s.summary = 'This is a simple gem!'
s.description = 'Much longer explanation of the simple gem!'
s.authors = ['...']
s.email = '...'
s.files = %w(simplegem.gemspec
LICENSE.txt
README.md
lib/simplegem.rb)
s.homepage = 'https://github.com/mbigras'
end
或者:
$LOAD_PATH.unshift 'lib'
require 'simplegem'
Gem::Specification.new do |s|
s.name = 'simplegem'
s.version = Simplegem::VERSION
s.licenses = ['MIT']
s.summary = 'This is a simple gem!'
s.description = 'Much longer explanation of the simple gem!'
s.authors = ['...']
s.email = '...'
s.files = %w(LICENSE.txt
README.md
lib/simplegem.rb)
s.homepage = 'https://github.com/mbigras'
end
请注意第一个如何包含simplegem.gemspec
在s.files
数组中,而第二个不包含。
- Gemspec 是否应该与 Ruby Gem 一起打包?
- 为什么或者为什么不?