sle2docker 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +5 -0
- data/Gemfile +1 -1
- data/lib/sle2docker/builder.rb +15 -1
- data/lib/sle2docker/cli.rb +3 -0
- data/lib/sle2docker/version.rb +1 -1
- data/sle2docker.gemspec +1 -0
- data/test/builder_test.rb +20 -0
- data/test/test_helper.rb +1 -1
- metadata +27 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba695a590e56095cca42897195533744bdc29bf3
|
4
|
+
data.tar.gz: 0a00b46f07ffc4dcdf85dd4c2dbed07ed8e9f1f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 731ddcbf5d026a5e1b0c6a79147efcb6dd1004162806e334961304b75ae32bdc0b04ce81d8af8d04d6dd946ad17db5018ec73dcce7cca522f910d6aff8ef5d10
|
7
|
+
data.tar.gz: 4a3f8c444c6410c00f93ab89a4ba3cf5e47b678e8f2d6850d9914bc3df674e3cde3947f68ab11b166cca45354c4fc22e8e407cdadd47707f968541c949da5871
|
data/Changelog
CHANGED
data/Gemfile
CHANGED
data/lib/sle2docker/builder.rb
CHANGED
@@ -25,7 +25,15 @@ module Sle2Docker
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
docker_cmd = "docker run "
|
28
|
+
docker_cmd = "docker run --rm "
|
29
|
+
# dns entries - otherwise docker uses Google's DNS
|
30
|
+
dns_entries.each do |entry|
|
31
|
+
docker_cmd += "--dns=#{entry} "
|
32
|
+
end
|
33
|
+
# the HTTP proxy specified by the user
|
34
|
+
if @options[:http_proxy]
|
35
|
+
docker_cmd += "-e http_proxy=#{@options[:http_proxy]} "
|
36
|
+
end
|
29
37
|
# ensure kiwi cache is persistent
|
30
38
|
docker_cmd += "-v /var/cache/kiwi:/var/cache/kiwi "
|
31
39
|
# share build dir
|
@@ -97,6 +105,12 @@ module Sle2Docker
|
|
97
105
|
|
98
106
|
ERB.new(File.read(template_file)).result(binding)
|
99
107
|
end
|
108
|
+
|
109
|
+
def dns_entries
|
110
|
+
File.open('/etc/resolv.conf', 'r') do |file|
|
111
|
+
file.readlines("\n").grep(/\Anameserver\s+/).map{|l| l.split(" ", 2)[1].strip}
|
112
|
+
end
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
end
|
data/lib/sle2docker/cli.rb
CHANGED
@@ -73,6 +73,9 @@ module Sle2Docker
|
|
73
73
|
:type => :boolean,
|
74
74
|
:default => false,
|
75
75
|
:desc => "Do not use HTTPS when accessing repositories"
|
76
|
+
method_option :http_proxy, :aliases => ["--http-proxy"],
|
77
|
+
:default => ENV['http_proxy'],
|
78
|
+
:desc => "HTTP proxy to use (eg: http://squid.local:3128)"
|
76
79
|
def build(template_name)
|
77
80
|
template_dir = Template.template_dir(template_name)
|
78
81
|
builder = Builder.new(options)
|
data/lib/sle2docker/version.rb
CHANGED
data/sle2docker.gemspec
CHANGED
@@ -28,6 +28,7 @@ EOD
|
|
28
28
|
s.add_runtime_dependency "thor"
|
29
29
|
s.add_development_dependency "bundler"
|
30
30
|
s.add_development_dependency "yard"
|
31
|
+
s.add_development_dependency "fakefs"
|
31
32
|
s.files = `git ls-files`.split("\n")
|
32
33
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
33
34
|
s.require_path = 'lib'
|
data/test/builder_test.rb
CHANGED
@@ -166,5 +166,25 @@ class BuilderTest < MiniTest::Test
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
+
# Testing parsing of resolv.conf
|
170
|
+
|
171
|
+
def test_parse_resolv_conf
|
172
|
+
actual = []
|
173
|
+
expected = %w(1 2 3)
|
174
|
+
|
175
|
+
FakeFS do
|
176
|
+
FileUtils.mkdir("/etc")
|
177
|
+
File.open("/etc/resolv.conf", 'w') do |file|
|
178
|
+
file.write("nameserver 1\n")
|
179
|
+
file.write("nameserver 2\n")
|
180
|
+
file.write("nameserver\t\t3\n")
|
181
|
+
file.write("# nameserver ignored")
|
182
|
+
end
|
183
|
+
builder = Sle2Docker::Builder.new(@options)
|
184
|
+
actual = builder.dns_entries()
|
185
|
+
end
|
186
|
+
|
187
|
+
assert_equal(expected, actual)
|
188
|
+
end
|
169
189
|
end
|
170
190
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sle2docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flavio Castelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: yard
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fakefs
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
description: |
|
@@ -67,7 +81,7 @@ executables:
|
|
67
81
|
extensions: []
|
68
82
|
extra_rdoc_files: []
|
69
83
|
files:
|
70
|
-
- .gitignore
|
84
|
+
- ".gitignore"
|
71
85
|
- Changelog
|
72
86
|
- Gemfile
|
73
87
|
- LICENSE
|
@@ -108,18 +122,19 @@ require_paths:
|
|
108
122
|
- lib
|
109
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
124
|
requirements:
|
111
|
-
- -
|
125
|
+
- - ">="
|
112
126
|
- !ruby/object:Gem::Version
|
113
127
|
version: '0'
|
114
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
129
|
requirements:
|
116
|
-
- -
|
130
|
+
- - ">="
|
117
131
|
- !ruby/object:Gem::Version
|
118
132
|
version: 1.3.6
|
119
133
|
requirements: []
|
120
134
|
rubyforge_project: sle2docker
|
121
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.2.2
|
122
136
|
signing_key:
|
123
137
|
specification_version: 4
|
124
138
|
summary: Create SLE images for Docker
|
125
139
|
test_files: []
|
140
|
+
has_rdoc:
|