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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6eb74b020e570764a417ceb7dcfb6044f6da1c02
4
- data.tar.gz: 7f8f3fd365400356f62bb3f4aa61287122edc16b
3
+ metadata.gz: ba695a590e56095cca42897195533744bdc29bf3
4
+ data.tar.gz: 0a00b46f07ffc4dcdf85dd4c2dbed07ed8e9f1f2
5
5
  SHA512:
6
- metadata.gz: 4296f310866f871a4f67a21aa411da9beecb95e6d4cc9d1a4dfa7a056e7ac96c92387106023dc041373e3bb96eed8290dd692c9c31c0a09ddd8dcf70aade4d0e
7
- data.tar.gz: 819642dbbc8df8de035a073f7e39ecebca06f6f42e7da56a40f0aac727a1192b5c19d27a1d4fd5569ab5118c8f44c6c852d08d5eb54f645692e237db453c055e
6
+ metadata.gz: 731ddcbf5d026a5e1b0c6a79147efcb6dd1004162806e334961304b75ae32bdc0b04ce81d8af8d04d6dd946ad17db5018ec73dcce7cca522f910d6aff8ef5d10
7
+ data.tar.gz: 4a3f8c444c6410c00f93ab89a4ba3cf5e47b678e8f2d6850d9914bc3df674e3cde3947f68ab11b166cca45354c4fc22e8e407cdadd47707f968541c949da5871
data/Changelog CHANGED
@@ -1,3 +1,8 @@
1
+ Wed Nov 12 15:46:38 CET 2014 Flavio Castelli <flavio@castelli.name>
2
+
3
+ * Version 0.2.3:
4
+ - Handle http proxy
5
+
1
6
  Thu Oct 30 13:48:45 CET 2014 Flavio Castelli <fcastelli@suse.com>
2
7
 
3
8
  * Version 0.2.2:
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org/'
2
2
 
3
- # Specify your gem's dependencies in dister.gemspec
3
+ # Specify your gem's dependencies in sle2docker.gemspec
4
4
  gemspec
@@ -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
@@ -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)
@@ -1,5 +1,5 @@
1
1
  module Sle2Docker
2
2
 
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
 
5
5
  end
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
@@ -1,7 +1,7 @@
1
1
  require File.expand_path('../../lib/sle2docker',__FILE__)
2
- require 'bundler/setup' # Use bundled environment for testing
3
2
  require 'minitest/autorun'
4
3
  require 'stringio'
4
+ require 'fakefs/safe'
5
5
 
6
6
  class Object
7
7
  def capture(stream)
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.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-10-30 00:00:00.000000000 Z
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.0.3
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: