brendon / acts_as_list

An ActiveRecord plugin for managing lists.
http://brendon.github.io/acts_as_list/
MIT License
2.04k stars 355 forks source link

gemspec: Remove test files, Gemfile from package #437

Closed f440 closed 2 months ago

f440 commented 2 months ago

This pull request updates the *.gemspec file to optimize the gem package size and structure. The changes include:

These changes reduce the extracted package size from 324 KB to 140 KB 160 KB.

Benefits:

References:

brendon commented 2 months ago

Thanks for this. Thanks @f440. I used bundler to create my other gem (I think!) and it has the following for files:

  spec.files = Dir.chdir(File.expand_path(__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)})
    end
  end

Not including the CHANGELOG seems weird to me so I think I want to keep that in the package. That'd feel similar to not packaging docs. I also don't see them skipping Gemfile (and this is bundler generated).

Actually I just tried using bundler 2.5.15 (what I had installed) to generate a test gem and it came up with this:

spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
    ls.readlines("\x0", chomp: true).reject do |f|
      (f == gemspec) ||
        f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
    end
  end

Perhaps we should just run with that?

f440 commented 2 months ago

Thank you for checking!

Package users typically don't check the documentation in the expanded directory. When they want to know about changes, they're more likely to look at the Changelog: https://... displayed by bundle info acts_as_list. However, I want to respect your decision.

I've incorporated your suggested content as is, with some adjustments to prevent errors.

brendon commented 2 months ago

Thanks @f440, definitely that'd usually be the case. Could be handy if someone finds themself offline with only the gem installation to work from but that would be rare :D I'll merge this now. Do you want a release straight away or are you happy to wait?

f440 commented 2 months ago

Thanks for merging this! I'm ready for a release whenever you feel it's appropriate. Thank you for creating such a useful library!

brendon commented 2 months ago

You're most welcome :D I can't take all the credit. There have been many talented authors before me on this one :)

If you ever get the chance, check out my new positioning gem: https://github.com/brendon/positioning

I've released this as 1.2.2.