Class: Danger::DangerGemChanges

Inherits:
Plugin
  • Object
show all
Defined in:
lib/danger_plugin.rb

Overview

This is your plugin class. Any attributes or methods you expose here will be available from within your Dangerfile.

To be published on the Danger plugins site, you will need to have the public interface documented. Danger uses [YARD](yardoc.org/) for generating documentation from your plugin source, and you can verify by running ‘danger plugins lint` or `bundle exec rake spec`.

You should replace these comments with a public description of your library.

Examples:

Ensure people are well warned about merging on Mondays


my_plugin.warn_on_mondays

See Also:

  • Aesthetikx/danger-gems

Instance Method Summary collapse

Instance Method Details

#additionsObject



38
39
40
# File 'lib/danger_plugin.rb', line 38

def additions
  changes.select(&:addition?)
end

#changesObject



34
35
36
# File 'lib/danger_plugin.rb', line 34

def changes
  GemChanges::Gemfile.changes(git: git)
end

#downgradesObject



50
51
52
# File 'lib/danger_plugin.rb', line 50

def downgrades
  changes.select(&:downgrade?)
end

#removalsObject



42
43
44
# File 'lib/danger_plugin.rb', line 42

def removals
  changes.select(&:removal?)
end

#summarize_changes(changes: self.changes, title: "Gemfile.lock Changes") ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/danger_plugin.rb', line 24

def summarize_changes(changes: self.changes, title: "Gemfile.lock Changes")
  return if changes.empty?

  string = "### #{title}\n"

  string += GemChanges::SummaryTable.new(changes: changes).markdown

  markdown string
end

#upgradesObject



46
47
48
# File 'lib/danger_plugin.rb', line 46

def upgrades
  changes.select(&:upgrade?)
end