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 +4 -4
- data/lib/manifestly/diff.rb +22 -8
- data/lib/manifestly/repository.rb +1 -1
- data/lib/manifestly/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: 5212dd786d672305c24be61c80fb009fbe8b7df7
|
4
|
+
data.tar.gz: 84a9bb906f84f1515315882dd0fb724e0ffca9d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3514fe055e56a77eda132eb920f48aea77005207361bd37cbc597f240d863955f1742c50636d4c2eb5222dbd63fc05becd001bd6df3645d6473949fbd903473d
|
7
|
+
data.tar.gz: bf09837f88ae51e321a21244e4a355225d0ce6cfe57a9eb62757b71058171ec0c29e6a7612548e6b5ad2abf5352388e45b74c368985c78b804641144f860aabd
|
data/lib/manifestly/diff.rb
CHANGED
@@ -5,11 +5,24 @@ module Manifestly
|
|
5
5
|
def initialize(file_diff_string)
|
6
6
|
@lines = file_diff_string.split("\n")
|
7
7
|
|
8
|
-
|
9
|
-
|
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
|
-
|
12
|
-
|
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 =
|
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
|
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
|
data/lib/manifestly/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|