From ed234d3a6e5b2f0fa5d656a777f9fa2b5eea3a22 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Wed, 18 Sep 2024 11:36:03 +0300 Subject: [PATCH 1/2] Exclude CI files from built gem Security inspection of some users or even their clients can be confused by finding out unknown YAML files with `Download` instructions inside final production releases. We can just get rid of them. Also Regex is fixed now, `/` before closing `)` was breaking. --- pg.gemspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pg.gemspec b/pg.gemspec index 8444d63a5..c1a2abe99 100644 --- a/pg.gemspec +++ b/pg.gemspec @@ -23,7 +23,9 @@ 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(__dir__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|translation)/}) } + `git ls-files -z`.split("\x0").reject do |f| + f.match(%r{\A(?:test|spec|features|translation|\.github|\.travis|\.appveyor)}) + end end spec.extensions = ["ext/extconf.rb"] spec.require_paths = ["lib"] From da14f8cd2683db657d1c35297fda5149196cb74a Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Wed, 18 Sep 2024 17:48:12 +0300 Subject: [PATCH 2/2] Exclude all files (and directories) starting with `.` from built gem They're supposed to be hidden, or non-important. --- pg.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pg.gemspec b/pg.gemspec index c1a2abe99..356bdfd09 100644 --- a/pg.gemspec +++ b/pg.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| # The `git ls-files -z` loads the files in the RubyGem that have been added into git. spec.files = Dir.chdir(File.expand_path(__dir__)) do `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{\A(?:test|spec|features|translation|\.github|\.travis|\.appveyor)}) + f.match(%r{\A(?:test|spec|features|translation|\.)}) end end spec.extensions = ["ext/extconf.rb"]