我不清楚.gemspec
文件中的某些规范是做什么的。具体地,
spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
有人可以解释这些与Ruby Gem的功能有何关系以及为什么它们是必要的?
答案 0 :(得分:10)
宝石中包含的可执行文件。例如,rake gem将rake作为可执行文件。这些文件必须是可执行的Ruby文件。
gem中包含的文件。这些是构建时将包含在gem中的文件。
包含Array
个目录和文件,这些目录和文件应在gem激活时添加到$LOAD_PATH
。默认情况下为["lib"]
。
测试宝石中包含的文件。