It's time for another round of periodic maintenance activities for the gem. In this video, we install Ruby 3.3 on the local machine and check its compatibility with the current state of the Gem.
The version of RuboCop we have installed errors out when we try to run it. Since we plan on updating all of the dependencies anyway, we do that next and see if that resolves the issue. RuboCop runs after the `bundle update`, but it introduces some new violations.
Most of them are auto-correctable and are related to replacing additional parameters like `*args, **kwargs, &block` with the more succinct `...` or using string interpolation for symbols when passing arguments to the :send method.
The first non-auto-correctable one is a new cop called Gemspec/DevelopmentDependencies. It has a default enforced style of wanting you to put your development dependencies in your Gemfile instead of your gemspec. For now, we decide to leave the development dependencies in the gemspec and make that the enforced style.
The second group of new violations we need to correct are RSpec/IndexedLet. This cop discourages you from using variables like :die1, :die2, :die3, :die4 in RSpec let declarations. This is a good practice and we set about providing more meaningful names for the violations.
Once the RuboCop violations are cleaned up and we double-check the specs are still passing, we add Ruby 3.3 to the GitHub Actions for the gem, commit, and push to GitHub.
With the new RuboCop violations the maintenance was too much to tackle in a single video. We'll finish up in the next one.
This video covers:
00:00:00 Introduction
00:02:05 Install Ruby 3.3.0 on the local machine
00:03:40 Install the bundle and try to run RuboCop and RSpec. RuboCop errors out in 3.3.
00:04:57 Look for newer versions of dependencies on RubyGems.org and update the versions in the Gemspec and update the bundle
00:09:17 Try to run RuboCop again. It executes with new violations. Autocorrect the auto-correctable ones and see if the changes are acceptable
00:12:32 Review the remaining RuboCop violations
00:13:13 Review the Gemspec/DevelopmentDependencies violations. Resolve by using EnforcedStyle: gemspec in .rubocop.yml
00:16:10 Resolve RSpec/IndexedLet by having more descriptive let variable names
00:21:38 Add Ruby 3.3 to GitHub Actions
00:22:51 Commit and push the changes. Review remaining items to do. Ensure the build succeeds.
#ruby #rubygems #codecast #screencast #NerdDice #DnD #roleplaying #softwaredevelopment #github #opensource #dice #release #tlm #rubocop #bundler #dependencies
See other related StatelessCode videos:
- Create a RubyGem 09: Fix RuboCop issues and release a patch version [ Ссылка ]
- Create a RubyGem 89: Add Ruby 3.2 to GitHub Actions and Update RSpec to a compatible version [ Ссылка ]
- Create a RubyGem 93: Refactor RuboCop to Enable New Cops by Default for the Gem [ Ссылка ]
- Create a RubyGem 97: Update Bundle Before Performing Releases [ Ссылка ]
This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
Ещё видео!