git_diff_parser 3.0.0 → 3.1.0
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 +4 -4
- data/changelog.md +8 -0
- data/lib/git_diff_parser/patch.rb +23 -0
- data/lib/git_diff_parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4af9131c4db9ebdd3a1cbaa4fdf26878478084b
|
4
|
+
data.tar.gz: a40e0b9f059e20ae87c56c2a05906e999722ec66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95e802b34f9db8b38fe2b37172e11955fa294a03ea69057f61b6d319f9ac1666822275e518f1f7114e8f16e72a3a56798fa26c025feb2fe6e7691b9408a44543
|
7
|
+
data.tar.gz: 51a24c8dd8fe91779d84ca7298155a3114416fc5a844c5cc7bf4c88e59454facc10e7708e9307fe9331700ed712da71820736238e1dbd50b8250f4563dce9339
|
data/changelog.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
<a name="3.1.0"></a>
|
2
|
+
# [3.1.0](https://github.com/packsaddle/ruby-git_diff_parser/compare/v3.0.0...v3.1.0) (2017-07-05)
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* **patch:** Added Patch#removed_lines method ([9acc263](https://github.com/packsaddle/ruby-git_diff_parser/commit/9acc263))
|
7
|
+
|
8
|
+
|
1
9
|
<a name="3.0.0"></a>
|
2
10
|
# [3.0.0](https://github.com/packsaddle/ruby-git_diff_parser/compare/v2.3.0...v3.0.0) (2017-06-22)
|
3
11
|
|
@@ -3,6 +3,7 @@ module GitDiffParser
|
|
3
3
|
class Patch
|
4
4
|
RANGE_INFORMATION_LINE = /^@@ .+\+(?<line_number>\d+),/
|
5
5
|
MODIFIED_LINE = /^\+(?!\+|\+)/
|
6
|
+
REMOVED_LINE = /^[-]/
|
6
7
|
NOT_REMOVED_LINE = /^[^-]/
|
7
8
|
|
8
9
|
attr_accessor :file, :body, :secure_hash
|
@@ -76,6 +77,28 @@ module GitDiffParser
|
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
80
|
+
# @return [Array<Line>] removed lines
|
81
|
+
def removed_lines
|
82
|
+
line_number = 0
|
83
|
+
|
84
|
+
lines.each_with_index.inject([]) do |lines, (content, patch_position)|
|
85
|
+
case content
|
86
|
+
when RANGE_INFORMATION_LINE
|
87
|
+
line_number = Regexp.last_match[:line_number].to_i
|
88
|
+
when REMOVED_LINE
|
89
|
+
line = Line.new(
|
90
|
+
content: content,
|
91
|
+
number: line_number,
|
92
|
+
patch_position: patch_position
|
93
|
+
)
|
94
|
+
lines << line
|
95
|
+
line_number += 1
|
96
|
+
end
|
97
|
+
|
98
|
+
lines
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
79
102
|
# @return [Array<Integer>] changed line numbers
|
80
103
|
def changed_line_numbers
|
81
104
|
changed_lines.map(&:number)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_diff_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|