all_images 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.utilsrc +3 -4
- data/CHANGES.md +23 -0
- data/Rakefile +7 -6
- data/all_images.gemspec +8 -7
- data/lib/all_images/app.rb +168 -18
- data/lib/all_images/config.rb +33 -8
- data/lib/all_images/version.rb +1 -1
- data/lib/all_images.rb +11 -0
- data/spec/spec_helper.rb +2 -6
- metadata +25 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 891523bb4bc4e8db02aa5988a98cf117ca8610431ce00697adf64ed01cad81e0
|
4
|
+
data.tar.gz: b6bf746ffc6da61a5a3ffbe036d3bee18891782f801353ee6647d8694816fa2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a63bef0d4623121f44cc78650a2370d5d105ea5367649f2383fb6ec3f2b2165cdebbea4c969c08a4c7a73cf22de7785bc9b508b62db0eb277f22127c8b57ed34
|
7
|
+
data.tar.gz: 4e519cb30e6b7dc8dae4020c6aa6b4289176827c24e99b411a451afd259908285d04c8dcab0347dd00b3ab06e55b340fa7e8c8a47f1ecd9b3921d3a236faa5f3
|
data/.utilsrc
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
# vim: set ft=ruby:
|
2
2
|
|
3
3
|
search do
|
4
|
-
prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|pkg)\z/
|
4
|
+
prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|pkg|\.yardoc)\z/
|
5
5
|
skip_files /(\A\.|\.sw[pon]\z|\.(log|fnm|jpg|jpeg|png|pdf|svg)\z|tags|~\z)/i
|
6
6
|
end
|
7
7
|
|
8
8
|
discover do
|
9
|
-
prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|pkg)\z/
|
9
|
+
prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|pkg|\.yardoc)\z/
|
10
10
|
skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
|
11
|
-
binary false
|
12
11
|
end
|
13
12
|
|
14
13
|
strip_spaces do
|
15
|
-
prune_dirs /\A(\..*|CVS|pkg)\z/
|
14
|
+
prune_dirs /\A(\..*|CVS|pkg|\.yardoc)\z/
|
16
15
|
skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
|
17
16
|
end
|
18
17
|
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2025-09-11 v0.8.0
|
4
|
+
|
5
|
+
- Improved image matching logic by replacing direct
|
6
|
+
`images.map(&:first).grep(...)` with a separate `image_names` variable for
|
7
|
+
better search behavior
|
8
|
+
- Updated `tins` dependency from version **1.42** to **1** in `Rakefile` and
|
9
|
+
`all_images.gemspec`
|
10
|
+
- Updated `gem_hadar` development dependency from version **2.2** to **2.4** in
|
11
|
+
`Rakefile` and `all_images.gemspec`
|
12
|
+
|
13
|
+
## 2025-09-03 v0.7.0
|
14
|
+
|
15
|
+
- **Interactive Image Selection**: Integrated `SearchUI` for enhanced user
|
16
|
+
experience when selecting Docker images
|
17
|
+
- **Improved Configuration Handling**: Better error handling and fallback
|
18
|
+
mechanisms for configuration loading
|
19
|
+
- Removed support for Ruby **3.0** and **3.1**
|
20
|
+
- Added support for Ruby **3.4** with `ruby:3.4-alpine` image configuration
|
21
|
+
- Simplified SimpleCov setup using `GemHadar::SimpleCov.start`
|
22
|
+
- Removed obsolete `binary` option from utils config
|
23
|
+
- Added comprehensive documentation across the library
|
24
|
+
- Improved logging with `info_puts` method for colored console output
|
25
|
+
|
3
26
|
## 2024-10-14 v0.6.0
|
4
27
|
|
5
28
|
### Significant Changes
|
data/Rakefile
CHANGED
@@ -10,18 +10,19 @@ GemHadar do
|
|
10
10
|
summary 'Runs a script in all of the docker images'
|
11
11
|
description 'A script that runs a script in all of the configured docker images'
|
12
12
|
test_dir 'spec'
|
13
|
-
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage',
|
14
|
-
'.AppleDouble', 'tags', '.DS_Store'
|
15
13
|
readme 'README.md'
|
16
14
|
title "#{name.camelize} -- #{summary}"
|
15
|
+
licenses << 'MIT'
|
16
|
+
executables << 'all_images'
|
17
|
+
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage',
|
18
|
+
'.AppleDouble', 'tags', '.DS_Store', '.yardoc'
|
17
19
|
package_ignore '.all_images.yml', '.gitignore', 'VERSION'
|
18
20
|
|
19
|
-
dependency 'tins',
|
20
|
-
dependency '
|
21
|
+
dependency 'tins', '~> 1'
|
22
|
+
dependency 'search_ui', '~> 0.0'
|
23
|
+
dependency 'term-ansicolor', '~> 1.11'
|
21
24
|
development_dependency 'rake'
|
22
25
|
development_dependency 'simplecov'
|
23
26
|
development_dependency 'rspec'
|
24
27
|
development_dependency 'debug'
|
25
|
-
licenses << 'MIT'
|
26
|
-
executables << 'all_images'
|
27
28
|
end
|
data/all_images.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: all_images 0.
|
2
|
+
# stub: all_images 0.8.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.8.0".freeze
|
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 = "1980-01-02"
|
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,17 +17,18 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.homepage = "https://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.6.9".freeze
|
21
21
|
s.summary = "Runs a script in all of the docker images".freeze
|
22
22
|
s.test_files = ["spec/app_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
23
23
|
|
24
24
|
s.specification_version = 4
|
25
25
|
|
26
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~>
|
26
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.4".freeze])
|
27
27
|
s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
|
28
28
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
29
29
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
|
30
30
|
s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
|
31
|
-
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1
|
32
|
-
s.add_runtime_dependency(%q<
|
31
|
+
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1".freeze])
|
32
|
+
s.add_runtime_dependency(%q<search_ui>.freeze, ["~> 0.0".freeze])
|
33
|
+
s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.11".freeze])
|
33
34
|
end
|
data/lib/all_images/app.rb
CHANGED
@@ -4,28 +4,60 @@ require 'fileutils'
|
|
4
4
|
require 'tins'
|
5
5
|
require 'tins/xt/full'
|
6
6
|
require 'shellwords'
|
7
|
+
require 'search_ui'
|
7
8
|
|
9
|
+
# AllImages::App is the core application class that orchestrates Docker image
|
10
|
+
# execution workflows
|
11
|
+
#
|
12
|
+
# This class provides the main interface for running scripts across multiple
|
13
|
+
# Docker images, handling configuration loading, command processing, and Docker
|
14
|
+
# container operations.
|
15
|
+
#
|
16
|
+
# It supports various commands including listing available images, running all
|
17
|
+
# images, running specific images, and debugging interactive sessions.
|
18
|
+
#
|
19
|
+
# The application manages Docker image building, tagging, and cleanup while
|
20
|
+
# providing environment variable handling and error reporting capabilities.
|
8
21
|
class AllImages::App
|
9
22
|
include Term::ANSIColor
|
10
23
|
include FileUtils
|
24
|
+
include SearchUI
|
11
25
|
|
26
|
+
# Initializes a new instance of the AllImages application
|
27
|
+
#
|
28
|
+
# Sets up the application with the provided command-line arguments,
|
29
|
+
# determines the initial command to execute, and prepares internal state
|
30
|
+
# for processing configuration and Docker image operations.
|
31
|
+
#
|
32
|
+
# @param args [ Array<String> ] the command-line arguments passed to the
|
33
|
+
# application
|
12
34
|
def initialize(args)
|
13
35
|
@args = args.dup
|
36
|
+
@config = load_config or return 23
|
14
37
|
@command = pick_command
|
15
38
|
@commands = %w[ ls help run debug run_all ].sort
|
16
39
|
@suffix = Tins::Token.new(alphabet: Tins::Token::BASE32_ALPHABET, bits: 32)
|
17
40
|
end
|
18
41
|
|
42
|
+
# Executes the configured command across Docker images
|
43
|
+
#
|
44
|
+
# Processes the specified command and runs it against the configured Docker
|
45
|
+
# images. Depending on the command, this method may list available images,
|
46
|
+
# display help information, or execute scripts in containers. It handles both
|
47
|
+
# individual image execution and batch processing of all configured images.
|
48
|
+
#
|
49
|
+
# @return [ Integer ] the cumulative result code from executing commands
|
50
|
+
# across images, where 0 indicates success and non-zero values indicate
|
51
|
+
# failures
|
19
52
|
def run
|
20
|
-
|
21
|
-
result = 0
|
53
|
+
result = 0
|
22
54
|
case @command
|
23
55
|
when 'ls'
|
24
|
-
puts
|
56
|
+
puts images.map(&:first)
|
25
57
|
when 'help'
|
26
58
|
puts "Usage: #{File.basename($0)} #{@commands * ?|} [IMAGE]"
|
27
59
|
else
|
28
|
-
|
60
|
+
images.each do |image, script|
|
29
61
|
case @command
|
30
62
|
when 'run_all'
|
31
63
|
result |= run_image(image, script)
|
@@ -44,6 +76,33 @@ class AllImages::App
|
|
44
76
|
|
45
77
|
private
|
46
78
|
|
79
|
+
# Returns an array of configured Docker images for execution
|
80
|
+
#
|
81
|
+
# This method retrieves the list of Docker images from the application's
|
82
|
+
# configuration and ensures it is returned as an Array instance, even if the
|
83
|
+
# configuration contains a single image value rather than an array.
|
84
|
+
#
|
85
|
+
# @return [ Array<String> ] an array containing the names of Docker images
|
86
|
+
# to be processed by the application
|
87
|
+
def images
|
88
|
+
Array(@config['images'])
|
89
|
+
end
|
90
|
+
|
91
|
+
# Prints the given text using green colored output
|
92
|
+
#
|
93
|
+
# @param text [ String ] the text to be printed with color formatting
|
94
|
+
def info_puts(text)
|
95
|
+
puts white { on_color(28) { text } }
|
96
|
+
end
|
97
|
+
|
98
|
+
# Returns a hash of environment variables for Docker container execution
|
99
|
+
#
|
100
|
+
# This method constructs a set of environment variables by combining those
|
101
|
+
# specified in the configuration file with any terminal-related variables
|
102
|
+
# from the current environment, ensuring proper variable expansion and
|
103
|
+
# assignment for use in Docker container runs.
|
104
|
+
#
|
105
|
+
# @return [ Hash ] a hash mapping environment variable names to their values
|
47
106
|
def env
|
48
107
|
vars = @config.fetch('env', [])
|
49
108
|
vars << 'TERM' if ENV.key?('TERM')
|
@@ -57,6 +116,18 @@ class AllImages::App
|
|
57
116
|
}
|
58
117
|
end
|
59
118
|
|
119
|
+
# Executes a system command and handles its result
|
120
|
+
#
|
121
|
+
# This method runs a given system command with the provided arguments,
|
122
|
+
# optionally logging the execution when debug mode is enabled. It checks the
|
123
|
+
# command's exit status and raises an exception if the command fails,
|
124
|
+
# otherwise returning true to indicate success.
|
125
|
+
#
|
126
|
+
# @param a [ Array<String> ] the command and its arguments to be executed
|
127
|
+
#
|
128
|
+
# @return [ TrueClass ] when the command executes successfully
|
129
|
+
#
|
130
|
+
# @raise [ RuntimeError ] if the executed command exits with a non-zero status
|
60
131
|
def sh(*a)
|
61
132
|
if $DEBUG
|
62
133
|
STDERR.puts "Executing #{a.inspect}."
|
@@ -69,23 +140,46 @@ class AllImages::App
|
|
69
140
|
end
|
70
141
|
end
|
71
142
|
|
143
|
+
# Generates a unique name for Docker container operations
|
144
|
+
#
|
145
|
+
# Creates a name by combining the fixed prefix "all_images" with a randomly
|
146
|
+
# generated suffix, separated by a hyphen, for use in Docker container
|
147
|
+
# identification and cleanup.
|
148
|
+
#
|
149
|
+
# @return [ String ] a unique identifier suitable for Docker container naming
|
72
150
|
def name
|
73
151
|
[ 'all_images', @suffix ] * ?-
|
74
152
|
end
|
75
153
|
|
154
|
+
# Executes a Docker image with the specified script in a container
|
155
|
+
#
|
156
|
+
# This method builds a Docker image based on the provided configuration,
|
157
|
+
# runs the script inside the container, and handles both interactive and
|
158
|
+
# non-interactive execution modes. It ensures cleanup of the container
|
159
|
+
# afterward regardless of success or failure.
|
160
|
+
#
|
161
|
+
# @param image [ String ] the Docker image name to use for execution
|
162
|
+
# @param script [ String ] the script content to be executed within the container
|
163
|
+
# @param interactive [ TrueClass, FalseClass ] flag indicating whether to run
|
164
|
+
# the container interactively or in non-interactive mode
|
165
|
+
#
|
166
|
+
# @return [ Integer ] exit code indicating success (0) or failure (1) of the script execution
|
76
167
|
def run_image(image, script, interactive: false)
|
77
168
|
dockerfile = @config.fetch('dockerfile').to_s
|
78
|
-
tag
|
79
|
-
envs
|
169
|
+
tag = provide_image image, dockerfile, script
|
170
|
+
envs = env.full? { |e| +' ' << e.map { |n, v| '-e %s=%s' % [ n, v.inspect ] } * ' ' }
|
80
171
|
if interactive
|
81
172
|
puts "You can run /script interactively now."
|
82
173
|
sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh"
|
83
174
|
return 0
|
84
175
|
else
|
176
|
+
info_puts "Running container #{name.inspect} for image tagged #{tag.inspect}."
|
85
177
|
if sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh -c /script"
|
178
|
+
info_puts "Image tagged #{tag.inspect} was run with result:"
|
86
179
|
puts green('SUCCESS')
|
87
180
|
return 0
|
88
181
|
else
|
182
|
+
info_puts "Image tagged #{tag.inspect} was run with result:"
|
89
183
|
puts red('FAILURE')
|
90
184
|
return 1
|
91
185
|
end
|
@@ -94,6 +188,42 @@ class AllImages::App
|
|
94
188
|
sh "docker rm -f #{name} >/dev/null"
|
95
189
|
end
|
96
190
|
|
191
|
+
# Presents a searchable interface for selecting a configured Docker image
|
192
|
+
#
|
193
|
+
# This method initializes and starts a search UI that allows users to
|
194
|
+
# interactively pick a Docker image from the list of configured images. It
|
195
|
+
# provides filtering capabilities based on user input and displays the
|
196
|
+
# options with visual highlighting for the selected item.
|
197
|
+
#
|
198
|
+
# @return [ String ] the name of the selected Docker image
|
199
|
+
def pick_configured_image
|
200
|
+
Search.new(
|
201
|
+
prompt: 'Pick a configured container image: ',
|
202
|
+
match: -> answer {
|
203
|
+
image_names = images.map(&:first)
|
204
|
+
matches = image_names.grep(/#{Regexp.quote(answer)}/)
|
205
|
+
matches.empty? and matches = image_names
|
206
|
+
matches.first(Tins::Terminal.lines - 1)
|
207
|
+
},
|
208
|
+
query: -> _answer, matches, selector {
|
209
|
+
matches.each_with_index.map { |m, i|
|
210
|
+
i == selector ? "#{blue{?⮕}} #{on_blue{bold{m}}}" : " #{m.to_s}"
|
211
|
+
} * ?\n
|
212
|
+
},
|
213
|
+
found: -> _answer, matches, selector {
|
214
|
+
matches[selector]
|
215
|
+
},
|
216
|
+
output: STDOUT
|
217
|
+
).start
|
218
|
+
end
|
219
|
+
|
220
|
+
# Determines the command to execute based on the provided arguments
|
221
|
+
#
|
222
|
+
# Processes the command-line arguments to identify the intended operation,
|
223
|
+
# handling cases for running all images, listing images, running a specific
|
224
|
+
# image, debugging a specific image, or displaying help information.
|
225
|
+
#
|
226
|
+
# @return [ String ] the determined command to be executed
|
97
227
|
def pick_command
|
98
228
|
case command = @args.shift
|
99
229
|
when 'run_all', nil
|
@@ -101,32 +231,51 @@ class AllImages::App
|
|
101
231
|
when 'ls'
|
102
232
|
'ls'
|
103
233
|
when 'run'
|
104
|
-
@selected = @args.shift
|
234
|
+
@selected = @args.shift || pick_configured_image
|
235
|
+
@selected or fail "Usage: #{File.basename($0)} #{command} IMAGE"
|
105
236
|
'run_selected'
|
106
237
|
when 'debug'
|
107
|
-
@selected = @args.shift
|
238
|
+
@selected = @args.shift || pick_configured_image
|
239
|
+
@selected or fail "Usage: #{File.basename($0)} #{command} IMAGE"
|
108
240
|
'debug_selected'
|
109
241
|
else
|
110
242
|
'help'
|
111
243
|
end
|
112
244
|
end
|
113
245
|
|
246
|
+
# Loads and processes the configuration file for the AllImages application
|
247
|
+
#
|
248
|
+
# This method determines the appropriate configuration file to load based on
|
249
|
+
# command-line arguments or defaults to .all_images.yml. If the file doesn't exist
|
250
|
+
# and no alternative is provided, it initializes a default configuration file
|
251
|
+
# and displays an example for customization before exiting.
|
252
|
+
#
|
253
|
+
# @return [ Object, nil ] the parsed configuration hash if successful, or nil if
|
254
|
+
# initialization occurred and the method should terminate early
|
114
255
|
def load_config
|
115
256
|
config_filename = '.all_images.yml'
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
return
|
123
|
-
end
|
124
|
-
else
|
125
|
-
config_filename = @args.shift
|
257
|
+
unless File.exist?(config_filename)
|
258
|
+
AllImages::Config.init(config_filename)
|
259
|
+
puts bold("Config file #{config_filename} not found!\n\n") +
|
260
|
+
"The following example was created, adapt to your own needs:\n\n",
|
261
|
+
AllImages::Config.example, ""
|
262
|
+
return
|
126
263
|
end
|
127
264
|
AllImages::Config.load(config_filename)
|
128
265
|
end
|
129
266
|
|
267
|
+
# Prepares a Docker image for execution by pulling, building, and tagging it
|
268
|
+
#
|
269
|
+
# This method ensures that the specified Docker image is available locally,
|
270
|
+
# creates a temporary build environment, generates a Dockerfile with the
|
271
|
+
# provided configuration and script, builds the image with a unique tag, and
|
272
|
+
# cleans up the temporary files afterward.
|
273
|
+
#
|
274
|
+
# @param image [ String ] the base Docker image name to pull and use for building
|
275
|
+
# @param dockerfile [ String ] additional Dockerfile instructions to include in the build
|
276
|
+
# @param script [ String ] the script content that will be copied into the built image
|
277
|
+
#
|
278
|
+
# @return [ String ] the unique tag assigned to the newly built Docker image
|
130
279
|
def provide_image(image, dockerfile, script)
|
131
280
|
prefix = @config.fetch('prefix', File.basename(Dir.pwd))
|
132
281
|
tag = "#{prefix}/all_images/#{image}"
|
@@ -148,6 +297,7 @@ class AllImages::App
|
|
148
297
|
COPY --chmod=755 script /script
|
149
298
|
end
|
150
299
|
end
|
300
|
+
info_puts "Now building image #{tag.inspect}…"
|
151
301
|
sh "docker build --pull -t '#{tag}' ."
|
152
302
|
end
|
153
303
|
tag
|
data/lib/all_images/config.rb
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
|
+
# Configuration handling for AllImages
|
4
|
+
#
|
5
|
+
# Provides functionality for loading, initializing, and accessing example
|
6
|
+
# configuration files used by the AllImages application to define Docker image
|
7
|
+
# build and execution parameters.
|
3
8
|
module AllImages::Config
|
9
|
+
# Loads and parses a YAML configuration file
|
10
|
+
#
|
11
|
+
# @param filename [ String ] the path to the YAML file to load
|
12
|
+
#
|
13
|
+
# @return [ Object ] the parsed YAML content as a Ruby object
|
4
14
|
def load(filename)
|
5
15
|
YAML.unsafe_load_file(filename)
|
6
16
|
end
|
7
17
|
|
8
|
-
|
18
|
+
# Example configuration for `all_images`.
|
19
|
+
EXAMPLE = <<~EOT
|
9
20
|
dockerfile: |-
|
10
|
-
RUN apk add --no-cache build-base git
|
11
|
-
RUN gem
|
12
|
-
RUN gem install gem_hadar bundler
|
21
|
+
RUN apk add --no-cache build-base yaml-dev git
|
22
|
+
RUN gem install gem_hadar
|
13
23
|
|
14
24
|
script: &script |-
|
15
25
|
echo -e "\\e[1m"
|
@@ -19,18 +29,33 @@ module AllImages::Config
|
|
19
29
|
rake test
|
20
30
|
|
21
31
|
images:
|
32
|
+
ruby:3.4-alpine: *script
|
22
33
|
ruby:3.3-alpine: *script
|
23
34
|
ruby:3.2-alpine: *script
|
24
|
-
|
25
|
-
ruby:3.0-alpine: *script
|
26
|
-
end
|
35
|
+
EOT
|
27
36
|
|
37
|
+
# Initializes a configuration file with example content
|
38
|
+
#
|
39
|
+
# Creates a new configuration file at the specified path and writes example
|
40
|
+
# configuration content to it. This method is typically used when no existing
|
41
|
+
# configuration file is found, providing a starting point for users to
|
42
|
+
# customize.
|
43
|
+
#
|
44
|
+
# @param filename [ String ] the path where the example configuration file
|
45
|
+
# will be created
|
28
46
|
def init(filename)
|
29
|
-
File.open(filename,
|
47
|
+
File.open(filename, ?w) do |output|
|
30
48
|
output.print EXAMPLE
|
31
49
|
end
|
32
50
|
end
|
33
51
|
|
52
|
+
# Returns the example configuration content
|
53
|
+
#
|
54
|
+
# This method provides access to the predefined example configuration
|
55
|
+
# that can be used to initialize a new configuration file.
|
56
|
+
#
|
57
|
+
# @return [ String ] the multi-line string containing the example configuration
|
58
|
+
# structure and default settings
|
34
59
|
def example
|
35
60
|
EXAMPLE
|
36
61
|
end
|
data/lib/all_images/version.rb
CHANGED
data/lib/all_images.rb
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# AllImages is a Ruby library that provides functionality for managing and
|
2
|
+
# executing scripts across multiple Docker images.
|
3
|
+
#
|
4
|
+
# It offers a command-line interface for running automated tasks in
|
5
|
+
# containerized environments, supporting configuration-driven execution, image
|
6
|
+
# building, and interactive debugging.
|
7
|
+
#
|
8
|
+
# The library includes modules for handling configuration files, managing
|
9
|
+
# Docker image operations, and providing a user-friendly interface for
|
10
|
+
# developers to test their code across different environments without manual
|
11
|
+
# setup.
|
1
12
|
module AllImages
|
2
13
|
end
|
3
14
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: all_images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: gem_hadar
|
@@ -16,14 +15,14 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
18
|
+
version: '2.4'
|
20
19
|
type: :development
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
25
|
+
version: '2.4'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: rake
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +85,42 @@ dependencies:
|
|
86
85
|
requirements:
|
87
86
|
- - "~>"
|
88
87
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1
|
88
|
+
version: '1'
|
90
89
|
type: :runtime
|
91
90
|
prerelease: false
|
92
91
|
version_requirements: !ruby/object:Gem::Requirement
|
93
92
|
requirements:
|
94
93
|
- - "~>"
|
95
94
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1
|
95
|
+
version: '1'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: search_ui
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.0'
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.0'
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: term-ansicolor
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
100
113
|
requirements:
|
101
|
-
- - "
|
114
|
+
- - "~>"
|
102
115
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
116
|
+
version: '1.11'
|
104
117
|
type: :runtime
|
105
118
|
prerelease: false
|
106
119
|
version_requirements: !ruby/object:Gem::Requirement
|
107
120
|
requirements:
|
108
|
-
- - "
|
121
|
+
- - "~>"
|
109
122
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
123
|
+
version: '1.11'
|
111
124
|
description: A script that runs a script in all of the configured docker images
|
112
125
|
email: flori@ping.de
|
113
126
|
executables:
|
@@ -138,7 +151,6 @@ homepage: https://github.com/flori/all_images
|
|
138
151
|
licenses:
|
139
152
|
- MIT
|
140
153
|
metadata: {}
|
141
|
-
post_install_message:
|
142
154
|
rdoc_options:
|
143
155
|
- "--title"
|
144
156
|
- AllImages -- Runs a script in all of the docker images
|
@@ -157,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
169
|
- !ruby/object:Gem::Version
|
158
170
|
version: '0'
|
159
171
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
161
|
-
signing_key:
|
172
|
+
rubygems_version: 3.6.9
|
162
173
|
specification_version: 4
|
163
174
|
summary: Runs a script in all of the docker images
|
164
175
|
test_files:
|