git-delta 0.2.0 → 0.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.
@@ -43,7 +43,7 @@ module Git
43
43
  end
44
44
 
45
45
  def data
46
- @data ||= parse_log(git_log)
46
+ @data ||= self.class.parse_log(git_log).reverse
47
47
  end
48
48
 
49
49
  private
@@ -64,11 +64,11 @@ module Git
64
64
  end.join(' ')
65
65
  end
66
66
 
67
- def parse_log(log)
67
+ def self.parse_log(log)
68
68
  log.lines.each_slice(2).map do |commit, changes|
69
- _, plus, minus = *changes.match(/.*changed, (\d+) insertions.* (\d+) deletions/)
70
- [commit, plus.to_i, -minus.to_i]
71
- end.reverse
69
+ _, plus, minus = *changes.match(/.*changed,\s*(\d+ insertions\(\+\),?\s*)?(\d+ deletions\(\-\))?/)
70
+ [commit.chomp, plus.to_i, -minus.to_i]
71
+ end
72
72
  end
73
73
  end
74
74
  end
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Delta
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -0,0 +1,22 @@
1
+ require 'minitest/autorun'
2
+ require_relative '../lib/git-delta/reporter'
3
+
4
+ describe Git::Delta::Reporter do
5
+ describe "parse_log" do
6
+ it "works for Git version 1.8+" do
7
+ log = <<EOL
8
+ b1982c2 - method_for_image
9
+ 1 file changed, 13 deletions(-)
10
+ da11c13 Refactor imagePicker.js
11
+ 13 files changed, 77 insertions(+), 401 deletions(-)
12
+ bf2311c + Handlebars.find
13
+ 1 file changed, 9 insertions(+)
14
+ EOL
15
+ Git::Delta::Reporter.parse_log(log).must_equal [
16
+ ["b1982c2 - method_for_image", 0, -13],
17
+ ["da11c13 Refactor imagePicker.js", 77, -401],
18
+ ["bf2311c + Handlebars.find", 9, 0],
19
+ ]
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-delta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-28 00:00:00.000000000 Z
12
+ date: 2013-02-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Calculate the number of lines added/subtracted in a git directory
15
15
  email:
@@ -30,6 +30,7 @@ files:
30
30
  - lib/git-delta/reporter.rb
31
31
  - lib/git-delta/run.rb
32
32
  - lib/git-delta/version.rb
33
+ - test/basic_test.rb
33
34
  homepage: http://github.com/marcandre/git-delta
34
35
  licenses: []
35
36
  post_install_message:
@@ -54,5 +55,6 @@ rubygems_version: 1.8.24
54
55
  signing_key:
55
56
  specification_version: 3
56
57
  summary: Calculate the number of lines added/subtracted in a git directory
57
- test_files: []
58
+ test_files:
59
+ - test/basic_test.rb
58
60
  has_rdoc: