all_images 0.2.4 → 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: 1a489bf027235e5f72579f77504a0cdbd0ba0a190ddf77fdb85c2039c2534c5c
4
- data.tar.gz: 4e50f5662b9626a283b03e17e6135ba69f3e9ad9f91feb229b3dbb7113a9d7fc
3
+ metadata.gz: 82689ac58a78b67b9df7e34612695f8202e117eca7398d9bcddaf4026cbedf32
4
+ data.tar.gz: 24eedd1e870051e86b25662f4340af33e9ca21cc50ad2fb401455c5a716eed8a
5
5
  SHA512:
6
- metadata.gz: 86ca9a61036164af98dd38b5540405b2272518264c635324bcb088cbc91bae88e9f455c0cd27535a69055468eb896d1c089e0854e860343e2cfb1e6c5fd44533
7
- data.tar.gz: 3a85cc95eb2c7ff2a9f82e72530824cc0b148f876c433112ecd95b5b8e0a29a814f725308180825cd870e7b890e4aed7e6df2881a7bbd82344704281f89c8999
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.4 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.4"
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
@@ -33,8 +33,7 @@ class AllImages::App
33
33
  when 'debug_selected'
34
34
  image == @selected and result |= run_image(image, script, interactive: true)
35
35
  end
36
- result |= 1
37
- if @config['fail_fast'] && result
36
+ if @config['fail_fast'] && result != 0
38
37
  return 1
39
38
  end
40
39
  end
@@ -46,14 +45,19 @@ class AllImages::App
46
45
 
47
46
  def run_image(image, script, interactive: false)
48
47
  dockerfile = @config.fetch('dockerfile').to_s
49
- tag = provide_image image, dockerfile
50
- it = interactive ? ' -it ' : ' '
51
- if sh "docker run --name all_images#{it}-v `pwd`:/work '#{tag}' sh -c '#{script}'"
52
- 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"
53
52
  return 0
54
53
  else
55
- puts red('FAILURE')
56
- 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
57
61
  end
58
62
  ensure
59
63
  sh 'docker rm -f all_images >/dev/null'
@@ -92,20 +96,25 @@ class AllImages::App
92
96
  AllImages::Config.load(config_filename)
93
97
  end
94
98
 
95
- def provide_image(image, dockerfile)
99
+ def provide_image(image, dockerfile, script)
96
100
  prefix = @config.fetch('prefix', File.basename(Dir.pwd))
97
101
  tag = "#{prefix}/all_images/#{image}"
98
102
  sh "docker pull '#{image}'"
99
103
  build_dir = File.join(Dir.tmpdir, 'build')
100
104
  mkdir_p build_dir
101
105
  cd build_dir do
102
- 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|
103
110
  t.puts <<~end
104
111
  FROM #{image}
105
112
 
106
113
  WORKDIR /work
107
114
 
108
115
  #{dockerfile}
116
+
117
+ COPY --chmod=755 script /script
109
118
  end
110
119
  end
111
120
  sh "docker build --pull -t '#{tag}' ."
@@ -1,6 +1,6 @@
1
1
  module AllImages
2
2
  # AllImages version
3
- VERSION = '0.2.4'
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.4
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