all_images 0.2.5 → 0.3.0

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
  SHA256:
3
- metadata.gz: 5eeb6608ed4cd3a9d5a90e6ebe876d0bc4b6d6e04b9698b292ead16032536455
4
- data.tar.gz: 400b79a71f4235910d5b15a66cccf451da4cc15a7d17e67a29379bec484e40d4
3
+ metadata.gz: 82689ac58a78b67b9df7e34612695f8202e117eca7398d9bcddaf4026cbedf32
4
+ data.tar.gz: 24eedd1e870051e86b25662f4340af33e9ca21cc50ad2fb401455c5a716eed8a
5
5
  SHA512:
6
- metadata.gz: fc8763236d2ede44a1aa4e6e02ec79532b1263b1510e0e4a772ce6758cc4b330235cbc0b598d75c2efc496d00dd022e440600009f0a30d3282463d4fb59f9389
7
- data.tar.gz: a725aa9937c70a25f2e899f1620466d425e35642c6c155a9ec30887f139e50a43408251adbf7e6c7ecd787631e7f43b8bee6aeeeeb26026b7d79e2beba1d8e32
6
+ metadata.gz: a1221949f5c98a131a5763ab23ddcb094a88d3954c99c1d989a23446fc1efd4f23c8a0199a3f5892f04962a3e8247c97ecc8e628c0c252b2b3f203ee817a4bd2
7
+ data.tar.gz: c565da18add211c6c8005c606f44cd07a059e8a18166d69b00b712ba8203d8536b22d87e1557108c4163e3acbe7abb256ca6c657957e3442ff82c8111b53b562
data/Rakefile CHANGED
@@ -21,6 +21,7 @@ GemHadar do
21
21
  development_dependency 'rake'
22
22
  development_dependency 'simplecov'
23
23
  development_dependency 'rspec'
24
+ development_dependency 'debug'
24
25
  licenses << 'MIT'
25
26
  executables << 'all_images'
26
27
  end
data/all_images.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: all_images 0.2.5 ruby lib
2
+ # stub: all_images 0.3.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "all_images".freeze
6
- s.version = "0.2.5"
6
+ s.version = "0.3.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_development_dependency(%q<rake>.freeze, [">= 0"])
31
31
  s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
32
32
  s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
33
+ s.add_development_dependency(%q<debug>.freeze, [">= 0"])
33
34
  s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.0"])
34
35
  s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
35
36
  else
@@ -37,6 +38,7 @@ Gem::Specification.new do |s|
37
38
  s.add_dependency(%q<rake>.freeze, [">= 0"])
38
39
  s.add_dependency(%q<simplecov>.freeze, [">= 0"])
39
40
  s.add_dependency(%q<rspec>.freeze, [">= 0"])
41
+ s.add_dependency(%q<debug>.freeze, [">= 0"])
40
42
  s.add_dependency(%q<tins>.freeze, ["~> 1.0"])
41
43
  s.add_dependency(%q<term-ansicolor>.freeze, [">= 0"])
42
44
  end
@@ -45,14 +45,19 @@ class AllImages::App
45
45
 
46
46
  def run_image(image, script, interactive: false)
47
47
  dockerfile = @config.fetch('dockerfile').to_s
48
- tag = provide_image image, dockerfile
49
- it = interactive ? ' -it ' : ' '
50
- if sh "docker run --name all_images#{it}-v `pwd`:/work '#{tag}' sh -c '#{script}'"
51
- puts green('SUCCESS')
48
+ tag = provide_image image, dockerfile, script
49
+ if interactive
50
+ puts "You can run /script interactively now."
51
+ sh "docker run --name all_images -it -v `pwd`:/work '#{tag}' sh"
52
52
  return 0
53
53
  else
54
- puts red('FAILURE')
55
- return 1
54
+ if sh "docker run --name all_images -v `pwd`:/work '#{tag}' sh -c /script"
55
+ puts green('SUCCESS')
56
+ return 0
57
+ else
58
+ puts red('FAILURE')
59
+ return 1
60
+ end
56
61
  end
57
62
  ensure
58
63
  sh 'docker rm -f all_images >/dev/null'
@@ -91,20 +96,25 @@ class AllImages::App
91
96
  AllImages::Config.load(config_filename)
92
97
  end
93
98
 
94
- def provide_image(image, dockerfile)
99
+ def provide_image(image, dockerfile, script)
95
100
  prefix = @config.fetch('prefix', File.basename(Dir.pwd))
96
101
  tag = "#{prefix}/all_images/#{image}"
97
102
  sh "docker pull '#{image}'"
98
103
  build_dir = File.join(Dir.tmpdir, 'build')
99
104
  mkdir_p build_dir
100
105
  cd build_dir do
101
- File.open('Dockerfile', 'w') do |t|
106
+ File.open('script', ?w) do |s|
107
+ s.print script
108
+ end
109
+ File.open('Dockerfile', ?w) do |t|
102
110
  t.puts <<~end
103
111
  FROM #{image}
104
112
 
105
113
  WORKDIR /work
106
114
 
107
115
  #{dockerfile}
116
+
117
+ COPY --chmod=755 script /script
108
118
  end
109
119
  end
110
120
  sh "docker build --pull -t '#{tag}' ."
@@ -1,6 +1,6 @@
1
1
  module AllImages
2
2
  # AllImages version
3
- VERSION = '0.2.5'
3
+ VERSION = '0.3.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: all_images
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: debug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: tins
71
85
  requirement: !ruby/object:Gem::Requirement