git_diff 0.4.2 → 0.4.3

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
  SHA256:
3
- metadata.gz: ca650390bcd8c35eb34899b6210864326ed34470f4e532c5e2dffffc51155c4b
4
- data.tar.gz: 2a2ff0c950222e444cccd990dacba5e032993d6ae66f9fb5df604fcdbcd64b9d
3
+ metadata.gz: 52a2071ba28b2a0703fabec01c2c4f50c3eae657255a096b5603fcc7cffa8381
4
+ data.tar.gz: c888271d5001095ab3dcae18cf209bc03eb0251d57e2d528deb9873cc3a66d02
5
5
  SHA512:
6
- metadata.gz: d083304b87f4288f733ba28c9a294784d2a4797ab6f046b3b5260ab4c0031797badb16e00c205ca53d86836f47c62c46300cb217514bd39450a20d9aa71ab5e5
7
- data.tar.gz: 85ee7dbc373a614f74ddad8ab776e761dc6d1b329c26e10fba5d426dece21dc9262f68f30821d431d53dcb4e2698ce1979f63aa5a00c9935bf527c9015ac71cb
6
+ metadata.gz: a145f66c6c8345883093adef62a6bdbde48d5475ee41923bd523f5f7d8f471cc3c8637a89eb4b2003749488c32f2dfffc0a4d78f9f395e259770386fd6f00739
7
+ data.tar.gz: 323ad1908b9f757c36185ec943e31f1620185d0b0b8052d5e8cf6680dd4ac8dc9e4204f88d6f32615458c0282154d250909f10b83988933c7c34f5eca1c7590c
@@ -0,0 +1,46 @@
1
+ AllCops:
2
+ Include:
3
+ - "**/*.rb"
4
+ - "*.gemspec"
5
+ - "Gemfile"
6
+ - "Rakefile"
7
+ TargetRubyVersion: 2.5
8
+
9
+ Lint/AssignmentInCondition:
10
+ Enabled: false
11
+
12
+ Metrics/AbcSize:
13
+ Enabled: false
14
+
15
+ Metrics/ClassLength:
16
+ Enabled: false
17
+
18
+ Metrics/CyclomaticComplexity:
19
+ Enabled: false
20
+
21
+ Metrics/LineLength:
22
+ Max: 120
23
+
24
+ Metrics/MethodLength:
25
+ Enabled: false
26
+
27
+ Metrics/PerceivedComplexity:
28
+ Enabled: false
29
+
30
+ Style/ClassAndModuleChildren:
31
+ Enabled: false
32
+
33
+ Style/Documentation:
34
+ Enabled: false
35
+
36
+ Style/GuardClause:
37
+ MinBodyLength: 60
38
+
39
+ Style/StringLiterals:
40
+ EnforcedStyle: double_quotes
41
+
42
+
43
+
44
+
45
+
46
+
@@ -1,5 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.9
4
- - 2.3.6
5
- - 2.4.2
3
+ - 2.3.8
4
+ - 2.4.6
5
+ - 2.5.5
6
+ - 2.6.3
7
+ before_install:
8
+ - gem update --system
9
+ - gem install bundler
10
+ script:
11
+ - bundle exec rake
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in git_diff.gemspec
4
6
  gemspec
data/Rakefile CHANGED
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rake/testtask"
5
+ require "rubocop/rake_task"
3
6
 
4
7
  Rake::TestTask.new do |t|
5
8
  t.libs << "lib"
@@ -7,4 +10,6 @@ Rake::TestTask.new do |t|
7
10
  t.pattern = "test/**/*_test.rb"
8
11
  end
9
12
 
10
- task :default => :test
13
+ RuboCop::RakeTask.new
14
+
15
+ task default: %i[rubocop test]
@@ -1,22 +1,23 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'git_diff/version'
5
+ require "git_diff/version"
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.name = "git_diff"
8
9
  spec.version = GitDiff::VERSION
9
10
  spec.authors = ["Andrew Olson"]
10
11
  spec.email = ["anolson@gmail.com"]
11
- spec.summary = %q{A Ruby library for parsing git diffs.}
12
+ spec.summary = "A Ruby library for parsing git diffs."
12
13
  spec.license = "MIT"
13
14
 
14
- spec.files = `git ls-files`.split($/)
15
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.files = `git ls-files`.split($RS)
16
16
  spec.test_files = spec.files.grep(%r{^(test)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_development_dependency "bundler", "~> 1.3"
20
- spec.add_development_dependency "rake"
19
+ spec.add_development_dependency "bundler", "~> 2.0"
21
20
  spec.add_development_dependency "minitest"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rubocop", "~> 0.74.0"
22
23
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "forwardable"
2
4
 
3
5
  require "git_diff/stats_collector"
@@ -20,4 +22,4 @@ module GitDiff
20
22
  parser.parse
21
23
  parser.diff
22
24
  end
23
- end
25
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class Diff
3
5
  attr_reader :files
@@ -1,18 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class File
3
-
4
5
  attr_reader :a_path, :a_blob, :b_path, :b_blob, :b_mode, :hunks, :binary
5
6
 
6
7
  def self.from_string(string)
7
- if path_info = /^diff --git(?: a\/(\S+))?(?: b\/(\S+))?/.match(string)
8
+ if path_info = %r{^diff --git(?: a/(\S+))?(?: b/(\S+))?}.match(string)
8
9
  File.new(
9
- a_path: path_info.captures[0] || '/dev/null',
10
- b_path: path_info.captures[1] || '/dev/null'
10
+ a_path: path_info.captures[0] || "/dev/null",
11
+ b_path: path_info.captures[1] || "/dev/null"
11
12
  )
12
13
  end
13
14
  end
14
15
 
15
- def initialize(a_path: '/dev/null', b_path: '/dev/null')
16
+ def initialize(a_path: "/dev/null", b_path: "/dev/null")
16
17
  @hunks = []
17
18
  @a_path = a_path
18
19
  @b_path = b_path
@@ -21,7 +22,7 @@ module GitDiff
21
22
  def <<(string)
22
23
  return if extract_diff_meta_data(string)
23
24
 
24
- if(range_info = RangeInfo.from_string(string))
25
+ if (range_info = RangeInfo.from_string(string))
25
26
  add_hunk Hunk.new(range_info)
26
27
  else
27
28
  append_to_current_hunk string
@@ -51,38 +52,37 @@ module GitDiff
51
52
  end
52
53
 
53
54
  def extract_diff_meta_data(string)
54
- case
55
- when a_path_info = /^[-]{3} \/dev\/null(.*)$/.match(string)
55
+ if a_path_info = %r{^[-]{3} /dev/null(.*)$}.match(string)
56
56
  @a_path = "/dev/null"
57
- when a_path_info = /^[-]{3} a\/(.*)$/.match(string)
57
+ elsif a_path_info = %r{^[-]{3} "?a/(.*)$}.match(string)
58
58
  @a_path = a_path_info[1]
59
- when b_path_info = /^[+]{3} \/dev\/null(.*)$/.match(string)
59
+ elsif b_path_info = %r{^[+]{3} /dev/null(.*)$}.match(string)
60
60
  @b_path = "/dev/null"
61
- when b_path_info = /^[+]{3} b\/(.*)$/.match(string)
61
+ elsif b_path_info = %r{^[+]{3} "?b/(.*)$}.match(string)
62
62
  @b_path = b_path_info[1]
63
- when blob_info = /^index ([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+) ?(.+)?$/.match(string)
63
+ elsif blob_info = /^index ([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+) ?(.+)?$/.match(string)
64
64
  @a_blob, @b_blob, @b_mode = *blob_info.captures
65
- when /^new file mode [0-9]{6}$/.match(string)
65
+ elsif /^new file mode [0-9]{6}$/.match(string)
66
66
  @a_path = "/dev/null"
67
- when /^deleted file mode [0-9]{6}$/.match(string)
67
+ elsif /^deleted file mode [0-9]{6}$/.match(string)
68
68
  @b_path = "/dev/null"
69
- when mode_info = /^(old|new) mode ([0-9]{6})$/.match(string)
69
+ elsif mode_info = /^(old|new) mode ([0-9]{6})$/.match(string)
70
70
  if mode_info.captures[0] == "old"
71
71
  @a_mode = mode_info.captures[1]
72
72
  else
73
73
  @b_mode = mode_info.captures[1]
74
74
  end
75
- when copy_rename_info = /^(copy|rename) (from|to) (.*)$/.match(string)
75
+ elsif copy_rename_info = /^(copy|rename) (from|to) (.*)$/.match(string)
76
76
  if copy_rename_info.captures[1] == "from"
77
77
  @a_path = copy_rename_info.captures[2]
78
78
  else
79
79
  @b_path = copy_rename_info.captures[2]
80
80
  end
81
- when binary_info = /^Binary files (?:\/dev\/null|a\/(.*)) and (?:\/dev\/null|b\/(.*)) differ$/.match(string)
81
+ elsif binary_info = %r{^Binary files (?:/dev/null|"?a/(.*)) and (?:/dev/null|"?b/(.*)) differ$}.match(string)
82
82
  @binary = true
83
83
  @a_path ||= binary_info[1] || "/dev/null"
84
84
  @b_path ||= binary_info[2] || "/dev/null"
85
- when /^similarity/.match(string)
85
+ elsif /^similarity/.match(string)
86
86
  # trash
87
87
  true
88
88
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "forwardable"
2
4
 
3
5
  module GitDiff
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "git_diff/line/context"
2
4
  require "git_diff/line/addition"
3
5
  require "git_diff/line/deletion"
@@ -19,4 +21,4 @@ module GitDiff
19
21
  end
20
22
  extend ClassMethods
21
23
  end
22
- end
24
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  module Line
3
5
  class Addition < Context
@@ -10,4 +12,4 @@ module GitDiff
10
12
  end
11
13
  end
12
14
  end
13
- end
15
+ end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  module Line
3
5
  class Context
4
6
  attr_reader :content, :line_number
5
7
 
6
- def initialize(content, line_number=nil)
8
+ def initialize(content, line_number = nil)
7
9
  @content = content
8
10
  @line_number = line_number
9
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  module Line
3
5
  class Deletion < Context
@@ -10,4 +12,4 @@ module GitDiff
10
12
  end
11
13
  end
12
14
  end
13
- end
15
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class LineNumber
3
5
  attr_reader :left, :right
@@ -39,4 +41,4 @@ module GitDiff
39
41
  [left, right]
40
42
  end
41
43
  end
42
- end
44
+ end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class LineNumberCalculation
3
-
4
5
  attr_reader :current
5
6
 
6
7
  def initialize(line_number)
@@ -19,4 +20,4 @@ module GitDiff
19
20
  end
20
21
  end
21
22
  end
22
- end
23
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class LineNumberRange
3
5
  attr_reader :start, :number_of_lines
@@ -15,4 +17,4 @@ module GitDiff
15
17
  "#{type}#{start},#{number_of_lines}"
16
18
  end
17
19
  end
18
- end
20
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class Parser
3
5
  attr_reader :string, :diff
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class RangeInfo
3
5
  attr_reader :original_range, :new_range, :header
4
6
 
5
7
  module ClassMethods
6
8
  def from_string(string)
7
- if(range_data = extract_hunk_range_data(string))
9
+ if (range_data = extract_hunk_range_data(string))
8
10
  new(*range_data.captures)
9
11
  end
10
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class Stats
3
5
  attr_reader :number_of_additions, :number_of_lines, :number_of_deletions
@@ -15,4 +17,4 @@ module GitDiff
15
17
  end
16
18
  end
17
19
  end
18
- end
20
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  class StatsCalculator
3
5
  attr_reader :collector
@@ -28,4 +30,4 @@ module GitDiff
28
30
  Array(collector.collect)
29
31
  end
30
32
  end
31
- end
33
+ end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "git_diff/stats_collector/hunk"
2
- require "git_diff/stats_collector/rollup"
4
+ require "git_diff/stats_collector/rollup"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  module StatsCollector
3
5
  class Hunk
@@ -33,9 +35,5 @@ module GitDiff
33
35
  hunk.lines
34
36
  end
35
37
  end
36
-
37
38
  end
38
39
  end
39
-
40
-
41
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
4
  module StatsCollector
3
5
  class StatsCollector::Rollup
@@ -8,7 +10,7 @@ module GitDiff
8
10
  end
9
11
 
10
12
  def collect
11
- collection.map { |item| item.stats }
13
+ collection.map(&:stats)
12
14
  end
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GitDiff
2
- VERSION = "0.4.2"
4
+ VERSION = "0.4.3"
3
5
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class DiffFileTest < Minitest::Test
4
-
5
6
  def setup
6
7
  @file = GitDiff::File.new
7
8
  end
@@ -45,8 +46,8 @@ class DiffFileTest < Minitest::Test
45
46
  @file << " io = StringIO.new(text)"
46
47
  @file << " objects = []"
47
48
  @file << " while line = io.gets"
48
- @file << "- sha, type, size = line.split(" ", 3)"
49
- @file << "+ sha, type, size = line.split(" ", 3) #wut"
49
+ @file << "- sha, type, size = line.split(' ', 3)"
50
+ @file << "+ sha, type, size = line.split(' ', 3) #wut"
50
51
  @file << " parser = BATCH_PARSERS[type]"
51
52
  @file << " if type == 'missing' || !parser"
52
53
  @file << " io.seek(size.to_i + 1, IO::SEEK_CUR)"
@@ -56,5 +57,4 @@ class DiffFileTest < Minitest::Test
56
57
  assert_equal 1, @file.stats.number_of_additions
57
58
  assert_equal 1, @file.stats.number_of_deletions
58
59
  end
59
-
60
60
  end
@@ -1,51 +1,52 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class GitDiffTest < Minitest::Test
4
-
5
6
  def setup
6
- string = <<-'DIFF'
7
- diff --git a/lib/grit/commit.rb b/lib/grit/commit.rb
8
- index 403ea33..dd4b590 100644
9
- --- a/lib/grit/commit.rb
10
- +++ b/lib/grit/commit.rb
11
- @@ -27,6 +27,7 @@
12
-
13
- lines = info.split("\n")
14
- tree = lines.shift.split(' ', 2).last
15
- +
16
- parents = []
17
- parents << lines.shift[7..-1] while lines.first[0, 6] == 'parent'
18
- author, authored_date = Grit::Commit.actor(lines.shift)
19
- diff --git a/lib/grit/new_file.rb b/lib/grit/new_file.rb
20
- new file mode 100644
21
- index 0000000..24f83d1
22
- --- /dev/null
23
- +++ b/lib/grit/new_file.rb
24
- @@ -0,0 +1 @@
25
- +#
26
- diff --git a/grit/old_file.rb b/grit/old_file.rb
27
- deleted file mode 100644
28
- index ba6b733..0000000
29
- --- a/lib/grit/old_file.rb
30
- +++ /dev/null
31
- @@ -1 +0,0 @@
32
- -#
33
- diff --git a/lib/grit/repo.rb b/lib/grit/repo.rb
34
- index 033b446..0e2d140 100644
35
- --- a/lib/grit/repo.rb
36
- +++ b/lib/grit/repo.rb
37
- @@ -180,7 +180,7 @@ module Grit
38
- io = StringIO.new(text)
39
- objects = []
40
- while line = io.gets
41
- - sha, type, size = line.split(" ", 3)
42
- + sha, type, size = line.split(" ", 3) #wut
43
- parser = BATCH_PARSERS[type]
44
- if type == 'missing' || !parser
45
- io.seek(size.to_i + 1, IO::SEEK_CUR)
7
+ string = <<~'DIFF'
8
+ diff --git a/lib/grit/commit.rb b/lib/grit/commit.rb
9
+ index 403ea33..dd4b590 100644
10
+ --- a/lib/grit/commit.rb
11
+ +++ b/lib/grit/commit.rb
12
+ @@ -27,6 +27,7 @@
13
+
14
+ lines = info.split("\n")
15
+ tree = lines.shift.split(' ', 2).last
16
+ +
17
+ parents = []
18
+ parents << lines.shift[7..-1] while lines.first[0, 6] == 'parent'
19
+ author, authored_date = Grit::Commit.actor(lines.shift)
20
+ diff --git a/lib/grit/new_file.rb b/lib/grit/new_file.rb
21
+ new file mode 100644
22
+ index 0000000..24f83d1
23
+ --- /dev/null
24
+ +++ b/lib/grit/new_file.rb
25
+ @@ -0,0 +1 @@
26
+ +#
27
+ diff --git a/grit/old_file.rb b/grit/old_file.rb
28
+ deleted file mode 100644
29
+ index ba6b733..0000000
30
+ --- a/lib/grit/old_file.rb
31
+ +++ /dev/null
32
+ @@ -1 +0,0 @@
33
+ -#
34
+ diff --git a/lib/grit/repo.rb b/lib/grit/repo.rb
35
+ index 033b446..0e2d140 100644
36
+ --- a/lib/grit/repo.rb
37
+ +++ b/lib/grit/repo.rb
38
+ @@ -180,7 +180,7 @@ module Grit
39
+ io = StringIO.new(text)
40
+ objects = []
41
+ while line = io.gets
42
+ - sha, type, size = line.split(" ", 3)
43
+ + sha, type, size = line.split(" ", 3) #wut
44
+ parser = BATCH_PARSERS[type]
45
+ if type == 'missing' || !parser
46
+ io.seek(size.to_i + 1, IO::SEEK_CUR)
46
47
  DIFF
47
48
 
48
- @diff = GitDiff::from_string(string)
49
+ @diff = GitDiff.from_string(string)
49
50
  end
50
51
 
51
52
  def first_diff_file
@@ -108,25 +109,25 @@ index 033b446..0e2d140 100644
108
109
  second_hunk = last_diff_file.hunks.first
109
110
 
110
111
  assert_equal [
111
- [27,27],
112
- [28,28],
113
- [29,29],
114
- [nil,30],
115
- [30,31],
116
- [31,32],
117
- [32,33]
118
- ], first_hunk.lines.map { |line| line.line_number.pair }
112
+ [27, 27],
113
+ [28, 28],
114
+ [29, 29],
115
+ [nil, 30],
116
+ [30, 31],
117
+ [31, 32],
118
+ [32, 33]
119
+ ], (first_hunk.lines.map { |line| line.line_number.pair })
119
120
 
120
121
  assert_equal [
121
- [180,180],
122
- [181,181],
123
- [182,182],
124
- [183,nil],
125
- [nil,183],
126
- [184,184],
127
- [185,185],
128
- [186,186]
129
- ], second_hunk.lines.map { |line| line.line_number.pair }
122
+ [180, 180],
123
+ [181, 181],
124
+ [182, 182],
125
+ [183, nil],
126
+ [nil, 183],
127
+ [184, 184],
128
+ [185, 185],
129
+ [186, 186]
130
+ ], (second_hunk.lines.map { |line| line.line_number.pair })
130
131
  end
131
132
 
132
133
  def test_binary_file_diff
@@ -142,7 +143,7 @@ Binary files /dev/null and b/app/assets/bin.eot differ'
142
143
  file = diff.files[0]
143
144
 
144
145
  assert file.binary
145
- assert_equal '/dev/null', file.a_path
146
+ assert_equal "/dev/null", file.a_path
146
147
  assert_equal "app/assets/bin.eot", file.b_path
147
148
  end
148
149
 
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class HunkTest < Minitest::Test
4
-
5
6
  def setup
6
7
  @range_info = GitDiff::RangeInfo.new("180,7", "180,7", "module Grit")
7
8
  @hunk = GitDiff::Hunk.new(@range_info)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class AdditionTest < Minitest::Test
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class ContextTest < Minitest::Test
4
6
  def setup
5
- @line_number = GitDiff::LineNumber.new(0,0)
7
+ @line_number = GitDiff::LineNumber.new(0, 0)
6
8
  @content = "some content"
7
9
  @context = GitDiff::Line::Context.new(@content, @line_number)
8
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class DeletionTest < Minitest::Test
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class LineNumberCalculationTest < Minitest::Test
4
-
5
6
  def setup
6
7
  @line_number = GitDiff::LineNumber.new(0, 0)
7
8
  @line_number_calculation = GitDiff::LineNumberCalculation.new(@line_number)
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class LineNumberRangeTest < Minitest::Test
4
-
5
6
  def test_from_string_with_empty_string
6
7
  range = GitDiff::LineNumberRange.from_string("")
7
8
 
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class LineNumberTest < Minitest::Test
4
-
5
6
  def setup
6
- @line_number = GitDiff::LineNumber.new(0,0)
7
+ @line_number = GitDiff::LineNumber.new(0, 0)
7
8
  end
8
9
 
9
10
  def test_increment_left
@@ -25,6 +26,6 @@ class LineNumberTest < Minitest::Test
25
26
  end
26
27
 
27
28
  def test_pair
28
- assert_equal [0,0], @line_number.pair
29
+ assert_equal [0, 0], @line_number.pair
29
30
  end
30
31
  end
@@ -1,12 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class LineTest < Minitest::Test
4
-
5
6
  def setup
6
7
  @line_number = GitDiff::LineNumber.new(0, 0)
7
8
  end
8
9
 
9
-
10
10
  def test_from_string_with_addition
11
11
  addition = GitDiff::Line.from_string("+ addition")
12
12
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class RangeInfoTest < Minitest::Test
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class Collector
4
-
5
6
  def collect
6
7
  GitDiff::Stats.new(
7
8
  number_of_lines: number_of_lines,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "minitest/autorun"
2
4
  require "minitest/pride"
3
- require "git_diff"
5
+ require "git_diff"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Olson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-16 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,16 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.74.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.74.0
55
69
  description:
56
70
  email:
57
71
  - anolson@gmail.com
@@ -60,6 +74,7 @@ extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
76
  - ".gitignore"
77
+ - ".rubocop.yml"
63
78
  - ".travis.yml"
64
79
  - Gemfile
65
80
  - LICENSE.txt
@@ -118,8 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
133
  - !ruby/object:Gem::Version
119
134
  version: '0'
120
135
  requirements: []
121
- rubyforge_project:
122
- rubygems_version: 2.7.6.2
136
+ rubygems_version: 3.0.3
123
137
  signing_key:
124
138
  specification_version: 4
125
139
  summary: A Ruby library for parsing git diffs.