elapsed 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 +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +32 -21
- data/README.md +10 -0
- data/Rakefile +1 -1
- data/elapsed.gemspec +2 -2
- data/lib/elapsed.rb +7 -3
- metadata +2 -22
- data/.0pdd.yml +0 -5
- data/.gitattributes +0 -7
- data/.github/workflows/actionlint.yml +0 -25
- data/.github/workflows/codecov.yml +0 -25
- data/.github/workflows/copyrights.yml +0 -19
- data/.github/workflows/markdown-lint.yml +0 -23
- data/.github/workflows/pdd.yml +0 -19
- data/.github/workflows/rake.yml +0 -28
- data/.github/workflows/reuse.yml +0 -19
- data/.github/workflows/typos.yml +0 -19
- data/.github/workflows/xcop.yml +0 -15
- data/.github/workflows/yamllint.yml +0 -19
- data/.gitignore +0 -12
- data/.pdd +0 -7
- data/.rubocop.yml +0 -30
- data/.rultor.yml +0 -28
- data/.simplecov +0 -24
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -31
- data/test/test_elapsed.rb +0 -101
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f377e3a999a15948173fbf78292c28103649fbd064de0b515726ab7eeb18b05c
|
|
4
|
+
data.tar.gz: 3eb7dc7128b7d95f95488a2fe432eda853f628245a10dbf6b4f36cbb4d3b5324
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f76f1974797b4f255ca3866da6bd493d0764592e69f7ffc4a7706b071dd322c6929ba0e652cf34070dce025f0090b68c249b238269d380924a399cc6a819d8d5
|
|
7
|
+
data.tar.gz: 1b299c8f3a9cb2453eff0c5db6d36b8bf5c5f506fe9cd2b7d602be2560c1171028e9e7fd2488b3e0e25107437ff4ff6cf2299a4529a7861a3bb9645c7d7ac349
|
data/Gemfile
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
source 'https://rubygems.org'
|
|
7
7
|
gemspec
|
|
8
8
|
|
|
9
|
-
gem 'minitest', '~>
|
|
9
|
+
gem 'minitest', '~>6.0', require: false
|
|
10
10
|
gem 'minitest-reporters', '~>1.7', require: false
|
|
11
11
|
gem 'rake', '~>13.2', require: false
|
|
12
|
+
gem 'rdoc', '~>6.0', require: false
|
|
12
13
|
gem 'rubocop', '~>1.69', require: false
|
|
13
14
|
gem 'rubocop-minitest', '~>0.38', require: false
|
|
14
15
|
gem 'rubocop-performance', '~>1.25', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -11,30 +11,40 @@ GEM
|
|
|
11
11
|
ansi (1.5.0)
|
|
12
12
|
ast (2.4.3)
|
|
13
13
|
builder (3.3.0)
|
|
14
|
+
date (3.5.1)
|
|
14
15
|
docile (1.4.1)
|
|
15
|
-
|
|
16
|
+
erb (6.0.1)
|
|
17
|
+
json (2.18.0)
|
|
16
18
|
language_server-protocol (3.17.0.5)
|
|
17
19
|
lint_roller (1.1.0)
|
|
18
20
|
logger (1.7.0)
|
|
19
21
|
loog (0.6.1)
|
|
20
22
|
logger (~> 1.0)
|
|
21
|
-
minitest (
|
|
23
|
+
minitest (6.0.0)
|
|
24
|
+
prism (~> 1.5)
|
|
22
25
|
minitest-reporters (1.7.1)
|
|
23
26
|
ansi
|
|
24
27
|
builder
|
|
25
28
|
minitest (>= 5.0)
|
|
26
29
|
ruby-progressbar
|
|
27
30
|
parallel (1.27.0)
|
|
28
|
-
parser (3.3.
|
|
31
|
+
parser (3.3.10.0)
|
|
29
32
|
ast (~> 2.4.1)
|
|
30
33
|
racc
|
|
31
|
-
prism (1.
|
|
34
|
+
prism (1.6.0)
|
|
35
|
+
psych (5.3.1)
|
|
36
|
+
date
|
|
37
|
+
stringio
|
|
32
38
|
racc (1.8.1)
|
|
33
39
|
rainbow (3.1.1)
|
|
34
|
-
rake (13.3.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
rake (13.3.1)
|
|
41
|
+
rdoc (6.17.0)
|
|
42
|
+
erb
|
|
43
|
+
psych (>= 4.0.0)
|
|
44
|
+
tsort
|
|
45
|
+
regexp_parser (2.11.3)
|
|
46
|
+
rexml (3.4.4)
|
|
47
|
+
rubocop (1.82.0)
|
|
38
48
|
json (~> 2.3)
|
|
39
49
|
language_server-protocol (~> 3.17.0.2)
|
|
40
50
|
lint_roller (~> 1.1.0)
|
|
@@ -42,21 +52,20 @@ GEM
|
|
|
42
52
|
parser (>= 3.3.0.2)
|
|
43
53
|
rainbow (>= 2.2.2, < 4.0)
|
|
44
54
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
45
|
-
rubocop-ast (>= 1.
|
|
55
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
46
56
|
ruby-progressbar (~> 1.7)
|
|
47
|
-
tsort (>= 0.2.0)
|
|
48
57
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
49
|
-
rubocop-ast (1.
|
|
58
|
+
rubocop-ast (1.48.0)
|
|
50
59
|
parser (>= 3.3.7.2)
|
|
51
60
|
prism (~> 1.4)
|
|
52
|
-
rubocop-minitest (0.38.
|
|
61
|
+
rubocop-minitest (0.38.2)
|
|
53
62
|
lint_roller (~> 1.1)
|
|
54
63
|
rubocop (>= 1.75.0, < 2.0)
|
|
55
64
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
56
|
-
rubocop-performance (1.
|
|
65
|
+
rubocop-performance (1.26.1)
|
|
57
66
|
lint_roller (~> 1.1)
|
|
58
67
|
rubocop (>= 1.75.0, < 2.0)
|
|
59
|
-
rubocop-ast (>= 1.
|
|
68
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
60
69
|
rubocop-rake (0.7.1)
|
|
61
70
|
lint_roller (~> 1.1)
|
|
62
71
|
rubocop (>= 1.72.1)
|
|
@@ -65,17 +74,18 @@ GEM
|
|
|
65
74
|
docile (~> 1.1)
|
|
66
75
|
simplecov-html (~> 0.11)
|
|
67
76
|
simplecov_json_formatter (~> 0.1)
|
|
68
|
-
simplecov-cobertura (3.
|
|
77
|
+
simplecov-cobertura (3.1.0)
|
|
69
78
|
rexml
|
|
70
79
|
simplecov (~> 0.19)
|
|
71
80
|
simplecov-html (0.13.2)
|
|
72
81
|
simplecov_json_formatter (0.1.4)
|
|
73
|
-
|
|
82
|
+
stringio (3.2.0)
|
|
83
|
+
tago (0.6.0)
|
|
74
84
|
tsort (0.2.0)
|
|
75
|
-
unicode-display_width (3.
|
|
76
|
-
unicode-emoji (~> 4.
|
|
77
|
-
unicode-emoji (4.0
|
|
78
|
-
yard (0.9.
|
|
85
|
+
unicode-display_width (3.2.0)
|
|
86
|
+
unicode-emoji (~> 4.1)
|
|
87
|
+
unicode-emoji (4.2.0)
|
|
88
|
+
yard (0.9.38)
|
|
79
89
|
|
|
80
90
|
PLATFORMS
|
|
81
91
|
aarch64-linux
|
|
@@ -89,9 +99,10 @@ PLATFORMS
|
|
|
89
99
|
|
|
90
100
|
DEPENDENCIES
|
|
91
101
|
elapsed!
|
|
92
|
-
minitest (~>
|
|
102
|
+
minitest (~> 6.0)
|
|
93
103
|
minitest-reporters (~> 1.7)
|
|
94
104
|
rake (~> 13.2)
|
|
105
|
+
rdoc (~> 6.0)
|
|
95
106
|
rubocop (~> 1.69)
|
|
96
107
|
rubocop-minitest (~> 0.38)
|
|
97
108
|
rubocop-performance (~> 1.25)
|
data/README.md
CHANGED
|
@@ -57,6 +57,16 @@ elapsed(Loog::VERBOSE, over: 0.5) do
|
|
|
57
57
|
end
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
You can change the level of logging
|
|
61
|
+
(use `Logger::INFO`, `Logger::DEBUG`, or `Logger::ERROR`), while
|
|
62
|
+
the default one is `DEBUG`:
|
|
63
|
+
|
|
64
|
+
```ruby
|
|
65
|
+
elapsed(Loog::VERBOSE, level: Logger::DEBUG) do
|
|
66
|
+
# The procedure
|
|
67
|
+
end
|
|
68
|
+
```
|
|
69
|
+
|
|
60
70
|
That's it.
|
|
61
71
|
|
|
62
72
|
## How to contribute
|
data/Rakefile
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
require 'rubygems'
|
|
7
7
|
require 'rake'
|
|
8
|
-
require 'rdoc'
|
|
9
8
|
require 'rake/clean'
|
|
10
9
|
|
|
11
10
|
def name
|
|
@@ -32,6 +31,7 @@ require 'yard'
|
|
|
32
31
|
desc 'Build Yard documentation'
|
|
33
32
|
YARD::Rake::YardocTask.new do |t|
|
|
34
33
|
t.files = ['lib/**/*.rb']
|
|
34
|
+
t.options = ['--fail-on-warning']
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
require 'rubocop/rake_task'
|
data/elapsed.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.2'
|
|
11
11
|
s.name = 'elapsed'
|
|
12
|
-
s.version = '0.2.
|
|
12
|
+
s.version = '0.2.1'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'A simple Ruby function to measure the time elapsed by the execution of a block'
|
|
15
15
|
s.description =
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
s.authors = ['Yegor Bugayenko']
|
|
19
19
|
s.email = 'yegor256@gmail.com'
|
|
20
20
|
s.homepage = 'https://github.com/yegor256/elapsed'
|
|
21
|
-
s.files = `git ls-files`.split($RS)
|
|
21
|
+
s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
|
|
22
22
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
23
23
|
s.rdoc_options = ['--charset=UTF-8']
|
|
24
24
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
data/lib/elapsed.rb
CHANGED
|
@@ -33,12 +33,16 @@ def elapsed(log = nil, good: 'Finished', level: Logger::DEBUG, bad: 'Failed', ov
|
|
|
33
33
|
m += " in #{start.ago}"
|
|
34
34
|
if log.nil?
|
|
35
35
|
puts m
|
|
36
|
-
elsif level == Logger::DEBUG
|
|
36
|
+
elsif level == Logger::DEBUG && log.respond_to?(:debug)
|
|
37
37
|
log.debug(m)
|
|
38
|
-
elsif level == Logger::INFO
|
|
38
|
+
elsif level == Logger::INFO && log.respond_to?(:info)
|
|
39
39
|
log.info(m)
|
|
40
|
-
|
|
40
|
+
elsif log.respond_to?(:warn)
|
|
41
41
|
log.warn(m)
|
|
42
|
+
elsif log.respond_to?(:puts)
|
|
43
|
+
log.puts(m)
|
|
44
|
+
else
|
|
45
|
+
raise "The log doesn't accept any logging requests"
|
|
42
46
|
end
|
|
43
47
|
end
|
|
44
48
|
begin
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: elapsed
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
@@ -46,23 +46,6 @@ extra_rdoc_files:
|
|
|
46
46
|
- LICENSE.txt
|
|
47
47
|
- README.md
|
|
48
48
|
files:
|
|
49
|
-
- ".0pdd.yml"
|
|
50
|
-
- ".gitattributes"
|
|
51
|
-
- ".github/workflows/actionlint.yml"
|
|
52
|
-
- ".github/workflows/codecov.yml"
|
|
53
|
-
- ".github/workflows/copyrights.yml"
|
|
54
|
-
- ".github/workflows/markdown-lint.yml"
|
|
55
|
-
- ".github/workflows/pdd.yml"
|
|
56
|
-
- ".github/workflows/rake.yml"
|
|
57
|
-
- ".github/workflows/reuse.yml"
|
|
58
|
-
- ".github/workflows/typos.yml"
|
|
59
|
-
- ".github/workflows/xcop.yml"
|
|
60
|
-
- ".github/workflows/yamllint.yml"
|
|
61
|
-
- ".gitignore"
|
|
62
|
-
- ".pdd"
|
|
63
|
-
- ".rubocop.yml"
|
|
64
|
-
- ".rultor.yml"
|
|
65
|
-
- ".simplecov"
|
|
66
49
|
- Gemfile
|
|
67
50
|
- Gemfile.lock
|
|
68
51
|
- LICENSE.txt
|
|
@@ -72,9 +55,6 @@ files:
|
|
|
72
55
|
- Rakefile
|
|
73
56
|
- elapsed.gemspec
|
|
74
57
|
- lib/elapsed.rb
|
|
75
|
-
- renovate.json
|
|
76
|
-
- test/test__helper.rb
|
|
77
|
-
- test/test_elapsed.rb
|
|
78
58
|
homepage: https://github.com/yegor256/elapsed
|
|
79
59
|
licenses:
|
|
80
60
|
- MIT
|
|
@@ -95,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
95
75
|
- !ruby/object:Gem::Version
|
|
96
76
|
version: '0'
|
|
97
77
|
requirements: []
|
|
98
|
-
rubygems_version: 3.6.
|
|
78
|
+
rubygems_version: 3.6.9
|
|
99
79
|
specification_version: 4
|
|
100
80
|
summary: A simple Ruby function to measure the time elapsed by the execution of a
|
|
101
81
|
block
|
data/.0pdd.yml
DELETED
data/.gitattributes
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: actionlint
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
actionlint:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- name: Download actionlint
|
|
20
|
-
id: get_actionlint
|
|
21
|
-
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
|
22
|
-
shell: bash
|
|
23
|
-
- name: Check workflow files
|
|
24
|
-
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
|
25
|
-
shell: bash
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: codecov
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
jobs:
|
|
11
|
-
codecov:
|
|
12
|
-
timeout-minutes: 15
|
|
13
|
-
runs-on: ubuntu-24.04
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
- uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
ruby-version: 3.3
|
|
19
|
-
bundler-cache: true
|
|
20
|
-
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
|
21
|
-
- run: bundle install --no-color
|
|
22
|
-
- run: bundle exec rake
|
|
23
|
-
- uses: codecov/codecov-action@v5
|
|
24
|
-
with:
|
|
25
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: copyrights
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
copyrights:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: yegor256/copyrights-action@0.0.12
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: markdown-lint
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
paths-ignore: ['paper/**', 'sandbox/**']
|
|
14
|
-
concurrency:
|
|
15
|
-
group: markdown-lint-${{ github.ref }}
|
|
16
|
-
cancel-in-progress: true
|
|
17
|
-
jobs:
|
|
18
|
-
markdown-lint:
|
|
19
|
-
timeout-minutes: 15
|
|
20
|
-
runs-on: ubuntu-24.04
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v4
|
|
23
|
-
- uses: DavidAnson/markdownlint-cli2-action@v20.0.0
|
data/.github/workflows/pdd.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: pdd
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
pdd:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: volodya-lombrozo/pdd-action@master
|
data/.github/workflows/rake.yml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: rake
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
rake:
|
|
15
|
-
strategy:
|
|
16
|
-
matrix:
|
|
17
|
-
os: [ubuntu-24.04, macos-15, windows-2022]
|
|
18
|
-
ruby: [3.3]
|
|
19
|
-
runs-on: ${{ matrix.os }}
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v4
|
|
22
|
-
- uses: ruby/setup-ruby@v1
|
|
23
|
-
with:
|
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
|
25
|
-
bundler-cache: true
|
|
26
|
-
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
|
27
|
-
- run: bundle install --no-color
|
|
28
|
-
- run: bundle exec rake
|
data/.github/workflows/reuse.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: reuse
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
reuse:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: fsfe/reuse-action@v5
|
data/.github/workflows/typos.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: typos
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
typos:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: crate-ci/typos@v1.34.0
|
data/.github/workflows/xcop.yml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: xcop
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
pull_request:
|
|
9
|
-
jobs:
|
|
10
|
-
xcop:
|
|
11
|
-
timeout-minutes: 15
|
|
12
|
-
runs-on: ubuntu-24.04
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
- uses: g4s8/xcop-action@master
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: yamllint
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
yamllint:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: ibiqlik/action-yamllint@v3
|
data/.gitignore
DELETED
data/.pdd
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
AllCops:
|
|
5
|
-
Exclude:
|
|
6
|
-
- 'bin/**/*'
|
|
7
|
-
- 'assets/**/*'
|
|
8
|
-
- 'vendor/**/*'
|
|
9
|
-
DisplayCopNames: true
|
|
10
|
-
TargetRubyVersion: 3.2
|
|
11
|
-
SuggestExtensions: false
|
|
12
|
-
NewCops: enable
|
|
13
|
-
plugins:
|
|
14
|
-
- rubocop-rake
|
|
15
|
-
- rubocop-minitest
|
|
16
|
-
- rubocop-performance
|
|
17
|
-
Minitest/EmptyLineBeforeAssertionMethods:
|
|
18
|
-
Enabled: false
|
|
19
|
-
Layout/EndOfLine:
|
|
20
|
-
EnforcedStyle: lf
|
|
21
|
-
Style/EvalWithLocation:
|
|
22
|
-
Enabled: false
|
|
23
|
-
Metrics/MethodLength:
|
|
24
|
-
Enabled: false
|
|
25
|
-
Metrics/AbcSize:
|
|
26
|
-
Enabled: false
|
|
27
|
-
Metrics/CyclomaticComplexity:
|
|
28
|
-
Enabled: false
|
|
29
|
-
Metrics/PerceivedComplexity:
|
|
30
|
-
Enabled: false
|
data/.rultor.yml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
docker:
|
|
6
|
-
image: yegor256/ruby
|
|
7
|
-
assets:
|
|
8
|
-
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
9
|
-
install: |
|
|
10
|
-
pdd -f /dev/null
|
|
11
|
-
bundle install --no-color
|
|
12
|
-
release:
|
|
13
|
-
pre: false
|
|
14
|
-
script: |-
|
|
15
|
-
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
|
16
|
-
bundle exec rake
|
|
17
|
-
rm -rf *.gem
|
|
18
|
-
sed -i "s/0\.0\.0/${tag}/g" elapsed.gemspec
|
|
19
|
-
git add elapsed.gemspec
|
|
20
|
-
sed -i "s/0\.0\.0/${tag}/g" lib/elapsed.rb
|
|
21
|
-
git add lib/elapsed.rb
|
|
22
|
-
git commit -m "version set to ${tag}"
|
|
23
|
-
gem build elapsed.gemspec
|
|
24
|
-
chmod 0600 ../rubygems.yml
|
|
25
|
-
gem push *.gem --config-file ../rubygems.yml
|
|
26
|
-
merge:
|
|
27
|
-
script: |-
|
|
28
|
-
bundle exec rake
|
data/.simplecov
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
5
|
-
# SPDX-License-Identifier: MIT
|
|
6
|
-
|
|
7
|
-
if Gem.win_platform?
|
|
8
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|
9
|
-
SimpleCov::Formatter::HTMLFormatter
|
|
10
|
-
]
|
|
11
|
-
SimpleCov.start do
|
|
12
|
-
add_filter '/test/'
|
|
13
|
-
add_filter '/features/'
|
|
14
|
-
end
|
|
15
|
-
else
|
|
16
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
|
17
|
-
[SimpleCov::Formatter::HTMLFormatter]
|
|
18
|
-
)
|
|
19
|
-
SimpleCov.start do
|
|
20
|
-
add_filter '/test/'
|
|
21
|
-
add_filter '/features/'
|
|
22
|
-
minimum_coverage 20
|
|
23
|
-
end
|
|
24
|
-
end
|
data/renovate.json
DELETED
data/test/test__helper.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
$stdout.sync = true
|
|
7
|
-
|
|
8
|
-
require 'simplecov'
|
|
9
|
-
require 'simplecov-cobertura'
|
|
10
|
-
unless SimpleCov.running
|
|
11
|
-
SimpleCov.command_name('test')
|
|
12
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
|
13
|
-
[
|
|
14
|
-
SimpleCov::Formatter::HTMLFormatter,
|
|
15
|
-
SimpleCov::Formatter::CoberturaFormatter
|
|
16
|
-
]
|
|
17
|
-
)
|
|
18
|
-
SimpleCov.minimum_coverage 100
|
|
19
|
-
SimpleCov.minimum_coverage_by_file 100
|
|
20
|
-
SimpleCov.start do
|
|
21
|
-
add_filter 'test/'
|
|
22
|
-
add_filter 'vendor/'
|
|
23
|
-
add_filter 'target/'
|
|
24
|
-
track_files 'lib/**/*.rb'
|
|
25
|
-
track_files '*.rb'
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
require 'minitest/autorun'
|
|
30
|
-
require 'minitest/reporters'
|
|
31
|
-
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
|
data/test/test_elapsed.rb
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require 'loog'
|
|
7
|
-
require_relative 'test__helper'
|
|
8
|
-
require_relative '../lib/elapsed'
|
|
9
|
-
|
|
10
|
-
# Test.
|
|
11
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
12
|
-
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
13
|
-
# License:: MIT
|
|
14
|
-
class TestElapsed < Minitest::Test
|
|
15
|
-
def test_simple
|
|
16
|
-
loog = Loog::Buffer.new
|
|
17
|
-
r =
|
|
18
|
-
elapsed(loog, good: 'Everything was good') do
|
|
19
|
-
4 + 5
|
|
20
|
-
end
|
|
21
|
-
assert_equal(9, r)
|
|
22
|
-
assert_includes(loog.to_s, 'was good')
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_with_failure
|
|
26
|
-
loog = Loog::Buffer.new
|
|
27
|
-
assert_raises(StandardError) do
|
|
28
|
-
elapsed(loog, bad: 'Failed miserably') do
|
|
29
|
-
raise 'oops'
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def test_with_throw
|
|
35
|
-
loog = Loog::Buffer.new
|
|
36
|
-
elapsed(loog) do
|
|
37
|
-
throw :'Perfectly works'
|
|
38
|
-
end
|
|
39
|
-
assert_includes(loog.to_s, 'works')
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_to_stdout
|
|
43
|
-
elapsed do
|
|
44
|
-
4 + 5
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def test_with_over_threshold_reports
|
|
49
|
-
loog = Loog::Buffer.new
|
|
50
|
-
elapsed(loog, over: 0.001) do
|
|
51
|
-
sleep(0.01)
|
|
52
|
-
end
|
|
53
|
-
assert_includes(loog.to_s, 'Finished')
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def test_with_over_threshold_does_not_report
|
|
57
|
-
loog = Loog::Buffer.new
|
|
58
|
-
elapsed(loog, over: 1.0) do
|
|
59
|
-
4 + 5
|
|
60
|
-
end
|
|
61
|
-
assert_equal('', loog.to_s)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def test_with_over_threshold_on_error_reports
|
|
65
|
-
loog = Loog::Buffer.new
|
|
66
|
-
assert_raises(StandardError) do
|
|
67
|
-
elapsed(loog, over: 0.001, bad: 'Error occurred') do
|
|
68
|
-
sleep(0.01)
|
|
69
|
-
raise 'error'
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
assert_includes(loog.to_s, 'Error occurred')
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def test_with_over_threshold_on_error_does_not_report
|
|
76
|
-
loog = Loog::Buffer.new
|
|
77
|
-
assert_raises(StandardError) do
|
|
78
|
-
elapsed(loog, over: 1.0, bad: 'Error occurred') do
|
|
79
|
-
raise 'error'
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
assert_equal('', loog.to_s)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def test_with_over_threshold_on_throw_reports
|
|
86
|
-
loog = Loog::Buffer.new
|
|
87
|
-
elapsed(loog, over: 0.001) do
|
|
88
|
-
sleep(0.01)
|
|
89
|
-
throw :done
|
|
90
|
-
end
|
|
91
|
-
assert_includes(loog.to_s, 'done')
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def test_with_over_threshold_on_throw_does_not_report
|
|
95
|
-
loog = Loog::Buffer.new
|
|
96
|
-
elapsed(loog, over: 1.0) do
|
|
97
|
-
throw :done
|
|
98
|
-
end
|
|
99
|
-
assert_equal('', loog.to_s)
|
|
100
|
-
end
|
|
101
|
-
end
|