[ruby/English] Exclude unused files from gem

6bea25038b
This commit is contained in:
Nobuyoshi Nakada 2025-07-28 00:17:02 +09:00 committed by git
parent a9eed306aa
commit f8e002a6b7

View file

@ -15,8 +15,13 @@ Gem::Specification.new do |spec|
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z 2>#{IO::NULL}`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
excludes = %W[
:^/test :^/spec :^/feature :^/bin
:^/Rakefile :^/Gemfile\* :^/.git*
:^/#{File.basename(__FILE__)}
]
spec.files = IO.popen(%W[git ls-files -z --] + excludes, err: IO::NULL) do |f|
f.readlines("\x0", chomp: true)
end
spec.require_paths = ["lib"]
end