dockerfilemerge 0.4.0 → 0.4.1

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: 5365dc62f83f81f017c85c69e6d8b60f6a97e581
4
- data.tar.gz: 6ea1a86e7ac4934c927554d0f64af48d6ba9a510
3
+ metadata.gz: 8474a3015f025764310d703e159bdcc2d4b7b539
4
+ data.tar.gz: f67fbda4f8f08ccbc19bdacf7e291fd89b134be9
5
5
  SHA512:
6
- metadata.gz: 7601ee6c67d4494c5ed3482b5dc7b0bf2e056c056c1593b49f59777ddb2bb96ee2231bedc7deb4702b14e99449747eca1a128288d97812dc3507b376b424b672
7
- data.tar.gz: f6e5c3c29a625675bbd39204d73a1c658d012ca32fb7e88f7f9607a4aa79d93e725927747a240a25274a8e59356dd9b2488e89e82ec326bc2f8acedce80a946a
6
+ metadata.gz: 091494c67bb938bee16fbcb79200361a05d6613e11b744b91022ee9d9b85c378a4475e3a7d38ef0be84d6f525e19eecc3cc4143fcf9c4da0d6161ea25202608a
7
+ data.tar.gz: 8fd281a8f9165c7b19268a5c0534da0c96dd7c9474ce71be1e077b9b5b5bab921bbe92e06de91e0c50346bb4f76f0ec9bd2d10b94b3a122aec2de1df92290c65
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,4 @@
1
- YM4�P"����qk
2
- '<3T=�I�4�r|�D!<�׉e
3
- /�����d��A6NU���a �����c麽7%@H.⸭B^�m�"���Nt�&E.6k4�)[ǟB������� $czI��?՛6޽�cRӳ����,Wvxv���T�9�Y����[��&�� Q���B��7p2��U���>��{�R�;�B$:���SNE4 _ȗ� �md�6JMa��V�b1eQ�-3�\�� �
1
+ J�#�4����
2
+ Z_;~_��|�l������8(�v�S��6K�m!�_Py����,�y�Li��!� 7�Y N��)��Vt���؊D,��s`�H) IlO���� �/͐F r+Q�9M���b�֙6���)Ğa6�_9_��w����-~ܔ�)��K� e�����
3
+ 9��}��虓+�[��zR�A����vp��fm���q M�;ەf�:�?��Y�Fx皌�:�2U��w
4
+ \�|v� �8�eQ�d
@@ -64,6 +64,8 @@ class DockerfileMerge
64
64
  maintainers.each {|x| lines.delete x}
65
65
 
66
66
  when :run
67
+
68
+ # find the last run command and add the present run command after it
67
69
 
68
70
  i = lines.index lines.grep(/RUN/).last
69
71
  i+=1 while lines[i][/\\\s*$/]
@@ -96,8 +98,16 @@ class DockerfileMerge
96
98
 
97
99
  singlify_first lines, /^\s*FROM /
98
100
  singlify_last lines, /^\s*CMD /
101
+ s = lines.join("\n")
99
102
 
100
- @to_s = lines.join("\n")
103
+ rm_sources = /rm -rf \/var\/lib\/apt\/lists\/\*/
104
+ rm_sources_count = s.scan(rm_sources).length
105
+
106
+ if rm_sources_count > 1 then
107
+ (rm_sources_count - 1).times { remove_command(rm_sources,s) }
108
+ end
109
+
110
+ @to_s = s
101
111
  end
102
112
 
103
113
  private
@@ -117,7 +127,11 @@ class DockerfileMerge
117
127
  rows.grep(/^# Pull /).each {|x| rows.delete x}
118
128
 
119
129
  lines.concat rows
120
- end
130
+ end
131
+
132
+ def remove_command(regex, s)
133
+ s.sub!(/(?:RUN\s+|\\?\s*&&\s+||&&\s*\\\s*)?#{regex}(?:\s+\\)? */,'')
134
+ end
121
135
 
122
136
  # removes any matching lines after the 1st matching line
123
137
  #
data.tar.gz.sig CHANGED
Binary file
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.0
4
+ version: 0.4.1
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-07-26 00:00:00.000000000 Z
34
+ date: 2015-08-02 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: lineparser
metadata.gz.sig CHANGED
Binary file