tago 0.1.0 → 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 +5 -6
- data/Gemfile.lock +26 -28
- data/README.md +4 -4
- data/REUSE.toml +7 -7
- data/Rakefile +0 -1
- data/lib/tago.rb +14 -10
- data/tago.gemspec +3 -4
- metadata +5 -25
- data/.0pdd.yml +0 -8
- data/.gitattributes +0 -7
- data/.github/workflows/actionlint.yml +0 -25
- data/.github/workflows/codecov.yml +0 -25
- data/.github/workflows/copyrights.yml +0 -15
- 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/xcop.yml +0 -15
- data/.github/workflows/yamllint.yml +0 -21
- data/.gitignore +0 -10
- data/.pdd +0 -7
- data/.rubocop.yml +0 -30
- data/.rultor.yml +0 -26
- data/.simplecov +0 -24
- data/.yamllint.yml +0 -7
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -14
- data/test/test_tago.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca493bba45fba480f54ec89dd4a4d231007d280b51638c114781b8813d524796
|
4
|
+
data.tar.gz: d51d2b4626ad2582256e389b760644487f15fa812dac456ae394a3e1fb8061e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b64b5ef1d881edf4245c57175949bba7ae452f288e6a2fa9590dba9c1de53f88650618c9d7a137d37f01391ecc5ef42346ef785cb6ff150b16f7529f0f188c
|
7
|
+
data.tar.gz: 969c82c7573afee0bdaf16503e0a955d25753e682e65f4a6a9151a3de709e7547da4d4f5076af9d34e0b07d54ce71949cb8b5e9b512ddf3d85b75421c54c78db
|
data/Gemfile
CHANGED
@@ -8,11 +8,10 @@ gemspec
|
|
8
8
|
|
9
9
|
gem 'minitest', '~>5.24', require: false
|
10
10
|
gem 'rake', '~>13.2', require: false
|
11
|
-
gem 'rubocop', '1.
|
12
|
-
gem 'rubocop-minitest', '
|
13
|
-
gem 'rubocop-performance', '
|
14
|
-
gem 'rubocop-rake', '
|
15
|
-
gem 'rubocop-rspec', '>0', require: false
|
11
|
+
gem 'rubocop', '~>1.75', require: false
|
12
|
+
gem 'rubocop-minitest', '~>0.38', require: false
|
13
|
+
gem 'rubocop-performance', '~>1.25', require: false
|
14
|
+
gem 'rubocop-rake', '~>0.7', require: false
|
16
15
|
gem 'simplecov', '~>0.22', require: false
|
17
|
-
gem 'simplecov-cobertura', '~>
|
16
|
+
gem 'simplecov-cobertura', '~>3.0', require: false
|
18
17
|
gem 'yard', '~>0.9', require: false
|
data/Gemfile.lock
CHANGED
@@ -6,22 +6,23 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.4.
|
9
|
+
ast (2.4.3)
|
10
10
|
docile (1.4.1)
|
11
|
-
json (2.
|
12
|
-
language_server-protocol (3.17.0.
|
11
|
+
json (2.13.2)
|
12
|
+
language_server-protocol (3.17.0.5)
|
13
13
|
lint_roller (1.1.0)
|
14
14
|
minitest (5.25.5)
|
15
|
-
parallel (1.
|
16
|
-
parser (3.3.
|
15
|
+
parallel (1.27.0)
|
16
|
+
parser (3.3.9.0)
|
17
17
|
ast (~> 2.4.1)
|
18
18
|
racc
|
19
|
+
prism (1.4.0)
|
19
20
|
racc (1.8.1)
|
20
21
|
rainbow (3.1.1)
|
21
|
-
rake (13.
|
22
|
-
regexp_parser (2.
|
23
|
-
rexml (3.4.
|
24
|
-
rubocop (1.
|
22
|
+
rake (13.3.0)
|
23
|
+
regexp_parser (2.11.2)
|
24
|
+
rexml (3.4.2)
|
25
|
+
rubocop (1.80.2)
|
25
26
|
json (~> 2.3)
|
26
27
|
language_server-protocol (~> 3.17.0.2)
|
27
28
|
lint_roller (~> 1.1.0)
|
@@ -29,36 +30,34 @@ GEM
|
|
29
30
|
parser (>= 3.3.0.2)
|
30
31
|
rainbow (>= 2.2.2, < 4.0)
|
31
32
|
regexp_parser (>= 2.9.3, < 3.0)
|
32
|
-
rubocop-ast (>= 1.
|
33
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
33
34
|
ruby-progressbar (~> 1.7)
|
34
35
|
unicode-display_width (>= 2.4.0, < 4.0)
|
35
|
-
rubocop-ast (1.
|
36
|
-
parser (>= 3.3.
|
37
|
-
|
36
|
+
rubocop-ast (1.46.0)
|
37
|
+
parser (>= 3.3.7.2)
|
38
|
+
prism (~> 1.4)
|
39
|
+
rubocop-minitest (0.38.2)
|
38
40
|
lint_roller (~> 1.1)
|
39
|
-
rubocop (>= 1.
|
41
|
+
rubocop (>= 1.75.0, < 2.0)
|
40
42
|
rubocop-ast (>= 1.38.0, < 2.0)
|
41
|
-
rubocop-performance (1.
|
43
|
+
rubocop-performance (1.25.0)
|
42
44
|
lint_roller (~> 1.1)
|
43
|
-
rubocop (>= 1.
|
45
|
+
rubocop (>= 1.75.0, < 2.0)
|
44
46
|
rubocop-ast (>= 1.38.0, < 2.0)
|
45
47
|
rubocop-rake (0.7.1)
|
46
48
|
lint_roller (~> 1.1)
|
47
49
|
rubocop (>= 1.72.1)
|
48
|
-
rubocop-rspec (3.5.0)
|
49
|
-
lint_roller (~> 1.1)
|
50
|
-
rubocop (~> 1.72, >= 1.72.1)
|
51
50
|
ruby-progressbar (1.13.0)
|
52
51
|
simplecov (0.22.0)
|
53
52
|
docile (~> 1.1)
|
54
53
|
simplecov-html (~> 0.11)
|
55
54
|
simplecov_json_formatter (~> 0.1)
|
56
|
-
simplecov-cobertura (
|
55
|
+
simplecov-cobertura (3.1.0)
|
57
56
|
rexml
|
58
57
|
simplecov (~> 0.19)
|
59
|
-
simplecov-html (0.13.
|
58
|
+
simplecov-html (0.13.2)
|
60
59
|
simplecov_json_formatter (0.1.4)
|
61
|
-
unicode-display_width (3.1.
|
60
|
+
unicode-display_width (3.1.5)
|
62
61
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
63
62
|
unicode-emoji (4.0.4)
|
64
63
|
yard (0.9.37)
|
@@ -74,13 +73,12 @@ PLATFORMS
|
|
74
73
|
DEPENDENCIES
|
75
74
|
minitest (~> 5.24)
|
76
75
|
rake (~> 13.2)
|
77
|
-
rubocop (
|
78
|
-
rubocop-minitest (
|
79
|
-
rubocop-performance (
|
80
|
-
rubocop-rake (
|
81
|
-
rubocop-rspec (> 0)
|
76
|
+
rubocop (~> 1.75)
|
77
|
+
rubocop-minitest (~> 0.38)
|
78
|
+
rubocop-performance (~> 1.25)
|
79
|
+
rubocop-rake (~> 0.7)
|
82
80
|
simplecov (~> 0.22)
|
83
|
-
simplecov-cobertura (~>
|
81
|
+
simplecov-cobertura (~> 3.0)
|
84
82
|
tago!
|
85
83
|
yard (~> 0.9)
|
86
84
|
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Adds `.ago()` Method to the `Time` Class
|
2
2
|
|
3
|
-
[](https://www.rultor.com/p/yegor256/tago)
|
4
4
|
[](https://www.jetbrains.com/ruby/)
|
5
5
|
|
6
6
|
[](https://github.com/yegor256/tago/actions/workflows/rake.yml)
|
7
|
-
[](
|
7
|
+
[](https://www.0pdd.com/p?name=yegor256/tago)
|
8
|
+
[](https://badge.fury.io/rb/tago)
|
9
9
|
[](https://codecov.io/github/yegor256/tago?branch=master)
|
10
|
-
[](https://rubydoc.info/github/yegor256/tago/master/frames)
|
11
11
|
[](https://hitsofcode.com/view/github/yegor256/tago)
|
12
12
|
[](https://github.com/yegor256/tago/blob/master/LICENSE.txt)
|
13
13
|
|
data/REUSE.toml
CHANGED
@@ -4,9 +4,16 @@
|
|
4
4
|
version = 1
|
5
5
|
[[annotations]]
|
6
6
|
path = [
|
7
|
+
".DS_Store",
|
8
|
+
".gitattributes",
|
9
|
+
".gitignore",
|
10
|
+
".pdd",
|
7
11
|
"**.json",
|
8
12
|
"**.md",
|
9
13
|
"**.txt",
|
14
|
+
"**/.DS_Store",
|
15
|
+
"**/.gitignore",
|
16
|
+
"**/.pdd",
|
10
17
|
"**/*.csv",
|
11
18
|
"**/*.jpg",
|
12
19
|
"**/*.json",
|
@@ -16,15 +23,8 @@ path = [
|
|
16
23
|
"**/*.svg",
|
17
24
|
"**/*.txt",
|
18
25
|
"**/*.vm",
|
19
|
-
"**/.DS_Store",
|
20
|
-
"**/.gitignore",
|
21
|
-
"**/.pdd",
|
22
26
|
"**/CNAME",
|
23
27
|
"**/Gemfile.lock",
|
24
|
-
".DS_Store",
|
25
|
-
".gitattributes",
|
26
|
-
".gitignore",
|
27
|
-
".pdd",
|
28
28
|
"Gemfile.lock",
|
29
29
|
"README.md",
|
30
30
|
"renovate.json",
|
data/Rakefile
CHANGED
data/lib/tago.rb
CHANGED
@@ -19,22 +19,26 @@ class Float
|
|
19
19
|
elsif s < 1
|
20
20
|
format('%dms', s * 1000)
|
21
21
|
elsif s < 10
|
22
|
-
ms =
|
23
|
-
|
24
|
-
format('%ds', s)
|
25
|
-
else
|
26
|
-
format('%<sec>ds%<msec>sms', sec: s, msec: ms)
|
27
|
-
end
|
22
|
+
ms = (s * 1000 % 1000).to_i
|
23
|
+
ms.zero? ? format('%ds', s) : format('%<s>ds%<ms>dms', s:, ms:)
|
28
24
|
elsif s < 100
|
29
25
|
format('%ds', s)
|
30
26
|
elsif s < 60 * 60
|
31
|
-
|
27
|
+
mins = (s / 60).to_i
|
28
|
+
secs = (s % 60).to_i
|
29
|
+
secs.zero? ? format('%dm', mins) : format('%<mins>dm%<secs>ds', mins:, secs:)
|
32
30
|
elsif s < 24 * 60 * 60
|
33
|
-
|
31
|
+
hours = (s / (60 * 60)).to_i
|
32
|
+
mins = ((s % (60 * 60)) / 60).to_i
|
33
|
+
mins.zero? ? format('%dh', hours) : format('%<hours>dh%<mins>dm', hours:, mins:)
|
34
34
|
elsif s < 7 * 24 * 60 * 60
|
35
|
-
|
35
|
+
days = (s / (24 * 60 * 60)).to_i
|
36
|
+
hours = ((s % (24 * 60 * 60)) / (60 * 60)).to_i
|
37
|
+
hours.zero? ? format('%dd', days) : format('%<days>dd%<hours>dh', days:, hours:)
|
36
38
|
else
|
37
|
-
|
39
|
+
weeks = (s / (7 * 24 * 60 * 60)).to_i
|
40
|
+
days = (s / (24 * 60 * 60) % 7).to_i
|
41
|
+
days.zero? ? format('%dw', weeks) : format('%<weeks>dw%<days>dd', weeks:, days:)
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
data/tago.gemspec
CHANGED
@@ -4,13 +4,12 @@
|
|
4
4
|
# SPDX-License-Identifier: MIT
|
5
5
|
|
6
6
|
require 'English'
|
7
|
-
require_relative 'lib/tago'
|
8
7
|
|
9
8
|
Gem::Specification.new do |s|
|
10
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
11
10
|
s.required_ruby_version = '>=3.0'
|
12
11
|
s.name = 'tago'
|
13
|
-
s.version = '0.
|
12
|
+
s.version = '0.2.0'
|
14
13
|
s.license = 'MIT'
|
15
14
|
s.summary = 'A new .ago() method for the Time class'
|
16
15
|
s.description =
|
@@ -18,8 +17,8 @@ Gem::Specification.new do |s|
|
|
18
17
|
'the existing class Time, thus making logging more convenient'
|
19
18
|
s.authors = ['Yegor Bugayenko']
|
20
19
|
s.email = 'yegor256@gmail.com'
|
21
|
-
s.homepage = '
|
22
|
-
s.files = `git ls-files`.split($RS)
|
20
|
+
s.homepage = 'https://github.com/yegor256/tago.rb'
|
21
|
+
s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
|
23
22
|
s.rdoc_options = ['--charset=UTF-8']
|
24
23
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
25
24
|
s.metadata['rubygems_mfa_required'] = 'true'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tago
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: This simple gem adds a new supplementary method .ago() to the existing
|
13
13
|
class Time, thus making logging more convenient
|
@@ -15,26 +15,9 @@ email: yegor256@gmail.com
|
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files:
|
18
|
-
- README.md
|
19
18
|
- LICENSE.txt
|
19
|
+
- README.md
|
20
20
|
files:
|
21
|
-
- ".0pdd.yml"
|
22
|
-
- ".gitattributes"
|
23
|
-
- ".github/workflows/actionlint.yml"
|
24
|
-
- ".github/workflows/codecov.yml"
|
25
|
-
- ".github/workflows/copyrights.yml"
|
26
|
-
- ".github/workflows/markdown-lint.yml"
|
27
|
-
- ".github/workflows/pdd.yml"
|
28
|
-
- ".github/workflows/rake.yml"
|
29
|
-
- ".github/workflows/reuse.yml"
|
30
|
-
- ".github/workflows/xcop.yml"
|
31
|
-
- ".github/workflows/yamllint.yml"
|
32
|
-
- ".gitignore"
|
33
|
-
- ".pdd"
|
34
|
-
- ".rubocop.yml"
|
35
|
-
- ".rultor.yml"
|
36
|
-
- ".simplecov"
|
37
|
-
- ".yamllint.yml"
|
38
21
|
- Gemfile
|
39
22
|
- Gemfile.lock
|
40
23
|
- LICENSE.txt
|
@@ -43,11 +26,8 @@ files:
|
|
43
26
|
- REUSE.toml
|
44
27
|
- Rakefile
|
45
28
|
- lib/tago.rb
|
46
|
-
- renovate.json
|
47
29
|
- tago.gemspec
|
48
|
-
|
49
|
-
- test/test_tago.rb
|
50
|
-
homepage: http://github.com/yegor256/tago.rb
|
30
|
+
homepage: https://github.com/yegor256/tago.rb
|
51
31
|
licenses:
|
52
32
|
- MIT
|
53
33
|
metadata:
|
@@ -67,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
47
|
- !ruby/object:Gem::Version
|
68
48
|
version: '0'
|
69
49
|
requirements: []
|
70
|
-
rubygems_version: 3.6.
|
50
|
+
rubygems_version: 3.6.9
|
71
51
|
specification_version: 4
|
72
52
|
summary: A new .ago() method for the Time class
|
73
53
|
test_files: []
|
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,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: copyrights
|
6
|
-
'on':
|
7
|
-
push:
|
8
|
-
pull_request:
|
9
|
-
jobs:
|
10
|
-
copyrights:
|
11
|
-
timeout-minutes: 15
|
12
|
-
runs-on: ubuntu-24.04
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v4
|
15
|
-
- uses: yegor256/copyrights-action@0.0.8
|
@@ -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: articulate/actions-markdownlint@v1
|
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/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,21 +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
|
20
|
-
with:
|
21
|
-
config_file: .yamllint.yml
|
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
|
-
Gemspec/RequiredRubyVersion:
|
20
|
-
Enabled: false
|
21
|
-
Metrics/AbcSize:
|
22
|
-
Enabled: false
|
23
|
-
Metrics/MethodLength:
|
24
|
-
Enabled: false
|
25
|
-
Layout/EndOfLine:
|
26
|
-
EnforcedStyle: lf
|
27
|
-
Metrics/CyclomaticComplexity:
|
28
|
-
Enabled: false
|
29
|
-
Metrics/PerceivedComplexity:
|
30
|
-
Enabled: false
|
data/.rultor.yml
DELETED
@@ -1,26 +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" tago.gemspec
|
19
|
-
git add tago.gemspec
|
20
|
-
git commit -m "version set to ${tag}"
|
21
|
-
gem build tago.gemspec
|
22
|
-
chmod 0600 ../rubygems.yml
|
23
|
-
gem push *.gem --config-file ../rubygems.yml
|
24
|
-
merge:
|
25
|
-
script: |-
|
26
|
-
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/.yamllint.yml
DELETED
data/renovate.json
DELETED
data/test/test__helper.rb
DELETED
@@ -1,14 +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
|
-
SimpleCov.start
|
10
|
-
|
11
|
-
require 'simplecov-cobertura'
|
12
|
-
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
13
|
-
|
14
|
-
require 'minitest/autorun'
|
data/test/test_tago.rb
DELETED
@@ -1,45 +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 'minitest/autorun'
|
7
|
-
require_relative '../lib/tago'
|
8
|
-
|
9
|
-
# Main test.
|
10
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
11
|
-
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
12
|
-
# License:: MIT
|
13
|
-
class TestTago < Minitest::Test
|
14
|
-
def test_simple_printing
|
15
|
-
t = Time.now
|
16
|
-
assert_equal('14ms', (t - 0.014).ago(t))
|
17
|
-
assert_equal('1s', (t - 1).ago(t))
|
18
|
-
assert_equal('1s350ms', (t - 1.35).ago(t))
|
19
|
-
assert_equal('67s', (t - 67).ago(t))
|
20
|
-
assert_equal('4m5s', (t - 245).ago(t))
|
21
|
-
assert_equal('13h18m', (t - (13.3 * 60 * 60)).ago(t))
|
22
|
-
assert_equal('5d0h', (t - (5 * 24 * 60 * 60)).ago(t))
|
23
|
-
assert_equal('5d7h', (t - (5.3 * 24 * 60 * 60)).ago(t))
|
24
|
-
assert_equal('22w1d', (t - (155 * 24 * 60 * 60)).ago(t))
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_inverse
|
28
|
-
t = Time.now
|
29
|
-
assert_equal('14ms', (t + 0.014).ago(t))
|
30
|
-
assert_equal('1s', (t + 1).ago(t))
|
31
|
-
assert_equal('67s', (t + 67).ago(t))
|
32
|
-
assert_equal('13h0m', (t + (13 * 60 * 60)).ago(t))
|
33
|
-
assert_equal('5d0h', (t + (5 * 24 * 60 * 60)).ago(t))
|
34
|
-
assert_equal('22w1d', (t + (155 * 24 * 60 * 60)).ago(t))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_float_to_seconds
|
38
|
-
assert_equal('18ms', 0.018.seconds)
|
39
|
-
assert_equal('2s330ms', 2.33.seconds)
|
40
|
-
assert_equal('69s', 69.17.seconds)
|
41
|
-
assert_equal('12h6m', (12.1 * 60 * 60).seconds)
|
42
|
-
assert_equal('5d7h', (5.3 * 24 * 60 * 60).seconds)
|
43
|
-
assert_equal('19w0d', ((132.6 * 24 * 60 * 60) + (23 * 60 * 60)).seconds)
|
44
|
-
end
|
45
|
-
end
|