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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d92c21f9247d8a68c330dc5b284b80ecadda5908269fd86481899c9e2721bc4a
4
- data.tar.gz: f19e8b1f5e94b9283f814c043e64e00889b3a6158cc479610769dd0b9673f27e
3
+ metadata.gz: ca493bba45fba480f54ec89dd4a4d231007d280b51638c114781b8813d524796
4
+ data.tar.gz: d51d2b4626ad2582256e389b760644487f15fa812dac456ae394a3e1fb8061e7
5
5
  SHA512:
6
- metadata.gz: ab867b4a97707d94d6130eec6ca85b115816639121de3580220938d3645f28779f13d78118fc1f38d23e4bdd0ea5605f717d3b0b204f9f1c8df742d10fc0648c
7
- data.tar.gz: 4c2066c510e0971367382881e8fe0770b65e672512bf47a569d0fea39c2a87039a38204326d7b96be121a9695aa3c872d0b35c2a29dac208e34b6aba5220f7a0
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.74.0', require: false
12
- gem 'rubocop-minitest', '>0', require: false
13
- gem 'rubocop-performance', '>0', require: false
14
- gem 'rubocop-rake', '>0', require: false
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', '~>2.1', require: false
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.2)
9
+ ast (2.4.3)
10
10
  docile (1.4.1)
11
- json (2.10.2)
12
- language_server-protocol (3.17.0.4)
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.26.3)
16
- parser (3.3.7.1)
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.2.1)
22
- regexp_parser (2.10.0)
23
- rexml (3.4.1)
24
- rubocop (1.74.0)
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.38.0, < 2.0)
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.40.0)
36
- parser (>= 3.3.1.0)
37
- rubocop-minitest (0.37.1)
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.72.1, < 2.0)
41
+ rubocop (>= 1.75.0, < 2.0)
40
42
  rubocop-ast (>= 1.38.0, < 2.0)
41
- rubocop-performance (1.24.0)
43
+ rubocop-performance (1.25.0)
42
44
  lint_roller (~> 1.1)
43
- rubocop (>= 1.72.1, < 2.0)
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 (2.1.0)
55
+ simplecov-cobertura (3.1.0)
57
56
  rexml
58
57
  simplecov (~> 0.19)
59
- simplecov-html (0.13.1)
58
+ simplecov-html (0.13.2)
60
59
  simplecov_json_formatter (0.1.4)
61
- unicode-display_width (3.1.4)
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 (= 1.74.0)
78
- rubocop-minitest (> 0)
79
- rubocop-performance (> 0)
80
- rubocop-rake (> 0)
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 (~> 2.1)
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
- [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/tago)](http://www.rultor.com/p/yegor256/tago)
3
+ [![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/tago)](https://www.rultor.com/p/yegor256/tago)
4
4
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
5
5
 
6
6
  [![rake](https://github.com/yegor256/tago/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/tago/actions/workflows/rake.yml)
7
- [![PDD status](http://www.0pdd.com/svg?name=yegor256/tago)](http://www.0pdd.com/p?name=yegor256/tago)
8
- [![Gem Version](https://badge.fury.io/rb/tago.svg)](http://badge.fury.io/rb/tago)
7
+ [![PDD status](https://www.0pdd.com/svg?name=yegor256/tago)](https://www.0pdd.com/p?name=yegor256/tago)
8
+ [![Gem Version](https://badge.fury.io/rb/tago.svg)](https://badge.fury.io/rb/tago)
9
9
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/tago.svg)](https://codecov.io/github/yegor256/tago?branch=master)
10
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/tago/master/frames)
10
+ [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/yegor256/tago/master/frames)
11
11
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/tago)](https://hitsofcode.com/view/github/yegor256/tago)
12
12
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](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
@@ -37,5 +37,4 @@ require 'rubocop/rake_task'
37
37
  desc 'Run RuboCop on all directories'
38
38
  RuboCop::RakeTask.new(:rubocop) do |task|
39
39
  task.fail_on_error = true
40
- task.requires << 'rubocop-rspec'
41
40
  end
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 = format('%03d', s * 1000 % 1000)
23
- if ms == '000'
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
- format('%<mins>dm%<secs>ds', mins: s / 60, secs: s % 60)
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
- format('%<hours>dh%<mins>dm', hours: s / (60 * 60), mins: (s % (60 * 60)) / 60)
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
- format('%<days>dd%<hours>dh', days: s / (24 * 60 * 60), hours: (s % (24 * 60 * 60)) / (60 * 60))
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
- format('%<weeks>dw%<days>dd', weeks: s / (7 * 24 * 60 * 60), days: s % (7 * 24 * 60 * 60) / (24 * 60 * 60))
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.1.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 = 'http://github.com/yegor256/tago.rb'
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.1.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: 2025-03-19 00:00:00.000000000 Z
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
- - test/test__helper.rb
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.2
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
@@ -1,8 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- errors:
5
- - yegor256@gmail.com
6
- # alerts:
7
- # github:
8
- # - yegor256
data/.gitattributes DELETED
@@ -1,7 +0,0 @@
1
- # Check out all text files in UNIX format, with LF as end of line
2
- # Don't change this file. If you have any ideas about it, please
3
- # submit a separate issue about it and we'll discuss.
4
-
5
- * text=auto eol=lf
6
- *.java ident
7
- *.xml ident
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,10 +0,0 @@
1
- *.gem
2
- .DS_Store
3
- .bundle/
4
- .idea/
5
- .yardoc/
6
- coverage/
7
- doc/
8
- node_modules/
9
- rdoc/
10
- vendor/
data/.pdd DELETED
@@ -1,7 +0,0 @@
1
- --source=.
2
- --verbose
3
- --exclude target/**/*
4
- --exclude coverage/**/*
5
- --rule min-words:20
6
- --rule min-estimate:15
7
- --rule max-estimate:90
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
@@ -1,7 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- rules:
5
- line-length:
6
- max: 80
7
- allow-non-breakable-words: true
data/renovate.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:base"
5
- ]
6
- }
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