all_images 0.2.2 → 0.2.4

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: 1a489bf027235e5f72579f77504a0cdbd0ba0a190ddf77fdb85c2039c2534c5c
4
+ data.tar.gz: 4e50f5662b9626a283b03e17e6135ba69f3e9ad9f91feb229b3dbb7113a9d7fc
5
5
  SHA512:
6
- metadata.gz: 4d1940d49661c954471978cafa28f72cf384385ef9049678394a8bd3dfb0afe2cd7546db5977b2bf052d7e1d6be2407fef69009b46fcc9285da2d8c1454de969
7
- data.tar.gz: 05d3829c56d9624dc72be17536972b791f99545eb0e4add3e1b9f7784ac8ed009d9cace8968ffa5b35bbbe7c10c72e1b7df3cfa252e60f348e40d667081f655e
6
+ metadata.gz: 86ca9a61036164af98dd38b5540405b2272518264c635324bcb088cbc91bae88e9f455c0cd27535a69055468eb896d1c089e0854e860343e2cfb1e6c5fd44533
7
+ data.tar.gz: 3a85cc95eb2c7ff2a9f82e72530824cc0b148f876c433112ecd95b5b8e0a29a814f725308180825cd870e7b890e4aed7e6df2881a7bbd82344704281f89c8999
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.4 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.4"
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-08-17"
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,33 @@ 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
+ result |= 1
37
+ if @config['fail_fast'] && result
38
+ return 1
35
39
  end
36
40
  end
37
41
  end
@@ -46,13 +50,10 @@ class AllImages::App
46
50
  it = interactive ? ' -it ' : ' '
47
51
  if sh "docker run --name all_images#{it}-v `pwd`:/work '#{tag}' sh -c '#{script}'"
48
52
  puts green('SUCCESS')
53
+ return 0
49
54
  else
50
55
  puts red('FAILURE')
51
- if @config['fail_fast']
52
- return 1
53
- else
54
- result |= 1
55
- end
56
+ return 1
56
57
  end
57
58
  ensure
58
59
  sh 'docker rm -f all_images >/dev/null'
@@ -70,7 +71,7 @@ class AllImages::App
70
71
  when 'debug'
71
72
  @selected = @args.shift or fail "Usage: #{File.basename($0)} #{command} IMAGE"
72
73
  'debug_selected'
73
- when 'help'
74
+ else
74
75
  'help'
75
76
  end
76
77
  end
@@ -1,6 +1,6 @@
1
1
  module AllImages
2
2
  # AllImages version
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.4'
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.4
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-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar