danger-gem_changes
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.
Installation
“ell $ gem install danger-gem_changes
“
Usage
The following examples are changes to your Dangerfile.
Summary Table
“by
Print a markdown table summarizing Gemfile.lock changes, if any.
gem_changes.summarize_changes
“
Gemfile.lock 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
Changes DSL
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.
More Examples
“by
Print a warning if new dependencies were added.
warn “Dependencies added” if gem_changes.additions.any?
“
“by
Print a table of dependency downgrades, if any
downgrades = gem_changes.downgrades gem_changes.summarize_changes changes: downgrades, title: “Dependency Downgrades”
“
Development
- 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.