danger 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d74236f8bd9ddb9051beca311ddb9f291dccfd8b
|
4
|
+
data.tar.gz: 1165b856f1f001e97b853e57bb72ba9456d22dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef9cd9ba1e8703321b2cad8750c904047b9aae5fbf5aadd2f25a23da14e73ed1a1a778a277cc653c7fdba6f0280d06d0858b02f0cf4252b09bddb85c971de07a
|
7
|
+
data.tar.gz: 9558fcf118e4a16e7bf81baa81c10fc131eb8c0a37e125b8a1e515e4c1b47ab8adb17b0065a82812322421e672ebf2ade86c93c376c5b2eb456522e6419d8fc3
|
@@ -75,6 +75,14 @@ module Danger
|
|
75
75
|
Danger::FileList.new(@git.diff.select { |diff| diff.type == "modified" }.map(&:path))
|
76
76
|
end
|
77
77
|
|
78
|
+
# @!group Git Metadata
|
79
|
+
# List of renamed files
|
80
|
+
# @return [Array<Hash>] with keys `:before` and `:after`
|
81
|
+
#
|
82
|
+
def renamed_files
|
83
|
+
@git.renamed_files
|
84
|
+
end
|
85
|
+
|
78
86
|
# @!group Git Metadata
|
79
87
|
# The overall lines of code added/removed in the diff
|
80
88
|
# @return [Fixnum]
|
@@ -19,6 +19,32 @@ module Danger
|
|
19
19
|
self.log = repo.log.between(from, to)
|
20
20
|
end
|
21
21
|
|
22
|
+
def renamed_files
|
23
|
+
# Get raw diff with --find-renames --diff-filter
|
24
|
+
# We need to pass --find-renames cause
|
25
|
+
# older versions of git don't use this flag as default
|
26
|
+
diff = exec(
|
27
|
+
"diff #{self.diff.from} #{self.diff.to} --find-renames --diff-filter=R"
|
28
|
+
).lines.map { |line| line.tr("\n", "") }
|
29
|
+
|
30
|
+
before_name_regexp = /^rename from (.*)$/
|
31
|
+
after_name_regexp = /^rename to (.*)$/
|
32
|
+
|
33
|
+
# Extract old and new paths via regexp
|
34
|
+
diff.each_with_index.map do |line, index|
|
35
|
+
before_match = line.match(before_name_regexp)
|
36
|
+
next unless before_match
|
37
|
+
|
38
|
+
after_match = diff.fetch(index + 1, "").match(after_name_regexp)
|
39
|
+
next unless after_match
|
40
|
+
|
41
|
+
{
|
42
|
+
before: before_match.captures.first,
|
43
|
+
after: after_match.captures.first
|
44
|
+
}
|
45
|
+
end.compact
|
46
|
+
end
|
47
|
+
|
22
48
|
def exec(string)
|
23
49
|
require "open3"
|
24
50
|
Dir.chdir(self.folder || ".") do
|
data/lib/danger/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-05-
|
12
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|