donce 0.2.2 → 0.2.4

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/donce.gemspec +1 -1
  4. data/lib/donce.rb +4 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff61e01863f8590b3541ca6edecbf96c4a0ee9d5fe28fbe8e30b4a001c578101
4
- data.tar.gz: 800c5ae24c1dd36a9484ec800b6c40217b9491e61b1d89f8d170faf1e4d58471
3
+ metadata.gz: 10994df2603c441abf85b35d3e1b9d1eac3b5c1f93efa4ad6c7ea5f39f98fb81
4
+ data.tar.gz: d21c6854f49ed90b80676f0590911685df55d4e8b54b33303b34a2b7567c4750
5
5
  SHA512:
6
- metadata.gz: b7164f6f5372ff0a0fd0fff126f11d48e7fd1db042404316fa5d430113a2cd8564a249ef7c6da02a489c627b218ab224cb0d0e4174f5cde3d7ef575945f7d607
7
- data.tar.gz: 62e270b7eeee5e3e857c2ee64cdbf7c5aa9fd476ca6a7a0f1d3d011597414d2448a840ea2e0802d672a2197e9c113d670c4ea41135b3024d48dcf1150fb9aaf5
6
+ metadata.gz: a8c9b007ad103b1c5eb705c678ac68e17b78344f8cc745ec7722e3b6eefd7faca116c3678527ef670d8f5e3b80a182a1afde82e2c628f91dd1e2ea96aeb79287
7
+ data.tar.gz: 4d32a5c588e4cc03c12692caeb3debddc493f63fa7cab8f6e92c1ea5e41cd05930e7cec56a242fa606d29d93c6bd7beddfc9caf8baa62a1e68682d5c56d0f5cf
data/.rubocop.yml CHANGED
@@ -14,6 +14,8 @@ plugins:
14
14
  - rubocop-minitest
15
15
  - rubocop-performance
16
16
  - rubocop-rake
17
+ Metrics/ModuleLength:
18
+ Max: 200
17
19
  Minitest/EmptyLineBeforeAssertionMethods:
18
20
  Enabled: false
19
21
  Gemspec/RequiredRubyVersion:
data/donce.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
10
  s.required_ruby_version = '>=3.0'
11
11
  s.name = 'donce'
12
- s.version = '0.2.2'
12
+ s.version = '0.2.4'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Builds and starts temporary Docker containers'
15
15
  s.description =
data/lib/donce.rb CHANGED
@@ -81,7 +81,7 @@ module Kernel
81
81
  raise 'The "env" is nil' if env.nil?
82
82
  raise 'The "env" must be a Hash' unless env.is_a?(Hash)
83
83
  raise 'The "command" is nil' if command.nil?
84
- raise 'The "command" must be a String' unless command.is_a?(String)
84
+ raise 'The "command" must be a String or an Array' unless command.is_a?(String) || command.is_a?(Array)
85
85
  raise 'The "timeout" is nil' if timeout.nil?
86
86
  raise 'The "timeout" must be a number' unless timeout.is_a?(Integer) || timeout.is_a?(Float)
87
87
  raise 'The "ports" is nil' if ports.nil?
@@ -89,6 +89,7 @@ module Kernel
89
89
  raise 'The "build_args" is nil' if build_args.nil?
90
90
  raise 'The "build_args" must be a Hash' unless build_args.is_a?(Hash)
91
91
  docker = ENV['DONCE_SUDO'] ? 'sudo docker' : 'docker'
92
+ command = command.join(' ') if command.is_a?(Array)
92
93
  img =
93
94
  if image
94
95
  image
@@ -118,12 +119,12 @@ module Kernel
118
119
  docker, 'run',
119
120
  ('--detach' if block_given?),
120
121
  '--name', Shellwords.escape(container),
121
- ("--add-host #{donce_host}:host-gateway" if OS.linux?),
122
+ ("--add-host #{donce_host}:host-gateway" unless OS.linux?),
122
123
  args,
123
124
  env.map { |k, v| "--env #{Shellwords.escape("#{k}=#{v}")}" }.join(' '),
124
125
  ports.map { |k, v| "--publish #{Shellwords.escape("#{k}:#{v}")}" }.join(' '),
125
126
  volumes.map { |k, v| "--volume #{Shellwords.escape("#{k}:#{v}")}" }.join(' '),
126
- ("--user=#{Shellwords.escape("#{Process.uid}:#{Process.gid}")}" if root),
127
+ ("--user=#{Shellwords.escape("#{Process.uid}:#{Process.gid}")}" unless root),
127
128
  Shellwords.escape(img),
128
129
  command
129
130
  ].compact.join(' ')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: donce
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
  - Yegor Bugayenko
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-22 00:00:00.000000000 Z
10
+ date: 2025-04-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: backtrace