elapsed 0.1.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 +3 -2
- data/Gemfile.lock +37 -24
- data/README.md +19 -0
- data/Rakefile +1 -1
- data/elapsed.gemspec +4 -4
- data/lib/elapsed.rb +12 -4
- metadata +10 -30
- 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 -11
- 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 -47
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,13 +6,14 @@
|
|
|
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
|
|
15
16
|
gem 'rubocop-rake', '~>0.7', require: false
|
|
16
17
|
gem 'simplecov', '~>0.22', require: false
|
|
17
|
-
gem 'simplecov-cobertura', '~>
|
|
18
|
+
gem 'simplecov-cobertura', '~>3.0', require: false
|
|
18
19
|
gem 'yard', '~>0.9', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -2,8 +2,8 @@ PATH
|
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
4
|
elapsed (0.0.0)
|
|
5
|
-
loog (
|
|
6
|
-
tago (
|
|
5
|
+
loog (~> 0.6)
|
|
6
|
+
tago (~> 0.1)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
@@ -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,20 +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
57
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
48
|
-
rubocop-ast (1.
|
|
58
|
+
rubocop-ast (1.48.0)
|
|
49
59
|
parser (>= 3.3.7.2)
|
|
50
60
|
prism (~> 1.4)
|
|
51
|
-
rubocop-minitest (0.38.
|
|
61
|
+
rubocop-minitest (0.38.2)
|
|
52
62
|
lint_roller (~> 1.1)
|
|
53
63
|
rubocop (>= 1.75.0, < 2.0)
|
|
54
64
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
55
|
-
rubocop-performance (1.
|
|
65
|
+
rubocop-performance (1.26.1)
|
|
56
66
|
lint_roller (~> 1.1)
|
|
57
67
|
rubocop (>= 1.75.0, < 2.0)
|
|
58
|
-
rubocop-ast (>= 1.
|
|
68
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
59
69
|
rubocop-rake (0.7.1)
|
|
60
70
|
lint_roller (~> 1.1)
|
|
61
71
|
rubocop (>= 1.72.1)
|
|
@@ -64,16 +74,18 @@ GEM
|
|
|
64
74
|
docile (~> 1.1)
|
|
65
75
|
simplecov-html (~> 0.11)
|
|
66
76
|
simplecov_json_formatter (~> 0.1)
|
|
67
|
-
simplecov-cobertura (
|
|
77
|
+
simplecov-cobertura (3.1.0)
|
|
68
78
|
rexml
|
|
69
79
|
simplecov (~> 0.19)
|
|
70
|
-
simplecov-html (0.13.
|
|
80
|
+
simplecov-html (0.13.2)
|
|
71
81
|
simplecov_json_formatter (0.1.4)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
unicode-
|
|
76
|
-
|
|
82
|
+
stringio (3.2.0)
|
|
83
|
+
tago (0.6.0)
|
|
84
|
+
tsort (0.2.0)
|
|
85
|
+
unicode-display_width (3.2.0)
|
|
86
|
+
unicode-emoji (~> 4.1)
|
|
87
|
+
unicode-emoji (4.2.0)
|
|
88
|
+
yard (0.9.38)
|
|
77
89
|
|
|
78
90
|
PLATFORMS
|
|
79
91
|
aarch64-linux
|
|
@@ -87,15 +99,16 @@ PLATFORMS
|
|
|
87
99
|
|
|
88
100
|
DEPENDENCIES
|
|
89
101
|
elapsed!
|
|
90
|
-
minitest (~>
|
|
102
|
+
minitest (~> 6.0)
|
|
91
103
|
minitest-reporters (~> 1.7)
|
|
92
104
|
rake (~> 13.2)
|
|
105
|
+
rdoc (~> 6.0)
|
|
93
106
|
rubocop (~> 1.69)
|
|
94
107
|
rubocop-minitest (~> 0.38)
|
|
95
108
|
rubocop-performance (~> 1.25)
|
|
96
109
|
rubocop-rake (~> 0.7)
|
|
97
110
|
simplecov (~> 0.22)
|
|
98
|
-
simplecov-cobertura (~>
|
|
111
|
+
simplecov-cobertura (~> 3.0)
|
|
99
112
|
yard (~> 0.9)
|
|
100
113
|
|
|
101
114
|
BUNDLED WITH
|
data/README.md
CHANGED
|
@@ -48,6 +48,25 @@ elapsed do
|
|
|
48
48
|
end
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
You can also filter out small durations using the `over:` parameter:
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
elapsed(Loog::VERBOSE, over: 0.5) do
|
|
55
|
+
# This message will only be logged if the block takes more than 0.5 seconds
|
|
56
|
+
run_something_that_might_be_fast
|
|
57
|
+
end
|
|
58
|
+
```
|
|
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
|
+
|
|
51
70
|
That's it.
|
|
52
71
|
|
|
53
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.1
|
|
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,11 +18,11 @@ 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']
|
|
25
|
-
s.add_dependency 'loog', '
|
|
26
|
-
s.add_dependency 'tago', '
|
|
25
|
+
s.add_dependency 'loog', '~>0.6'
|
|
26
|
+
s.add_dependency 'tago', '~>0.1'
|
|
27
27
|
s.metadata['rubygems_mfa_required'] = 'true'
|
|
28
28
|
end
|
data/lib/elapsed.rb
CHANGED
|
@@ -23,18 +23,26 @@ require 'tago'
|
|
|
23
23
|
# @param [String] good The message to print on success finish
|
|
24
24
|
# @param [String] bad The message to print on failure finish
|
|
25
25
|
# @param [Integer] level The level of logging to use
|
|
26
|
-
|
|
26
|
+
# @param [Float] over The minimum duration in seconds to report
|
|
27
|
+
def elapsed(log = nil, good: 'Finished', level: Logger::DEBUG, bad: 'Failed', over: 0)
|
|
27
28
|
start = Time.now
|
|
28
29
|
print_it = lambda do |m|
|
|
30
|
+
duration = Time.now - start
|
|
31
|
+
return if duration < over
|
|
32
|
+
|
|
29
33
|
m += " in #{start.ago}"
|
|
30
34
|
if log.nil?
|
|
31
35
|
puts m
|
|
32
|
-
elsif level == Logger::DEBUG
|
|
36
|
+
elsif level == Logger::DEBUG && log.respond_to?(:debug)
|
|
33
37
|
log.debug(m)
|
|
34
|
-
elsif level == Logger::INFO
|
|
38
|
+
elsif level == Logger::INFO && log.respond_to?(:info)
|
|
35
39
|
log.info(m)
|
|
36
|
-
|
|
40
|
+
elsif log.respond_to?(:warn)
|
|
37
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"
|
|
38
46
|
end
|
|
39
47
|
end
|
|
40
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.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
@@ -13,30 +13,30 @@ dependencies:
|
|
|
13
13
|
name: loog
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '0'
|
|
18
|
+
version: '0.6'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
|
-
- - "
|
|
23
|
+
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '0'
|
|
25
|
+
version: '0.6'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: tago
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- - "
|
|
30
|
+
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0'
|
|
32
|
+
version: '0.1'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0'
|
|
39
|
+
version: '0.1'
|
|
40
40
|
description: You simply pass a code block to the elapsed() function and it will print
|
|
41
41
|
the summary of execution to the log with the time it took
|
|
42
42
|
email: yegor256@gmail.com
|
|
@@ -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,47 +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
|
-
end
|