all_images 0.2.2 → 0.2.3

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: 993e52d612a767d40287b1525edb030734dfef5ffc5579f5db77cf7852cfde39
4
- data.tar.gz: c937e2239fedbea45f833b5ee632ba1201b33d36eefb6ec48d254ada43370c22
3
+ metadata.gz: 2a60ee1556ea6be5325f6674cab02b047bf0d0e6e5b97e6b2b8419a66a99888e
4
+ data.tar.gz: 5036c7fd5a7f031c375dbed835b7f9e79bb6c47a1266e7c0589aae00023446ec
5
5
  SHA512:
6
- metadata.gz: 4d1940d49661c954471978cafa28f72cf384385ef9049678394a8bd3dfb0afe2cd7546db5977b2bf052d7e1d6be2407fef69009b46fcc9285da2d8c1454de969
7
- data.tar.gz: 05d3829c56d9624dc72be17536972b791f99545eb0e4add3e1b9f7784ac8ed009d9cace8968ffa5b35bbbe7c10c72e1b7df3cfa252e60f348e40d667081f655e
6
+ metadata.gz: c856e7d9c7074006c3fde6f6625a32464be5a354a7227f1ce8e59b3b67a27da3b5f4ab66f52fb304f4a2a0916e2ce7b2ffbd5bc1a5550585e12c8ec14b3cf511
7
+ data.tar.gz: 473967fcfe87487be735cba810857127e55ed1249e38269e9e40406631fa38ff2d022545470f0c15b0ea9523ab1051ca485a2cf0510fd702091387776f3e72a6
data/all_images.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: all_images 0.2.2 ruby lib
2
+ # stub: all_images 0.2.3 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "all_images".freeze
6
- s.version = "0.2.2"
6
+ s.version = "0.2.3"
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-04-19"
11
+ s.date = "2023-06-01"
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]
@@ -9,29 +9,34 @@ class AllImages::App
9
9
  alias sh system
10
10
 
11
11
  def initialize(args)
12
- @args = args.dup
13
- @command = pick_command
12
+ @args = args.dup
13
+ @command = pick_command
14
+ @commands = %w[ ls help run debug run_all ].sort
14
15
  end
15
16
 
16
17
  def run
17
- result = 0
18
- @config = load_config or return 23
18
+ @config = load_config or return 23
19
19
 
20
+ result = 0
20
21
  case @command
21
22
  when 'ls'
22
23
  puts Array(@config['images']).map(&:first)
23
24
  when 'help'
24
- commands = %w[ ls help run debug run_all ].sort
25
- puts "Usage: #{File.basename($0)} #{commands * ?|} IMAGE"
25
+ puts "Usage: #{File.basename($0)} #{@commands * ?|} IMAGE"
26
26
  else
27
27
  Array(@config['images']).each do |image, script|
28
28
  case @command
29
29
  when 'run_all'
30
- run_image(image, script)
30
+ result |= run_image(image, script)
31
31
  when 'run_selected'
32
- image == @selected and run_image(image, script)
32
+ image == @selected and result |= run_image(image, script)
33
33
  when 'debug_selected'
34
- image == @selected and run_image(image, script, interactive: true)
34
+ image == @selected and result |= run_image(image, script, interactive: true)
35
+ end
36
+ if @config['fail_fast']
37
+ return 1
38
+ else
39
+ result |= 1
35
40
  end
36
41
  end
37
42
  end
@@ -46,13 +51,10 @@ class AllImages::App
46
51
  it = interactive ? ' -it ' : ' '
47
52
  if sh "docker run --name all_images#{it}-v `pwd`:/work '#{tag}' sh -c '#{script}'"
48
53
  puts green('SUCCESS')
54
+ return 0
49
55
  else
50
56
  puts red('FAILURE')
51
- if @config['fail_fast']
52
- return 1
53
- else
54
- result |= 1
55
- end
57
+ return 1
56
58
  end
57
59
  ensure
58
60
  sh 'docker rm -f all_images >/dev/null'
@@ -70,7 +72,7 @@ class AllImages::App
70
72
  when 'debug'
71
73
  @selected = @args.shift or fail "Usage: #{File.basename($0)} #{command} IMAGE"
72
74
  'debug_selected'
73
- when 'help'
75
+ else
74
76
  'help'
75
77
  end
76
78
  end
@@ -1,6 +1,6 @@
1
1
  module AllImages
2
2
  # AllImages version
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
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.2
4
+ version: 0.2.3
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-04-19 00:00:00.000000000 Z
11
+ date: 2023-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar