dockerfilemerge 0.4.3 → 0.4.4

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
  SHA1:
3
- metadata.gz: f5f8d388e325262e4165c49616c127b0ec5057f7
4
- data.tar.gz: 68ac5a4aa44bc0c78a431dbfdf6f19876fb63da8
3
+ metadata.gz: addff649510fd6d00e9a4d4a0bf0b349d332cc01
4
+ data.tar.gz: 5e6cd57b8d85ea072fae24f3f7dd6feb1b8dd9be
5
5
  SHA512:
6
- metadata.gz: f87b4e7cfc0f87413d0e57fe22e39156a7c0be812c61c97944725ea0d4c471ad35589e0981535ecd5ff134ae58dd1a4c5c8e9ddbbfe359079acc75b82a0a432f
7
- data.tar.gz: e61c3a757af33991ec977e144f116f9859ee54734edba0ae4919eca9201004e6f12c04082dcb528947305de8424ca6fd4ed2b2018f2139a79e7fd4426e0a1211
6
+ metadata.gz: cb4e1a26b19207a7329d77c5e2c8f3ae6b1f58c7d65a4b3a9204aaba42b7357c18ce6feed37cd73c310087c3bce2395b1fbcb602d396bbd3a9599417fca1d4c9
7
+ data.tar.gz: e078b0c7b60737f2e5e6dccfdd78200cbcccb235e568f2d6ccd219aec068c4028b73faa3e095d9ae31b172ff8589dd864b7abcc61b6c870cffe9a6d19d57c733
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -12,7 +12,7 @@ class DockerfileMerge
12
12
  def initialize(raw_s)
13
13
 
14
14
  s, type = RXFHelper.read(raw_s)
15
-
15
+
16
16
  patterns = [
17
17
  [:root, /FROM\s+(?<from>.*)/, :from],
18
18
  [:root, /INCLUDE\s*(?<path>.*)?/, :include],
@@ -25,6 +25,13 @@ class DockerfileMerge
25
25
 
26
26
  s.sub!(/\A# Dockermergefile/,'# Dockerfile')
27
27
  a = LineParser.new(patterns, ignore_blank_lines: false).parse s
28
+ maintainer = a.grep /MAINTAINER/
29
+
30
+ if maintainer.empty? then
31
+
32
+ from = a.assoc :include
33
+ a.insert(a.index(from) + 1, [:maintainer, {},['MAINTAINER unknown']])
34
+ end
28
35
 
29
36
  lines = []
30
37
 
@@ -33,19 +40,18 @@ class DockerfileMerge
33
40
  lines << '# source: ' + raw_s
34
41
  end
35
42
 
36
-
37
43
  a.each do |label, h, r, c| # h=hash, r=remaining, c=children
38
44
 
39
45
  line = r.first
40
46
 
41
47
  case label
42
48
  when :from
43
-
49
+
44
50
  lines << line
45
51
  lines << '' if r.length > 1
46
52
 
47
53
  when :comment
48
-
54
+
49
55
  lines << line
50
56
  lines << '' if r.length > 1
51
57
 
@@ -58,10 +64,27 @@ class DockerfileMerge
58
64
  when :maintainer
59
65
 
60
66
  maintainers = lines.grep(/MAINTAINER/)
61
- i = lines.index maintainers.shift
62
- lines[i] = line
67
+
68
+ if maintainers.length > 0 then
69
+
70
+ while maintainers.length > 1 do
71
+ i = lines.rindex maintainers.pop
72
+ lines.delete_at i
73
+ maintainers = lines.grep(/MAINTAINER/)
74
+ end
75
+
76
+ i = lines.index maintainers[0]
77
+
78
+ lines[i] = line unless line[/MAINTAINER unknown/]
79
+ elsif maintainers.empty?
80
+
81
+ from = lines.grep /^ *FROM\b/
82
+ i = lines.index from[0]
83
+ lines.insert(i+1, line) unless line[/MAINTAINER unknown/]
84
+
85
+ end
63
86
 
64
- maintainers.each {|x| lines.delete x}
87
+
65
88
 
66
89
  when :run
67
90
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerfilemerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  WHpJ21HYl4KWG8TISerrdwpQAZ5dhV2Yy/4q0MWSnDcMRSYdRAixOcdYW+U+R8cz
32
32
  pf2JrQZNdYZXIg==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-08-03 00:00:00.000000000 Z
34
+ date: 2015-08-04 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: lineparser
metadata.gz.sig CHANGED
Binary file