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

GemSourceChangelogChangeVersionLevel
rubocop-factory_botSourceChangelogDowngraded2.25.1 ➘ 2.25.0Patch
rubocop-performanceSourceChangelogAdded1.21.0
rubocop-rakeSourceChangelogUpgraded0.5.0 ➚ 0.6.0Minor
rubocop-rspecSourceChangelogRemoved2.29.2

Changes DSL

This gem provides a DSL for accessing metadata about changes to your Gemfile dependencies:

MethodDescription
changesAll dependency changes
additionsDependencies that were not present before
removalsDependencies that are no longer present
upgradesDependencies that have a newer version than before
downgradesDependencies that have a lower version than before

Each dependency change has information about the gem and version change:

MethodExample
gem.namerubocop-rake
from0.6.0
to0.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

  1. Clone this repo
  2. Run bundle install to setup dependencies.
  3. Run bundle exec rake spec to run the tests.
  4. Use bundle exec guard to automatically have tests run as you make changes.
  5. Make your changes.