dockerfilemerge 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/dockerfilemerge.rb +81 -0
- data.tar.gz.sig +1 -0
- metadata +107 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7fef351e34b52670bc2b33ec521d4004358207d4
|
4
|
+
data.tar.gz: 174fcad67e0db8754b0a1ab68e078b4e599c8ab8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 79b33c82b3540624a16d7da003b1d12acdc29eb3ebbbfb771999ab1ad7d46c40894c65edd0d92d16214eddc4253c01641970ed8a6d6021cf35a3a58e2d9c082b
|
7
|
+
data.tar.gz: 6d0d2c377f6a8045b802281cb22b44347d6d03a363b6029a80980d03008652d86aef3d02a8c46d423802fa623366555f941f9e0fe6a731933b1ab570d651b889
|
checksums.yaml.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: dockerfilemerge.rb
|
4
|
+
|
5
|
+
require 'lineparser'
|
6
|
+
require 'rxfhelper'
|
7
|
+
|
8
|
+
class DockerfileMerge
|
9
|
+
|
10
|
+
attr_reader :to_s
|
11
|
+
|
12
|
+
def initialize(s)
|
13
|
+
|
14
|
+
patterns = [
|
15
|
+
[:root, /INCLUDE\s*(?<path>.*)?/, :include],
|
16
|
+
[:include, /(?<path>.*)/, :dockerfile],
|
17
|
+
[:root, /MAINTAINER (?<name>.*)/, :maintainer],
|
18
|
+
[:root, /RUN (?<command>.*)/, :run],
|
19
|
+
[:all, /#/, :comment]
|
20
|
+
]
|
21
|
+
|
22
|
+
lp = LineParser.new patterns, ignore_blank_lines: false
|
23
|
+
a = lp.parse s
|
24
|
+
|
25
|
+
lines = []
|
26
|
+
|
27
|
+
a.each do |x|
|
28
|
+
|
29
|
+
case x.first
|
30
|
+
when :comment
|
31
|
+
lines << x[2].first
|
32
|
+
lines << '' if x[2].length > 1
|
33
|
+
|
34
|
+
when :include
|
35
|
+
|
36
|
+
if x[1][:path].length > 0 then
|
37
|
+
|
38
|
+
path = x[1][:path]
|
39
|
+
|
40
|
+
buffer, type = RXFHelper.read(path)
|
41
|
+
rows = buffer.lines.map(&:chomp)
|
42
|
+
lines << "\n\n# copied from " + path if type == :url
|
43
|
+
rows.grep(/^# Pull /).each {|x| rows.delete x}
|
44
|
+
lines.concat rows
|
45
|
+
|
46
|
+
else
|
47
|
+
|
48
|
+
x[3].each do |source|
|
49
|
+
path = source[1][:path]
|
50
|
+
buffer, type = RXFHelper.read(path)
|
51
|
+
rows = buffer.lines.map(&:chomp)
|
52
|
+
lines << "\n\n# copied from " + path if type == :url
|
53
|
+
rows.grep(/^# Pull /).each {|x| rows.delete x}
|
54
|
+
lines.concat rows
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
lines << '' if x[2].length > 1
|
60
|
+
|
61
|
+
when :maintainer
|
62
|
+
|
63
|
+
maintainers = lines.grep(/MAINTAINER/)
|
64
|
+
i = lines.index maintainers.shift
|
65
|
+
lines[i] = x[2].first
|
66
|
+
maintainers.each {|x| lines.delete x}
|
67
|
+
|
68
|
+
when :run
|
69
|
+
i = lines.index lines.grep(/RUN/).last
|
70
|
+
lines.insert(i+1, x[2].first)
|
71
|
+
lines.insert(i+2, '') if x[2].length > 1
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
lines.grep(/^FROM /)[1..-1].each {|x| lines.delete x}
|
77
|
+
lines.grep(/^CMD/)[0..-2].each {|x| lines.delete x}
|
78
|
+
|
79
|
+
@to_s = lines.join("\n")
|
80
|
+
end
|
81
|
+
end
|
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Ki���P����!/{;b:4��?q��U'����O���cEQ��^�3��%��,���"&�v4���5���}=�M�)�|܂'V�<�F5y��SQ �����!����Ss�!��Y�H�sC�#��L)r�%����g�e�0�y���Fb/Ж>_$&�b���Vx�<~�V��T�v��U�#����+vQ�B�`^�e�CM����0�aN�]�`�2@~Eҝ�I�OG��������?�%�
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dockerfilemerge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE1MDcwOTIyMjYxOVoXDTE2MDcwODIyMjYxOVowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBANN2xruCRBJcjqpnwZhgNr9xh5r+fEnHRRN9cVT7gSjF1QKUptpVILDXBjmo
|
19
|
+
VRC2WyhB2ct0RiKaBMjtvh2k6sDkjkKzSu+2nsFrULhF7CmQ6KGZQ+xGmWK0rDnJ
|
20
|
+
7RgxYyE16APlhiFboYKg4DuIYbvHUvYkVJJc4d0cpm33QDLYV/qzM8tikHv1b3Z5
|
21
|
+
1x0w9YaCYY0qcwPkyT5iBNIOYETGu3QhO1qxSnMfchqPT3qSHEMURCqMd+YqUIqA
|
22
|
+
reKHiU4/vtnnfblJoUkLHu5ncrTMzFOSMIx6sz9IkOoxUSIn5iQJ+BsJmL2ro83B
|
23
|
+
t6aC1T35QveE9Cw8ollOk+/wwgECAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUUTTdbNjncxfVI4lCFCMDsGhs8WswJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAfKIf6WI6
|
27
|
+
wRrUjXB8O0M+NPxyn6xIFlFNwEr6hW6baJ03Qg6Gx61oRMhYpncK11bVAelmrd+t
|
28
|
+
zR2hNqO0JNPxj8nreNO7bCQhv/jZBddarI01JxLAOqYqkdL/SNmXAkbyinQeHi/G
|
29
|
+
CqIpCHhDwm1OyWM5LMXL/keJyYhV6zWsKss77mgs2eI7ngJIRumY61D0omp1mkkO
|
30
|
+
plFRlsPmYWHR38dUWIcgORaoBvaxdTP4cJqq/+AElHvbeAJG/rLBGd9jF6tG8YZk
|
31
|
+
WHpJ21HYl4KWG8TISerrdwpQAZ5dhV2Yy/4q0MWSnDcMRSYdRAixOcdYW+U+R8cz
|
32
|
+
pf2JrQZNdYZXIg==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: lineparser
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.15
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.15
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rxfhelper
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.2'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.2.3
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.2'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.2.3
|
76
|
+
description:
|
77
|
+
email: james@r0bertson.co.uk
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- lib/dockerfilemerge.rb
|
83
|
+
homepage: https://github.com/jrobertson/dockerfilemerge
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.4.6
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Merge 2 or more Dockerfiles into 1 Dockerfile
|
107
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|