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 +4 -4
- data/Rakefile +1 -0
- data/all_images.gemspec +12 -22
- data/lib/all_images/app.rb +19 -8
- data/lib/all_images/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5084009dccb97a9ac38c578c60e7f0dc8167995ab5ca374462d19e1b3ea69187
|
4
|
+
data.tar.gz: 29429c6b5e83d764e2855ab13586f9973e3daba03d3d3503d18eb221890c386d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 313d6f61b128dac3faa34e7866302d98f4f58a8f4ef2c92564d51442b153a0130300f48361068ff4ca6ea61254e613a0ec49267268ea3ef4bfef6378f48cc06c
|
7
|
+
data.tar.gz: 1576ef30edd69521581012b8a1582b39d5ba7a57549be7434adb5f9c275d543c10ecd0c9300a1c4419ee2e53ea0774c5436a523cd7899225f918c56de63c1a07
|
data/Rakefile
CHANGED
data/all_images.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: all_images 0.
|
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.
|
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 = "
|
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.
|
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
|
-
|
25
|
-
s.specification_version = 4
|
26
|
-
end
|
24
|
+
s.specification_version = 4
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
data/lib/all_images/app.rb
CHANGED
@@ -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
|
-
|
50
|
-
if
|
51
|
-
puts
|
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
|
-
|
55
|
-
|
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('
|
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}' ."
|
data/lib/all_images/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|