Skip to content

fix: exclude some files from published gem#108

Merged
k0kubun merged 2 commits intoruby:masterfrom
G-Rath:patch-1
Mar 19, 2026
Merged

fix: exclude some files from published gem#108
k0kubun merged 2 commits intoruby:masterfrom
G-Rath:patch-1

Conversation

@G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Mar 19, 2026

Currently the published gem includes the .github directory which is 32kb we don't need - I've updated the files check to use what bundler generates nowdays

@G-Rath
Copy link
Contributor Author

G-Rath commented Mar 19, 2026

I think it would be good to also exclude _doc which is 16kb, but some people might feel that is worth keeping

erb.gemspec Outdated
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.files = Dir.chdir(__dir__) do
`git ls-files -z`.split("\x0").reject do |f|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})

Can we keep gemspec? Even if it's not used and doesn't have any version-specific information, I would like to see its existence for extra confidence when debugging a gem installation.

Other projects I work on generally ship the file. Even Prism, which explicitly lists up everything, keeps it. It just seems too extreme to explicitly get rid of it for saving such a small size.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I guarantee you we won't use AppVeyor or Travis CI ever again, so let's not mention it.

I just applied it and cleaned it up dc7bf9b.

@k0kubun
Copy link
Member

k0kubun commented Mar 19, 2026

I think it would be good to also exclude _doc which is 16kb, but some people might feel that is worth keeping

Yeah, not worth it. Let's stop deleting everything for saving some KBs.

@k0kubun k0kubun merged commit 2fd0a6b into ruby:master Mar 19, 2026
9 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Mar 19, 2026
(ruby/erb#108)

ruby/erb@2fd0a6b71c

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
@G-Rath G-Rath deleted the patch-1 branch March 19, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants