always 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/Gemfile +12 -27
- data/Gemfile.lock +58 -146
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +17 -11
- data/REUSE.toml +34 -0
- data/Rakefile +3 -31
- data/always.gemspec +6 -23
- data/lib/always.rb +40 -39
- metadata +7 -26
- data/.0pdd.yml +0 -22
- data/.gitattributes +0 -7
- data/.github/workflows/actionlint.yml +0 -41
- data/.github/workflows/codecov.yml +0 -39
- data/.github/workflows/license.yml +0 -57
- data/.github/workflows/markdown-lint.yml +0 -38
- data/.github/workflows/pdd.yml +0 -34
- data/.github/workflows/rake.yml +0 -44
- data/.github/workflows/xcop.yml +0 -30
- data/.github/workflows/yamllint.yml +0 -34
- data/.gitignore +0 -9
- data/.pdd +0 -7
- data/.rubocop.yml +0 -34
- data/.rultor.yml +0 -44
- data/.simplecov +0 -41
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -31
- data/test/test_always.rb +0 -106
data/.rultor.yml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
docker:
|
|
22
|
-
image: yegor256/rultor-image:1.23.1
|
|
23
|
-
assets:
|
|
24
|
-
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
25
|
-
install: |
|
|
26
|
-
pdd -f /dev/null
|
|
27
|
-
bundle install --no-color
|
|
28
|
-
release:
|
|
29
|
-
pre: false
|
|
30
|
-
script: |-
|
|
31
|
-
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
|
32
|
-
bundle exec rake
|
|
33
|
-
rm -rf *.gem
|
|
34
|
-
sed -i "s/0\.0\.0/${tag}/g" always.gemspec
|
|
35
|
-
git add always.gemspec
|
|
36
|
-
sed -i "s/0\.0\.0/${tag}/g" lib/always.rb
|
|
37
|
-
git add lib/always.rb
|
|
38
|
-
git commit -m "version set to ${tag}"
|
|
39
|
-
gem build always.gemspec
|
|
40
|
-
chmod 0600 ../rubygems.yml
|
|
41
|
-
gem push *.gem --config-file ../rubygems.yml
|
|
42
|
-
merge:
|
|
43
|
-
script: |-
|
|
44
|
-
bundle exec rake
|
data/.simplecov
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2024 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 NONINFRINGEMENT. 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
|
-
add_filter '/features/'
|
|
31
|
-
end
|
|
32
|
-
else
|
|
33
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
|
34
|
-
[SimpleCov::Formatter::HTMLFormatter]
|
|
35
|
-
)
|
|
36
|
-
SimpleCov.start do
|
|
37
|
-
add_filter '/test/'
|
|
38
|
-
add_filter '/features/'
|
|
39
|
-
minimum_coverage 20
|
|
40
|
-
end
|
|
41
|
-
end
|
data/renovate.json
DELETED
data/test/test__helper.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2024 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 NONINFRINGEMENT. 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.
|
|
22
|
-
|
|
23
|
-
$stdout.sync = true
|
|
24
|
-
|
|
25
|
-
require 'simplecov'
|
|
26
|
-
SimpleCov.start
|
|
27
|
-
|
|
28
|
-
require 'simplecov-cobertura'
|
|
29
|
-
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
|
30
|
-
|
|
31
|
-
require 'minitest/autorun'
|
data/test/test_always.rb
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2024 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 NONINFRINGEMENT. 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.
|
|
22
|
-
|
|
23
|
-
require 'minitest/autorun'
|
|
24
|
-
require_relative '../lib/always'
|
|
25
|
-
|
|
26
|
-
# Test.
|
|
27
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
28
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
|
29
|
-
# License:: MIT
|
|
30
|
-
class TestAlways < Minitest::Test
|
|
31
|
-
def test_simple
|
|
32
|
-
a = Always.new(3)
|
|
33
|
-
a.start do
|
|
34
|
-
raise 'intentionally'
|
|
35
|
-
end
|
|
36
|
-
a.stop
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def test_with_error
|
|
40
|
-
a = Always.new(5)
|
|
41
|
-
failures = 0
|
|
42
|
-
a.on_error { |_e| failures += 1 }.start do
|
|
43
|
-
raise 'intentionally'
|
|
44
|
-
end
|
|
45
|
-
sleep(0.1)
|
|
46
|
-
a.stop
|
|
47
|
-
assert(failures.positive?)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def test_read_backtraces
|
|
51
|
-
max = 5
|
|
52
|
-
a = Always.new(5, max_backtraces: max)
|
|
53
|
-
failures = 0
|
|
54
|
-
a.on_error { |_e| failures += 1 }.start do
|
|
55
|
-
raise 'intentionally'
|
|
56
|
-
end
|
|
57
|
-
sleep(0.1)
|
|
58
|
-
a.stop
|
|
59
|
-
assert(failures.positive?)
|
|
60
|
-
assert_equal(max, a.backtraces.size)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def test_converts_to_string
|
|
64
|
-
n = 6
|
|
65
|
-
a = Always.new(6)
|
|
66
|
-
a.start { sleep(0.01) }
|
|
67
|
-
sleep(0.1)
|
|
68
|
-
threads, cycles, errors = a.to_s.split('/')
|
|
69
|
-
assert_equal(n, threads.to_i)
|
|
70
|
-
assert(cycles.to_i.positive?)
|
|
71
|
-
assert(errors.to_i.zero?)
|
|
72
|
-
a.stop
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def test_stops_correctly
|
|
76
|
-
a = Always.new(6)
|
|
77
|
-
a.start { sleep(0.01) }
|
|
78
|
-
sleep(0.01)
|
|
79
|
-
a.stop
|
|
80
|
-
assert_equal('0/0/0', a.to_s)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def test_with_counter
|
|
84
|
-
a = Always.new(1)
|
|
85
|
-
done = 0
|
|
86
|
-
a.start do
|
|
87
|
-
done += 1
|
|
88
|
-
end
|
|
89
|
-
sleep(0.1)
|
|
90
|
-
a.stop
|
|
91
|
-
assert(done.positive?)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def test_with_broken_syntax
|
|
95
|
-
a = Always.new(1)
|
|
96
|
-
failures = 0
|
|
97
|
-
a.on_error { |_e| failures += 1 }.start do
|
|
98
|
-
eval('broken$ruby$syntax')
|
|
99
|
-
end
|
|
100
|
-
sleep(0.1)
|
|
101
|
-
_, _, errors = a.to_s.split('/')
|
|
102
|
-
assert(!errors.to_i.zero?)
|
|
103
|
-
assert(!failures.zero?)
|
|
104
|
-
a.stop
|
|
105
|
-
end
|
|
106
|
-
end
|