all_images 0.2.5 → 0.4.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: 5084009dccb97a9ac38c578c60e7f0dc8167995ab5ca374462d19e1b3ea69187
4
+ data.tar.gz: 29429c6b5e83d764e2855ab13586f9973e3daba03d3d3503d18eb221890c386d
5
5
  SHA512:
6
- metadata.gz: fc8763236d2ede44a1aa4e6e02ec79532b1263b1510e0e4a772ce6758cc4b330235cbc0b598d75c2efc496d00dd022e440600009f0a30d3282463d4fb59f9389
7
- data.tar.gz: a725aa9937c70a25f2e899f1620466d425e35642c6c155a9ec30887f139e50a43408251adbf7e6c7ecd787631e7f43b8bee6aeeeeb26026b7d79e2beba1d8e32
6
+ metadata.gz: 313d6f61b128dac3faa34e7866302d98f4f58a8f4ef2c92564d51442b153a0130300f48361068ff4ca6ea61254e613a0ec49267268ea3ef4bfef6378f48cc06c
7
+ data.tar.gz: 1576ef30edd69521581012b8a1582b39d5ba7a57549be7434adb5f9c275d543c10ecd0c9300a1c4419ee2e53ea0774c5436a523cd7899225f918c56de63c1a07
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,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: all_images 0.2.5 ruby lib
2
+ # stub: all_images 0.4.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.4.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]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2023-08-17"
11
+ s.date = "2024-02-07"
12
12
  s.description = "A script that runs a script in all of the configured docker images".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["all_images".freeze]
@@ -17,27 +17,17 @@ Gem::Specification.new do |s|
17
17
  s.homepage = "http://github.com/flori/all_images".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "AllImages -- Runs a script in all of the docker images".freeze, "--main".freeze, "README.md".freeze]
20
- s.rubygems_version = "3.3.26".freeze
20
+ s.rubygems_version = "3.4.10".freeze
21
21
  s.summary = "Runs a script in all of the docker images".freeze
22
22
  s.test_files = ["spec/spec_helper.rb".freeze]
23
23
 
24
- if s.respond_to? :specification_version then
25
- s.specification_version = 4
26
- end
24
+ s.specification_version = 4
27
25
 
28
- if s.respond_to? :add_runtime_dependency then
29
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
30
- s.add_development_dependency(%q<rake>.freeze, [">= 0"])
31
- s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
32
- s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
33
- s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.0"])
34
- s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
35
- else
36
- s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
37
- s.add_dependency(%q<rake>.freeze, [">= 0"])
38
- s.add_dependency(%q<simplecov>.freeze, [">= 0"])
39
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
40
- s.add_dependency(%q<tins>.freeze, ["~> 1.0"])
41
- s.add_dependency(%q<term-ansicolor>.freeze, [">= 0"])
42
- end
26
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
27
+ s.add_development_dependency(%q<rake>.freeze, [">= 0"])
28
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
29
+ s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
30
+ s.add_development_dependency(%q<debug>.freeze, [">= 0"])
31
+ s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.0"])
32
+ s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
43
33
  end
@@ -45,14 +45,20 @@ 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
+ term = ENV.key?('TERM') ? %{ -e TERM=#{ENV['TERM'].inspect} } : ' '
50
+ if interactive
51
+ puts "You can run /script interactively now."
52
+ sh "docker run --name all_images -it #{term}-v `pwd`:/work '#{tag}' sh"
52
53
  return 0
53
54
  else
54
- puts red('FAILURE')
55
- return 1
55
+ if sh "docker run --name all_images -it #{term}-v `pwd`:/work '#{tag}' sh -c /script"
56
+ puts green('SUCCESS')
57
+ return 0
58
+ else
59
+ puts red('FAILURE')
60
+ return 1
61
+ end
56
62
  end
57
63
  ensure
58
64
  sh 'docker rm -f all_images >/dev/null'
@@ -91,20 +97,25 @@ class AllImages::App
91
97
  AllImages::Config.load(config_filename)
92
98
  end
93
99
 
94
- def provide_image(image, dockerfile)
100
+ def provide_image(image, dockerfile, script)
95
101
  prefix = @config.fetch('prefix', File.basename(Dir.pwd))
96
102
  tag = "#{prefix}/all_images/#{image}"
97
103
  sh "docker pull '#{image}'"
98
104
  build_dir = File.join(Dir.tmpdir, 'build')
99
105
  mkdir_p build_dir
100
106
  cd build_dir do
101
- File.open('Dockerfile', 'w') do |t|
107
+ File.open('script', ?w) do |s|
108
+ s.print script
109
+ end
110
+ File.open('Dockerfile', ?w) do |t|
102
111
  t.puts <<~end
103
112
  FROM #{image}
104
113
 
105
114
  WORKDIR /work
106
115
 
107
116
  #{dockerfile}
117
+
118
+ COPY --chmod=755 script /script
108
119
  end
109
120
  end
110
121
  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.4.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,14 +1,14 @@
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.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-17 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -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
@@ -140,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
154
  - !ruby/object:Gem::Version
141
155
  version: '0'
142
156
  requirements: []
143
- rubygems_version: 3.3.26
157
+ rubygems_version: 3.4.10
144
158
  signing_key:
145
159
  specification_version: 4
146
160
  summary: Runs a script in all of the docker images