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

Remove mime-types, rexml, and webrick runtime dependencies #559

Merged
merged 8 commits into from
Jan 11, 2023
Merged

Remove mime-types, rexml, and webrick runtime dependencies #559

merged 8 commits into from
Jan 11, 2023

Conversation

orien
Copy link
Contributor

@orien orien commented Jan 7, 2023

Summary

I notice cucumber-rails doesn't directly use the mime-types, rexml, and webrick gems.

Let's remove them from the gemspec to avoid forcing unnecessary dependencies on downstream projects.

How Has This Been Tested?

The automated test suite passes showing these gems are unneeded.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

add_gem 'sqlite3', '~> 1.4'
add_gem 'selenium-webdriver', '~> 4', group: :test
Copy link
Contributor Author

@orien orien Jan 7, 2023

Choose a reason for hiding this comment

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

The selenium-webdriver uses the rexml library. Downstream projects only need rexml if they are also using the optional Selenium framework.

The selenium-webdriver maintainers have added an explicit runtime dependency in version 4. This resolves the test errors when running on Ruby 3.

@orien orien changed the title Remove mime-types and rexml runtime dependencies Remove mime-types, rexml, and webrick runtime dependencies Jan 7, 2023
Comment on lines 68 to 69
step 'I append to "Gemfile" with:', "gem 'webrick', group: 'test'\n"
run_command_and_stop('bundle install --jobs 4')
Copy link
Contributor Author

@orien orien Jan 7, 2023

Choose a reason for hiding this comment

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

Install the webrick gem in this step to support the Capybara configuration above.

This configuration is optional for downstream projects. If developers choose to use webrick, they can add the gem as a dependency in their Rails project.

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

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

Couple of stylistic changes to make. All in all I've not got any major problems with it.

Would be good to get your take on the ruby3 gems. I'm on the fence and didn't introduce it originally.

add_gem 'sqlite3', '~> 1.4'
add_gem 'selenium-webdriver', '~> 4', group: :test
Copy link
Contributor

Choose a reason for hiding this comment

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

stylistically I'm not a fan of single digits in the twiddle. I know it works, but for completeness / style can we say 4.0

Copy link
Contributor Author

@orien orien Jan 10, 2023

Choose a reason for hiding this comment

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

Updated in 10649a3

@@ -65,6 +65,8 @@
}

step 'I append to "features/support/env.rb" with:', selenium_config
step 'I append to "Gemfile" with:', "gem 'webrick', group: 'test'\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

These references to step need removing actually. So I'd prefer not doing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7928281

s.add_runtime_dependency('nokogiri', '~> 1.10')
s.add_runtime_dependency('railties', ['>= 5.0', '< 8'])
s.add_runtime_dependency('rexml', '~> 3.0') # rexml is a bundled gem from ruby 3
Copy link
Contributor

Choose a reason for hiding this comment

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

We still support lower ruby versions. I'm kinda on the fence about this, as ideally people should be controlling their own version constraints if they need this. So I think I'm 50-50 about this. I don't see the harm in retaining this until we're ruby 3.0+ only (Which isn't likely to be too long at current development rates).

That being said, if you're passionate about this, I don't see the harm in making this change. It was originally made when we introduced ruby3 into our support matrix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My argument is there is no code in the cucumber-rails gem that uses rexml or webrick. It operates identically, with or without these dependencies, on all supported versions of Ruby. There is no value in declaring them as runtime dependencies.

@@ -4,7 +4,7 @@
require 'cucumber'
require 'capybara'

module CucumberRailsHelper
module CucumberRailsHelper # rubocop:todo Layout/ModuleLength
Copy link
Contributor

Choose a reason for hiding this comment

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

Wherever possible we're trying to avoid doing in-line exclusions and using the top level control with a comment explaining why.

Ideally longer term we should compress this down a bit. But it is test only code, so it's low prio.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed this by removing a superfluous line in 7f667a8.

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

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

Think this is good. I do think some of the tidy ups inside the module do need cleaning up more. But that can be done at another time.

@luke-hill luke-hill merged commit 8363873 into cucumber:main Jan 11, 2023
@aslakhellesoy
Copy link
Contributor

Hi @orien,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

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.

None yet

4 participants