manifestly 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: deda3def4c079172f3a9624e4260041ccfb50aac
4
- data.tar.gz: d4c6cd3a73b49786cf9ad17e19e017066a06694f
3
+ metadata.gz: 5212dd786d672305c24be61c80fb009fbe8b7df7
4
+ data.tar.gz: 84a9bb906f84f1515315882dd0fb724e0ffca9d6
5
5
  SHA512:
6
- metadata.gz: d0a633778244bee96e752223997e1c7c442b56c648c96338b41e37b028ce32324ba4e3b46c03122ad7f883c33629babd4fb39858cf68f75bcba39659c238ca17
7
- data.tar.gz: afa6c48d8106b7c10adf5fbfe74f9060a8949278b315480727b34e643938f0fa92ada066590b13576f18235b78a2bfa05f4b64ec05a15e97b0182b642ab6c09d
6
+ metadata.gz: 3514fe055e56a77eda132eb920f48aea77005207361bd37cbc597f240d863955f1742c50636d4c2eb5222dbd63fc05becd001bd6df3645d6473949fbd903473d
7
+ data.tar.gz: bf09837f88ae51e321a21244e4a355225d0ce6cfe57a9eb62757b71058171ec0c29e6a7612548e6b5ad2abf5352388e45b74c368985c78b804641144f860aabd
@@ -5,11 +5,24 @@ module Manifestly
5
5
  def initialize(file_diff_string)
6
6
  @lines = file_diff_string.split("\n")
7
7
 
8
- @from_name = filename(true)
9
- @to_name = filename(false)
8
+ if content_lines.empty?
9
+ # if there are no content lines the format of the diff is a little different
10
+ names = @lines[0].split(' b/')
11
+ @from_name = names[0][2..-1] # strip "a/" off
12
+ @to_name = names[1]
10
13
 
11
- @from_content = content_lines.grep(/^[\- ]/).collect{|l| l[1..-1]}.join("\n")
12
- @to_content = content_lines.grep(/^[\+ ]/).collect{|l| l[1..-1]}.join("\n")
14
+ if file_diff_string.match(/deleted file mode/)
15
+ @to_name = nil
16
+ elsif file_diff_string.match(/new file mode/)
17
+ @from_name = nil
18
+ end
19
+ else
20
+ @from_name = filename(true)
21
+ @to_name = filename(false)
22
+
23
+ @from_content = content_lines.grep(/^[\- ]/).collect{|l| l[1..-1]}.join("\n")
24
+ @to_content = content_lines.grep(/^[\+ ]/).collect{|l| l[1..-1]}.join("\n")
25
+ end
13
26
  end
14
27
 
15
28
  attr_reader :from_name, :to_name, :from_content, :to_content
@@ -27,9 +40,10 @@ module Manifestly
27
40
  return @content_lines if @content_lines
28
41
 
29
42
  at_at_line_index = @lines.find_index{|ll| ll[0..2] == "@@ "}
30
- @content_lines = @lines[at_at_line_index+1..-1]
43
+ @content_lines = at_at_line_index.nil? ?
44
+ [] :
45
+ @lines[at_at_line_index+1..-1]
31
46
  end
32
-
33
47
  end
34
48
 
35
49
  def initialize(diff_string)
@@ -40,8 +54,8 @@ module Manifestly
40
54
 
41
55
  attr_reader :files
42
56
 
43
- def has_surviving_file?(filename)
44
- files.any?{|file| file.to_name == filename}
57
+ def has_file?(filename)
58
+ files.any?{|file| file.to_name == filename || file.from_name == filename}
45
59
  end
46
60
 
47
61
  def num_files
@@ -101,7 +101,7 @@ module Manifestly
101
101
  commits = git.log
102
102
  commits = commits.select do |commit|
103
103
  diff = Diff.new(commit.diff_parent.to_s)
104
- diff.has_surviving_file?(file)
104
+ diff.has_file?(file)
105
105
  end
106
106
  end
107
107
 
@@ -1,3 +1,3 @@
1
1
  module Manifestly
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manifestly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor