This is a Danger plugin that can assist with reviews involving Gemfile dependency changes. It can display a helpful table with links to changelogs and diffs, and provides a DSL for evaluating changes to your depdencies.
$ gem install danger-gem_changes
The following examples are changes to your Dangerfile.
# Print a markdown table summarizing Gemfile.lock changes, if any.
gem_changes.summarize_changes
Gem Source Changelog Change Version Level rubocop-factory_bot Source Changelog Downgraded 2.25.1 โ 2.25.0 Patch rubocop-performance Source Changelog Added 1.21.0 rubocop-rake Source Changelog Upgraded 0.5.0 โ 0.6.0 Minor rubocop-rspec Source Changelog Removed 2.29.2
This gem provides a DSL for accessing metadata about changes to your Gemfile dependencies:
Method | Description |
---|---|
changes |
All dependency changes |
additions |
Dependencies that were not present before |
removals |
Dependencies that are no longer present |
upgrades |
Dependencies that have a newer version than before |
downgrades |
Dependencies that have a lower version than before |
Each dependency change has information about the gem and version change:
Method | Example |
---|---|
gem.name |
rubocop-rake |
from |
0.6.0 |
to |
0.6.1 |
change? |
true |
addition? |
false |
removal? |
false |
upgrade? |
true |
downgrade? |
false |
The from
attribute will be nil for additions, and to
will be nil for removals.
# Print a warning if new dependencies were added.
warn "Dependencies added" if gem_changes.additions.any?
# Print a table of dependency downgrades, if any
downgrades = gem_changes.downgrades
gem_changes.summarize_changes changes: downgrades, title: "Dependency Downgrades"
- Clone this repo
- Run
bundle install
to setup dependencies. - Run
bundle exec rake spec
to run the tests. - Use
bundle exec guard
to automatically have tests run as you make changes. - Make your changes.