donce 0.0.5 → 0.2.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/.0pdd.yml +2 -19
- data/.github/workflows/actionlint.yml +3 -20
- data/.github/workflows/codecov.yml +4 -20
- data/.github/workflows/copyrights.yml +3 -19
- data/.github/workflows/markdown-lint.yml +3 -19
- data/.github/workflows/pdd.yml +3 -19
- data/.github/workflows/rake.yml +4 -20
- data/.github/workflows/reuse.yml +19 -0
- data/.github/workflows/xcop.yml +3 -19
- data/.github/workflows/yamllint.yml +3 -19
- data/.gitignore +7 -5
- data/.rubocop.yml +4 -20
- data/.rultor.yml +4 -20
- data/.yamllint.yml +2 -19
- data/Gemfile +13 -31
- data/Gemfile.lock +45 -157
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +22 -4
- data/REUSE.toml +34 -0
- data/Rakefile +2 -24
- data/donce.gemspec +7 -24
- data/lib/donce.rb +24 -30
- data/test/test__helper.rb +20 -24
- data/test/test_donce.rb +39 -22
- metadata +19 -20
- data/.simplecov +0 -39
data/test/test_donce.rb
CHANGED
@@ -1,32 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2025 Yegor Bugayenko
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
13
|
-
# copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
# SOFTWARE.
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
22
5
|
|
23
|
-
require '
|
6
|
+
require 'logger'
|
24
7
|
require 'loog'
|
8
|
+
require 'minitest/autorun'
|
25
9
|
require_relative '../lib/donce'
|
26
10
|
|
27
11
|
# Test.
|
28
12
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
-
# Copyright:: Copyright (c) 2025 Yegor Bugayenko
|
13
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
30
14
|
# License:: MIT
|
31
15
|
class TestDonce < Minitest::Test
|
32
16
|
def test_runs_simple_echo
|
@@ -34,8 +18,22 @@ class TestDonce < Minitest::Test
|
|
34
18
|
assert_equal("hello\n", stdout)
|
35
19
|
end
|
36
20
|
|
21
|
+
def test_prints_build_args
|
22
|
+
stdout = donce(
|
23
|
+
dockerfile: [
|
24
|
+
'FROM ubuntu',
|
25
|
+
'ARG FOO=what?',
|
26
|
+
'RUN echo $FOO > /tmp/foo',
|
27
|
+
'CMD cat /tmp/foo'
|
28
|
+
],
|
29
|
+
build_args: { 'FOO' => 'hello' },
|
30
|
+
log: Loog::NULL
|
31
|
+
)
|
32
|
+
assert_equal("hello\n", stdout)
|
33
|
+
end
|
34
|
+
|
37
35
|
def test_runs_existing_image
|
38
|
-
stdout = donce(image: 'ubuntu:
|
36
|
+
stdout = donce(image: 'ubuntu:22.04', command: 'echo hello', log: Loog::NULL)
|
39
37
|
assert_equal("hello\n", stdout)
|
40
38
|
end
|
41
39
|
|
@@ -47,11 +45,30 @@ class TestDonce < Minitest::Test
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
48
|
+
def test_copies_resources
|
49
|
+
content = 'hello!'
|
50
|
+
Dir.mktmpdir do |home|
|
51
|
+
File.write(File.join(home, 'test.txt'), content)
|
52
|
+
File.write(
|
53
|
+
File.join(home, 'Dockerfile'),
|
54
|
+
[
|
55
|
+
'FROM ubuntu',
|
56
|
+
'WORKDIR /foo',
|
57
|
+
'COPY test.txt .',
|
58
|
+
'CMD cat test.txt'
|
59
|
+
].join("\n")
|
60
|
+
)
|
61
|
+
stdout = donce(home:, log: Loog::NULL)
|
62
|
+
assert_equal(content, stdout)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
50
66
|
def test_runs_daemon
|
51
67
|
seen = false
|
52
68
|
donce(dockerfile: "FROM ubuntu\nCMD while true; do sleep 1; echo sleeping; done", log: Loog::NULL) do |id|
|
53
69
|
seen = true
|
54
70
|
refute_empty(id)
|
71
|
+
sleep 1
|
55
72
|
end
|
56
73
|
assert(seen)
|
57
74
|
end
|
metadata
CHANGED
@@ -1,62 +1,61 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: donce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: backtrace
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
18
|
+
version: '0.3'
|
20
19
|
type: :runtime
|
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: '0'
|
25
|
+
version: '0.3'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: os
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
|
-
- - "
|
30
|
+
- - "~>"
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
32
|
+
version: '1.1'
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
|
-
- - "
|
37
|
+
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
39
|
+
version: '1.1'
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
41
|
name: qbash
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
|
-
- - "
|
44
|
+
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
46
|
+
version: '0.3'
|
48
47
|
type: :runtime
|
49
48
|
prerelease: false
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
|
-
- - "
|
51
|
+
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
53
|
+
version: '0.3'
|
55
54
|
description: A one-function library that helps you build a temporary Docker image,
|
56
55
|
run a temporary Docker container from it, and then clean up, deleting them both.
|
57
56
|
This may be helpful for automated testing, when you test how your code might behave
|
58
57
|
in an isolated environment. This may also be helpful when you need a custom Docker
|
59
|
-
image with a tool inside, but Testcontainers don' have such an image.
|
58
|
+
image with a tool inside, but Testcontainers don't have such an image.
|
60
59
|
email: yegor256@gmail.com
|
61
60
|
executables: []
|
62
61
|
extensions: []
|
@@ -72,18 +71,20 @@ files:
|
|
72
71
|
- ".github/workflows/markdown-lint.yml"
|
73
72
|
- ".github/workflows/pdd.yml"
|
74
73
|
- ".github/workflows/rake.yml"
|
74
|
+
- ".github/workflows/reuse.yml"
|
75
75
|
- ".github/workflows/xcop.yml"
|
76
76
|
- ".github/workflows/yamllint.yml"
|
77
77
|
- ".gitignore"
|
78
78
|
- ".pdd"
|
79
79
|
- ".rubocop.yml"
|
80
80
|
- ".rultor.yml"
|
81
|
-
- ".simplecov"
|
82
81
|
- ".yamllint.yml"
|
83
82
|
- Gemfile
|
84
83
|
- Gemfile.lock
|
85
84
|
- LICENSE.txt
|
85
|
+
- LICENSES/MIT.txt
|
86
86
|
- README.md
|
87
|
+
- REUSE.toml
|
87
88
|
- Rakefile
|
88
89
|
- donce.gemspec
|
89
90
|
- lib/donce.rb
|
@@ -95,7 +96,6 @@ licenses:
|
|
95
96
|
- MIT
|
96
97
|
metadata:
|
97
98
|
rubygems_mfa_required: 'true'
|
98
|
-
post_install_message:
|
99
99
|
rdoc_options:
|
100
100
|
- "--charset=UTF-8"
|
101
101
|
require_paths:
|
@@ -111,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
-
signing_key:
|
114
|
+
rubygems_version: 3.6.2
|
116
115
|
specification_version: 4
|
117
116
|
summary: Builds and starts temporary Docker containers
|
118
117
|
test_files: []
|
data/.simplecov
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2025 Yegor Bugayenko
|
5
|
-
#
|
6
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
-
# in the Software without restriction, including without limitation the rights
|
9
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
# copies of the Software, and to permit persons to whom the Software is
|
11
|
-
# furnished to do so, subject to the following conditions:
|
12
|
-
#
|
13
|
-
# The above copyright notice and this permission notice shall be included in all
|
14
|
-
# copies or substantial portions of the Software.
|
15
|
-
#
|
16
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
# SOFTWARE.
|
23
|
-
|
24
|
-
if Gem.win_platform?
|
25
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
26
|
-
SimpleCov::Formatter::HTMLFormatter
|
27
|
-
]
|
28
|
-
SimpleCov.start do
|
29
|
-
add_filter '/test/'
|
30
|
-
end
|
31
|
-
else
|
32
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
33
|
-
[SimpleCov::Formatter::HTMLFormatter]
|
34
|
-
)
|
35
|
-
SimpleCov.start do
|
36
|
-
add_filter '/test/'
|
37
|
-
minimum_coverage 20
|
38
|
-
end
|
39
|
-
end
|