Class: Danger::DangerfileGitPlugin
- Defined in:
- lib/danger/danger_core/plugins/dangerfile_git_plugin.rb
Git Files collapse
-
#added_files ⇒ FileList
Paths for files that were added during the diff.
-
#deleted_files ⇒ FileList
Paths for files that were removed during the diff.
-
#modified_files ⇒ FileList
Paths for files that changed during the diff.
Git Metadata collapse
-
#commits ⇒ Git::Log
The log of commits inside the diff.
-
#deletions ⇒ Object
The overall lines of code removed in the diff.
-
#insertions ⇒ Object
The overall lines of code added in the diff.
-
#lines_of_code ⇒ Object
The overall lines of code added/removed in the diff.
Instance Method Summary collapse
-
#initialize(dangerfile) ⇒ DangerfileGitPlugin
constructor
A new instance of DangerfileGitPlugin.
Methods inherited from Plugin
#fail, instance_name, #method_missing, #warn
Constructor Details
#initialize(dangerfile) ⇒ DangerfileGitPlugin
Returns a new instance of DangerfileGitPlugin.
6 7 8 9 10 11 |
# File 'lib/danger/danger_core/plugins/dangerfile_git_plugin.rb', line 6 def initialize(dangerfile) super(dangerfile) raise unless dangerfile.env.scm.class == Danger::GitRepo @git = dangerfile.env.scm end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Danger::Plugin
Instance Method Details
#added_files ⇒ FileList
Paths for files that were added during the diff
17 18 19 |
# File 'lib/danger/danger_core/plugins/dangerfile_git_plugin.rb', line 17 def added_files Danger::FileList.new(@git.diff.select { |diff| diff.type == "new" }.map(&:path)) end |
#commits ⇒ Git::Log
The log of commits inside the diff
65 66 67 |
# File 'lib/danger/danger_core/plugins/dangerfile_git_plugin.rb', line 65 def commits @git.log.to_a end |
#deleted_files ⇒ FileList
Paths for files that were removed during the diff
25 26 27 |
# File 'lib/danger/danger_core/plugins/dangerfile_git_plugin.rb', line 25 def deleted_files Danger::FileList.new(@git.diff.select { |diff| diff.type == "deleted" }.map(&:path)) end |
#deletions ⇒ Object
The overall lines of code removed in the diff
49 50 51 |
# File 'lib/danger/danger_core/plugins/dangerfile_git_plugin.rb', line 49 def deletions @git.diff.deletions end |
#insertions ⇒ Object
The overall lines of code added in the diff
57 58 59 |
# File 'lib/danger/danger_core/plugins/dangerfile_git_plugin.rb', line 57 def insertions @git.diff.insertions end |
#lines_of_code ⇒ Object
The overall lines of code added/removed in the diff
41 42 43 |
# File 'lib/danger/danger_core/plugins/dangerfile_git_plugin.rb', line 41 def lines_of_code @git.diff.lines end |