donce 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09901a711fba51137272827d67c175803769b4e3c019771c283d596d1d54b27a'
4
- data.tar.gz: 59de5a9b21733ee965595d2ea500dcf5a2c55e32fdf6dd732871ae30d452de0d
3
+ metadata.gz: 0d8edc10a85c0d3eaa7fe743be71fae12afdb07925c50f2ca63c064593e18860
4
+ data.tar.gz: '086f4fa0751fa6568d3a590d4b6b5d176385e7c9246d6f25452ce89f0e600646'
5
5
  SHA512:
6
- metadata.gz: 54cd3837888a7dc868381c839220acf271e5e823214838cfd59804c9fd4dfcd648f8748ec327669c4b78661a5ecb257c05c0117e537f353c9230d826e6d391ba
7
- data.tar.gz: 5e1639092860793750a3066167898cee12b53116e139e33bb9db8f4685ca2911bd9de4261940599bb9c38f6e6c289bee9637af78c10bfeb5e4e2ac6bc0e3b550
6
+ metadata.gz: 13a683fdc2f394bb7af1fd04bb309dbc6d21c4be5a128f4fa5457eb50f642535b9f1c3096ac88026cf37d078be3391a561d3c5e586d16204688aa4b2bd665d15
7
+ data.tar.gz: a038ee334662de346c7c4da876ced657cede85e82368dfb618a23b401b9525f07e3515804205d98fd7e0060cf1a1754320d4e932ba3591a259d90a08f5049500
data/.rubocop.yml CHANGED
@@ -30,4 +30,3 @@ Metrics/PerceivedComplexity:
30
30
  Enabled: false
31
31
  Layout/EmptyLineAfterGuardClause:
32
32
  Enabled: false
33
- require: []
data/Gemfile CHANGED
@@ -15,7 +15,6 @@ gem 'rubocop', '~>1.75', require: false
15
15
  gem 'rubocop-minitest', '>0', require: false
16
16
  gem 'rubocop-performance', '>0', require: false
17
17
  gem 'rubocop-rake', '>0', require: false
18
- gem 'rubocop-rspec', '>0', require: false
19
18
  gem 'simplecov', '~>0.22', require: false
20
19
  gem 'simplecov-cobertura', '~>2.1', require: false
21
20
  gem 'yard', '~>0.9', require: false
data/Gemfile.lock CHANGED
@@ -30,8 +30,8 @@ GEM
30
30
  minitest-retry (0.2.5)
31
31
  minitest (>= 5.0)
32
32
  os (1.1.4)
33
- parallel (1.26.3)
34
- parser (3.3.7.4)
33
+ parallel (1.27.0)
34
+ parser (3.3.8.0)
35
35
  ast (~> 2.4.1)
36
36
  racc
37
37
  prism (1.4.0)
@@ -45,7 +45,7 @@ GEM
45
45
  rake (13.2.1)
46
46
  regexp_parser (2.10.0)
47
47
  rexml (3.4.1)
48
- rubocop (1.75.2)
48
+ rubocop (1.75.3)
49
49
  json (~> 2.3)
50
50
  language_server-protocol (~> 3.17.0.2)
51
51
  lint_roller (~> 1.1.0)
@@ -56,7 +56,7 @@ GEM
56
56
  rubocop-ast (>= 1.44.0, < 2.0)
57
57
  ruby-progressbar (~> 1.7)
58
58
  unicode-display_width (>= 2.4.0, < 4.0)
59
- rubocop-ast (1.44.0)
59
+ rubocop-ast (1.44.1)
60
60
  parser (>= 3.3.7.2)
61
61
  prism (~> 1.4)
62
62
  rubocop-minitest (0.38.0)
@@ -70,9 +70,6 @@ GEM
70
70
  rubocop-rake (0.7.1)
71
71
  lint_roller (~> 1.1)
72
72
  rubocop (>= 1.72.1)
73
- rubocop-rspec (3.5.0)
74
- lint_roller (~> 1.1)
75
- rubocop (~> 1.72, >= 1.72.1)
76
73
  ruby-progressbar (1.13.0)
77
74
  simplecov (0.22.0)
78
75
  docile (~> 1.1)
@@ -106,7 +103,6 @@ DEPENDENCIES
106
103
  rubocop-minitest (> 0)
107
104
  rubocop-performance (> 0)
108
105
  rubocop-rake (> 0)
109
- rubocop-rspec (> 0)
110
106
  simplecov (~> 0.22)
111
107
  simplecov-cobertura (~> 2.1)
112
108
  yard (~> 0.9)
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # Builds Docker image, runs it, and kills
2
2
 
3
- [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/donce)](http://www.rultor.com/p/yegor256/donce)
3
+ [![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/donce)](https://www.rultor.com/p/yegor256/donce)
4
4
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
5
5
 
6
6
  [![rake](https://github.com/yegor256/donce/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/donce/actions/workflows/rake.yml)
7
- [![PDD status](http://www.0pdd.com/svg?name=yegor256/donce)](http://www.0pdd.com/p?name=yegor256/donce)
8
- [![Gem Version](https://badge.fury.io/rb/donce.svg)](http://badge.fury.io/rb/donce)
7
+ [![PDD status](https://www.0pdd.com/svg?name=yegor256/donce)](https://www.0pdd.com/p?name=yegor256/donce)
8
+ [![Gem Version](https://badge.fury.io/rb/donce.svg)](https://badge.fury.io/rb/donce)
9
9
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/donce.svg)](https://codecov.io/github/yegor256/donce?branch=master)
10
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/donce/master/frames)
10
+ [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/yegor256/donce/master/frames)
11
11
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/donce)](https://hitsofcode.com/view/github/yegor256/donce)
12
12
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/donce/blob/master/LICENSE.txt)
13
13
 
@@ -42,18 +42,18 @@ end
42
42
 
43
43
  Here's a list of the available parameters for `donce`:
44
44
 
45
- - `dockerfile`: Content of the Dockerfile (string or array of strings)
46
- - `home`: Directory with Dockerfile and all other necessary files
47
- - `image`: Name of a Docker image to use (e.g. "ubuntu:22.04")
48
- - `log`: Logging destination (defaults to $stdout)
49
- - `args`: Extra arguments for the docker command
50
- - `env`: Environment variables mapping for the container
51
- - `volumes`: Local to container volumes mapping
52
- - `ports`: Local to container port mapping
53
- - `build_args`: Arguments for docker build (--build-arg)
54
- - `root`: Let user inside the container be "root" (default: false)
55
- - `command`: The command to execute in the container
56
- - `timeout`: Maximum seconds to spend on each docker call (default: 10)
45
+ * `dockerfile`: Content of the Dockerfile (string or array of strings)
46
+ * `home`: Directory with Dockerfile and all other necessary files
47
+ * `image`: Name of a Docker image to use (e.g. "ubuntu:22.04")
48
+ * `log`: Logging destination (defaults to $stdout)
49
+ * `args`: Extra arguments for the docker command
50
+ * `env`: Environment variables mapping for the container
51
+ * `volumes`: Local to container volumes mapping
52
+ * `ports`: Local to container port mapping
53
+ * `build_args`: Arguments for docker build (--build-arg)
54
+ * `root`: Let user inside the container be "root" (default: false)
55
+ * `command`: The command to execute in the container
56
+ * `timeout`: Maximum seconds to spend on each docker call (default: 10)
57
57
 
58
58
  The function `donce_host()` returns the hostname of the host machine that
59
59
  can be used from within the container.
data/Rakefile CHANGED
@@ -37,5 +37,4 @@ require 'rubocop/rake_task'
37
37
  desc 'Run RuboCop on all directories'
38
38
  RuboCop::RakeTask.new(:rubocop) do |task|
39
39
  task.fail_on_error = true
40
- task.requires << 'rubocop-rspec'
41
40
  end
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.0'
12
+ s.version = '0.2.1'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Builds and starts temporary Docker containers'
15
15
  s.description =
data/lib/donce.rb CHANGED
@@ -82,7 +82,7 @@ module Kernel
82
82
  a = [
83
83
  "--tag #{i}",
84
84
  build_args.map { |k, v| "--build-arg #{Shellwords.escape("#{k}=#{v}")}" }.join(' ')
85
- ].join(' ')
85
+ ].compact.join(' ')
86
86
  if dockerfile
87
87
  Dir.mktmpdir do |tmp|
88
88
  dockerfile = dockerfile.join("\n") if dockerfile.is_a?(Array)
@@ -100,20 +100,20 @@ module Kernel
100
100
  begin
101
101
  stdout = nil
102
102
  code = 0
103
+ cmd = [
104
+ docker, 'run',
105
+ ('--detach' if block_given?),
106
+ '--name', Shellwords.escape(container),
107
+ ("--add-host #{donce_host}:host-gateway" if OS.linux?),
108
+ args,
109
+ env.map { |k, v| "--env #{Shellwords.escape("#{k}=#{v}")}" }.join(' '),
110
+ ports.map { |k, v| "--publish #{Shellwords.escape("#{k}:#{v}")}" }.join(' '),
111
+ volumes.map { |k, v| "--volume #{Shellwords.escape("#{k}:#{v}")}" }.join(' '),
112
+ ("--user=#{Shellwords.escape("#{Process.uid}:#{Process.gid}")}" if root),
113
+ Shellwords.escape(img),
114
+ command
115
+ ].compact.join(' ')
103
116
  begin
104
- cmd = [
105
- docker, 'run',
106
- block_given? ? '--detach' : nil,
107
- '--name', Shellwords.escape(container),
108
- OS.linux? ? nil : "--add-host #{donce_host}:host-gateway",
109
- args,
110
- env.map { |k, v| "--env #{Shellwords.escape("#{k}=#{v}")}" }.join(' '),
111
- ports.map { |k, v| "--publish #{Shellwords.escape("#{k}:#{v}")}" }.join(' '),
112
- volumes.map { |k, v| "--volume #{Shellwords.escape("#{k}:#{v}")}" }.join(' '),
113
- root ? nil : "--user=#{Shellwords.escape("#{Process.uid}:#{Process.gid}")}",
114
- Shellwords.escape(img),
115
- command
116
- ].compact.join(' ')
117
117
  stdout, code =
118
118
  Timeout.timeout(timeout) do
119
119
  qbash(
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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-07 00:00:00.000000000 Z
10
+ date: 2025-04-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: backtrace