Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the gem package file filter in the gemspec template #6344

Merged
merged 1 commit into from
Mar 2, 2023
Merged

Simplify the gem package file filter in the gemspec template #6344

merged 1 commit into from
Mar 2, 2023

Conversation

orien
Copy link
Contributor

@orien orien commented Feb 5, 2023

What was the end-user or developer problem that led to this PR?

When using bundle gem to create a new project, the generated gemspec uses a complex regular expression in the gem package file filter. This complexity will impede many developers if they need to make adjustments here.

What is your fix for the problem, implemented in this PR?

I propose to replace the regular expression with simple string comparisons. I think this will be much more approachable for many developers.

Example of a generated gemspec:

  spec.files = Dir.chdir(__dir__) do
    `git ls-files -z`.split("\x0").reject do |f|
      f.start_with?(*%w[my_project.gemspec bin test spec features .git .circleci appveyor])
    end
  end

Make sure the following tasks are checked

@welcome
Copy link

welcome bot commented Feb 5, 2023

Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack.

For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide

Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

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

Makes sense to me!

@deivid-rodriguez
Copy link
Member

Merging since there was no further feedback and I like this.

The regular expression is difficult to understand at a glance.
Let's replace it with a much simpler string comparison.
@deivid-rodriguez deivid-rodriguez added this pull request to the merge queue Mar 2, 2023
Merged via the queue into rubygems:master with commit b3fd179 Mar 2, 2023
@orien orien deleted the gem-file-filter branch March 2, 2023 20:06
@deivid-rodriguez deivid-rodriguez mentioned this pull request Mar 3, 2023
4 tasks
deivid-rodriguez added a commit that referenced this pull request Mar 8, 2023
Simplify the gem package file filter in the gemspec template

(cherry picked from commit b3fd179)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants