backtrace 0.3.0 → 0.4.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/.0pdd.yml +3 -0
- data/.github/workflows/actionlint.yml +25 -0
- data/.github/workflows/copyrights.yml +19 -0
- data/.github/workflows/markdown-lint.yml +19 -0
- data/.github/workflows/pdd.yml +19 -0
- data/.github/workflows/rake.yml +28 -0
- data/.github/workflows/reuse.yml +19 -0
- data/.github/workflows/typos.yml +19 -0
- data/.github/workflows/xcop.yml +15 -0
- data/.github/workflows/yamllint.yml +19 -0
- data/.gitignore +7 -2
- data/.rubocop.yml +13 -1
- data/.rultor.yml +13 -11
- data/Gemfile +13 -19
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +21 -0
- data/LICENSES/MIT.txt +21 -0
- data/README.md +28 -31
- data/REUSE.toml +36 -0
- data/Rakefile +2 -20
- data/backtrace.gemspec +7 -35
- data/lib/backtrace.rb +87 -24
- data/logo.svg +19 -0
- data/renovate.json +6 -0
- data/screenshot.png +0 -0
- data/test/test__helper.rb +31 -0
- data/test/test_backtrace.rb +13 -26
- metadata +26 -85
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ec6af7564f6d3071102d9fe68dbd8fbd0b96c8df924bbf06ad4b4571706fba8
|
4
|
+
data.tar.gz: 584bcdee252d22e0f1b0f5bbc38693c061ff5ba2f351a827e3769667c2f123ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4de01dce920474679fcd9f57ddd91199720b8f8fd5373dac2d18415726eab229ddcd56519cd4a5fa2ebe96a914e47b29ecd8bbc58505608a0798f9c77e7f379
|
7
|
+
data.tar.gz: 25311582c3827f3e27555dd31fe1378dd46666d7cb63ebd162622c5e220cca6e31564d3463f536e4dac333e45bbfc323dfe147687210dd0f33c2a4181d3700be
|
data/.0pdd.yml
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
|
+
jobs:
|
14
|
+
markdown-lint:
|
15
|
+
timeout-minutes: 15
|
16
|
+
runs-on: ubuntu-24.04
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- uses: DavidAnson/markdownlint-cli2-action@v20.0.0
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
|
+
test:
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
os: [ubuntu-24.04]
|
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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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.33.1
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
---
|
1
4
|
AllCops:
|
2
5
|
DisplayCopNames: true
|
3
6
|
TargetRubyVersion: 2.3.3
|
4
|
-
|
7
|
+
SuggestExtensions: false
|
8
|
+
NewCops: enable
|
5
9
|
Layout/MultilineMethodCallIndentation:
|
6
10
|
Enabled: false
|
11
|
+
Minitest/EmptyLineBeforeAssertionMethods:
|
12
|
+
Enabled: false
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Max: 40
|
15
|
+
plugins:
|
16
|
+
- rubocop-rake
|
17
|
+
- rubocop-minitest
|
18
|
+
- rubocop-performance
|
data/.rultor.yml
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
---
|
4
|
+
# yamllint disable rule:line-length
|
5
|
+
docker:
|
6
|
+
image: yegor256/ruby
|
1
7
|
assets:
|
2
|
-
rubygems.yml:
|
8
|
+
rubygems.yml: yegor256/home#assets/rubygems.yml
|
3
9
|
install: |-
|
4
|
-
|
5
|
-
|
10
|
+
pdd -f /dev/null
|
11
|
+
bundle install --no-color
|
6
12
|
release:
|
13
|
+
pre: false
|
7
14
|
script: |-
|
8
|
-
bundle
|
9
|
-
rake
|
15
|
+
bundle exec rake
|
10
16
|
rm -rf *.gem
|
11
17
|
sed -i "s/0\.0\.0/${tag}/g" backtrace.gemspec
|
12
18
|
git add backtrace.gemspec
|
@@ -14,10 +20,6 @@ release:
|
|
14
20
|
gem build backtrace.gemspec
|
15
21
|
chmod 0600 ../rubygems.yml
|
16
22
|
gem push *.gem --config-file ../rubygems.yml
|
17
|
-
commanders:
|
18
|
-
- yegor256
|
19
|
-
architect:
|
20
|
-
- yegor256
|
21
23
|
merge:
|
22
|
-
|
23
|
-
|
24
|
+
script: |-
|
25
|
+
bundle exec rake
|
data/Gemfile
CHANGED
@@ -1,24 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
13
|
-
# copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
# SOFTWARE.
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
22
5
|
|
23
6
|
source 'https://rubygems.org'
|
24
7
|
gemspec
|
8
|
+
|
9
|
+
gem 'minitest', '~>5.11', require: false
|
10
|
+
gem 'minitest-reporters', '~>1.7', require: false
|
11
|
+
gem 'rake', '~>13.2', require: false
|
12
|
+
gem 'rdoc', '~>6.11', require: false
|
13
|
+
gem 'rubocop', '~>1.71', require: false
|
14
|
+
gem 'rubocop-minitest', '~>0.38', require: false
|
15
|
+
gem 'rubocop-performance', '~>1.0', require: false
|
16
|
+
gem 'rubocop-rake', '~>0.7', require: false
|
17
|
+
gem 'simplecov', '~>0.22', require: false
|
18
|
+
gem 'simplecov-cobertura', '~>2.1', require: false
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
backtrace (0.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ansi (1.5.0)
|
10
|
+
ast (2.4.3)
|
11
|
+
builder (3.3.0)
|
12
|
+
date (3.4.1)
|
13
|
+
docile (1.4.1)
|
14
|
+
erb (5.0.1)
|
15
|
+
json (2.12.2)
|
16
|
+
language_server-protocol (3.17.0.5)
|
17
|
+
lint_roller (1.1.0)
|
18
|
+
minitest (5.25.5)
|
19
|
+
minitest-reporters (1.7.1)
|
20
|
+
ansi
|
21
|
+
builder
|
22
|
+
minitest (>= 5.0)
|
23
|
+
ruby-progressbar
|
24
|
+
parallel (1.27.0)
|
25
|
+
parser (3.3.8.0)
|
26
|
+
ast (~> 2.4.1)
|
27
|
+
racc
|
28
|
+
prism (1.4.0)
|
29
|
+
psych (5.2.6)
|
30
|
+
date
|
31
|
+
stringio
|
32
|
+
racc (1.8.1)
|
33
|
+
rainbow (3.1.1)
|
34
|
+
rake (13.3.0)
|
35
|
+
rdoc (6.14.0)
|
36
|
+
erb
|
37
|
+
psych (>= 4.0.0)
|
38
|
+
regexp_parser (2.10.0)
|
39
|
+
rexml (3.4.1)
|
40
|
+
rubocop (1.76.0)
|
41
|
+
json (~> 2.3)
|
42
|
+
language_server-protocol (~> 3.17.0.2)
|
43
|
+
lint_roller (~> 1.1.0)
|
44
|
+
parallel (~> 1.10)
|
45
|
+
parser (>= 3.3.0.2)
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
48
|
+
rubocop-ast (>= 1.45.0, < 2.0)
|
49
|
+
ruby-progressbar (~> 1.7)
|
50
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
51
|
+
rubocop-ast (1.45.0)
|
52
|
+
parser (>= 3.3.7.2)
|
53
|
+
prism (~> 1.4)
|
54
|
+
rubocop-minitest (0.38.1)
|
55
|
+
lint_roller (~> 1.1)
|
56
|
+
rubocop (>= 1.75.0, < 2.0)
|
57
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
58
|
+
rubocop-performance (1.25.0)
|
59
|
+
lint_roller (~> 1.1)
|
60
|
+
rubocop (>= 1.75.0, < 2.0)
|
61
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
62
|
+
rubocop-rake (0.7.1)
|
63
|
+
lint_roller (~> 1.1)
|
64
|
+
rubocop (>= 1.72.1)
|
65
|
+
ruby-progressbar (1.13.0)
|
66
|
+
simplecov (0.22.0)
|
67
|
+
docile (~> 1.1)
|
68
|
+
simplecov-html (~> 0.11)
|
69
|
+
simplecov_json_formatter (~> 0.1)
|
70
|
+
simplecov-cobertura (2.1.0)
|
71
|
+
rexml
|
72
|
+
simplecov (~> 0.19)
|
73
|
+
simplecov-html (0.13.1)
|
74
|
+
simplecov_json_formatter (0.1.4)
|
75
|
+
stringio (3.1.7)
|
76
|
+
unicode-display_width (3.1.4)
|
77
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
78
|
+
unicode-emoji (4.0.4)
|
79
|
+
|
80
|
+
PLATFORMS
|
81
|
+
arm64-darwin-22
|
82
|
+
arm64-darwin-23
|
83
|
+
arm64-darwin-24
|
84
|
+
x64-mingw-ucrt
|
85
|
+
x86_64-linux
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
backtrace!
|
89
|
+
minitest (~> 5.11)
|
90
|
+
minitest-reporters (~> 1.7)
|
91
|
+
rake (~> 13.2)
|
92
|
+
rdoc (~> 6.11)
|
93
|
+
rubocop (~> 1.71)
|
94
|
+
rubocop-minitest (~> 0.38)
|
95
|
+
rubocop-performance (~> 1.0)
|
96
|
+
rubocop-rake (~> 0.7)
|
97
|
+
simplecov (~> 0.22)
|
98
|
+
simplecov-cobertura (~> 2.1)
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
2.5.16
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018-2025 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included
|
13
|
+
in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSES/MIT.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018-2025 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included
|
13
|
+
in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,19 +1,24 @@
|
|
1
|
-
|
2
|
-
[](https://www.jetbrains.com/ruby/)
|
1
|
+
# Converts Ruby Backtrace to a String
|
3
2
|
|
4
|
-
[](https://www.rultor.com/p/yegor256/backtrace)
|
4
|
+
[](https://www.jetbrains.com/ruby/)
|
5
|
+
|
6
|
+
[](https://github.com/yegor256/backtrace/actions/workflows/rake.yml)
|
7
|
+
[](https://badge.fury.io/rb/backtrace)
|
6
8
|
[](https://codeclimate.com/github/yegor256/backtrace/maintainability)
|
9
|
+
[](https://rubydoc.info/github/yegor256/backtrace/master/frames)
|
10
|
+
[](https://hitsofcode.com/view/github/yegor256/backtrace)
|
11
|
+
[](https://github.com/yegor256/backtrace/blob/master/LICENSE.txt)
|
7
12
|
|
8
13
|
A Ruby backtrace nicely printed.
|
9
14
|
|
10
15
|
First, install it:
|
11
16
|
|
12
17
|
```bash
|
13
|
-
|
18
|
+
gem install backtrace
|
14
19
|
```
|
15
20
|
|
16
|
-
Then, use it like this
|
21
|
+
Then, use it like this to print a backtrace:
|
17
22
|
|
18
23
|
```ruby
|
19
24
|
require 'backtrace'
|
@@ -35,19 +40,19 @@ Backtrace.exec(swallow: true) do
|
|
35
40
|
end
|
36
41
|
```
|
37
42
|
|
38
|
-
You can also provide a logging facility
|
43
|
+
You can also provide a logging facility to log the backtrace:
|
39
44
|
|
40
45
|
```ruby
|
41
46
|
require 'backtrace'
|
42
|
-
log = Log.new # it must implement method error(msg)
|
47
|
+
log = Log.new # it must implement the method error(msg)
|
43
48
|
Backtrace.exec(swallow: true, log: log) do
|
44
49
|
# do something dangerous
|
45
50
|
end
|
46
51
|
```
|
47
52
|
|
48
|
-
Sometimes you may need to hide unimportant lines of the backtrace
|
49
|
-
|
50
|
-
of the constructor, which is a regular expression or a string. When it's
|
53
|
+
Sometimes you may need to hide unimportant lines of the backtrace
|
54
|
+
that are not related to your codebase. You can use the `mine` argument
|
55
|
+
of the constructor, which is a regular expression or a string. When it's encountered
|
51
56
|
in the backtrace, the printing will stop:
|
52
57
|
|
53
58
|
```ruby
|
@@ -61,26 +66,18 @@ end
|
|
61
66
|
|
62
67
|
That's it.
|
63
68
|
|
64
|
-
|
65
|
-
|
66
|
-
(The MIT License)
|
67
|
-
|
68
|
-
Copyright (c) 2018 Yegor Bugayenko
|
69
|
+
## How to contribute
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
Read
|
72
|
+
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
73
|
+
Make sure your build is green before you contribute
|
74
|
+
your pull request.
|
75
|
+
You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
76
|
+
[Bundler](https://bundler.io/) installed. Then:
|
76
77
|
|
77
|
-
|
78
|
-
|
78
|
+
```bash
|
79
|
+
bundle update
|
80
|
+
bundle exec rake
|
81
|
+
```
|
79
82
|
|
80
|
-
|
81
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
82
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
83
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
84
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
85
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
86
|
-
SOFTWARE.
|
83
|
+
If it's clean and you don't see any error messages, submit your pull request.
|
data/REUSE.toml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
4
|
+
version = 1
|
5
|
+
[[annotations]]
|
6
|
+
path = [
|
7
|
+
".DS_Store",
|
8
|
+
".gitattributes",
|
9
|
+
".gitignore",
|
10
|
+
".pdd",
|
11
|
+
"**.json",
|
12
|
+
"**.md",
|
13
|
+
"**.png",
|
14
|
+
"**.svg",
|
15
|
+
"**.txt",
|
16
|
+
"**/.DS_Store",
|
17
|
+
"**/.gitignore",
|
18
|
+
"**/.pdd",
|
19
|
+
"**/*.csv",
|
20
|
+
"**/*.jpg",
|
21
|
+
"**/*.json",
|
22
|
+
"**/*.md",
|
23
|
+
"**/*.pdf",
|
24
|
+
"**/*.png",
|
25
|
+
"**/*.svg",
|
26
|
+
"**/*.txt",
|
27
|
+
"**/*.vm",
|
28
|
+
"**/CNAME",
|
29
|
+
"**/Gemfile.lock",
|
30
|
+
"Gemfile.lock",
|
31
|
+
"README.md",
|
32
|
+
"renovate.json",
|
33
|
+
]
|
34
|
+
precedence = "override"
|
35
|
+
SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
|
36
|
+
SPDX-License-Identifier = "MIT"
|
data/Rakefile
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
13
|
-
# copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
# SOFTWARE.
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
22
5
|
|
23
6
|
require 'rubygems'
|
24
7
|
require 'rake'
|
@@ -48,5 +31,4 @@ require 'rubocop/rake_task'
|
|
48
31
|
desc 'Run RuboCop on all directories'
|
49
32
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
50
33
|
task.fail_on_error = true
|
51
|
-
task.requires << 'rubocop-rspec'
|
52
34
|
end
|
data/backtrace.gemspec
CHANGED
@@ -1,50 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (
|
4
|
-
#
|
5
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
6
|
-
#
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
12
|
-
# furnished to do so, subject to the following conditions:
|
13
|
-
#
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
15
|
-
# copies or substantial portions of the Software.
|
16
|
-
#
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
-
# SOFTWARE.
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
24
5
|
|
25
6
|
require 'English'
|
26
7
|
Gem::Specification.new do |s|
|
27
|
-
s.
|
28
|
-
if s.respond_to? :required_rubygems_version=
|
29
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
30
|
-
end
|
31
|
-
s.rubygems_version = '2.3.3'
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
32
9
|
s.required_ruby_version = '>=2.3'
|
33
10
|
s.name = 'backtrace'
|
34
|
-
s.version = '0.
|
11
|
+
s.version = '0.4.1'
|
35
12
|
s.license = 'MIT'
|
36
13
|
s.summary = 'Backtrace printer'
|
37
|
-
s.description = 'Nicely prints Ruby backtrace'
|
14
|
+
s.description = 'Nicely prints Ruby backtrace to the console'
|
38
15
|
s.authors = ['Yegor Bugayenko']
|
39
16
|
s.email = 'yegor256@gmail.com'
|
40
|
-
s.homepage = '
|
17
|
+
s.homepage = 'https://github.com/yegor256/backtrace'
|
41
18
|
s.files = `git ls-files`.split($RS)
|
42
|
-
s.test_files = s.files.grep(%r{^(test)/})
|
43
19
|
s.rdoc_options = ['--charset=UTF-8']
|
44
20
|
s.extra_rdoc_files = ['README.md']
|
45
|
-
s.
|
46
|
-
s.add_development_dependency 'rake', '~>12.3'
|
47
|
-
s.add_development_dependency 'rdoc', '~>4.2'
|
48
|
-
s.add_development_dependency 'rubocop', '0.58.1'
|
49
|
-
s.add_development_dependency 'rubocop-rspec', '1.27.0'
|
21
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
50
22
|
end
|
data/lib/backtrace.rb
CHANGED
@@ -1,49 +1,112 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
5
|
+
|
6
|
+
# Backtrace as a string.
|
4
7
|
#
|
5
|
-
#
|
8
|
+
# This class helps format Ruby exceptions with their backtraces
|
9
|
+
# in a clean, readable format. It can also filter backtrace lines
|
10
|
+
# to show only relevant information.
|
6
11
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
12
|
+
# @example Basic usage
|
13
|
+
# begin
|
14
|
+
# raise "Something went wrong"
|
15
|
+
# rescue => e
|
16
|
+
# puts Backtrace.new(e)
|
17
|
+
# end
|
13
18
|
#
|
14
|
-
#
|
15
|
-
#
|
19
|
+
# @example Using with a filter
|
20
|
+
# begin
|
21
|
+
# raise "Error in my code"
|
22
|
+
# rescue => e
|
23
|
+
# puts Backtrace.new(e, mine: 'myapp')
|
24
|
+
# end
|
16
25
|
#
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
-
# SOFTWARE.
|
24
|
-
|
25
|
-
# Backtrace as a string.
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
27
|
-
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
|
27
|
+
# Copyright:: Copyright (c) 2018-2025 Yegor Bugayenko
|
28
28
|
# License:: MIT
|
29
29
|
class Backtrace
|
30
|
+
# Creates a new Backtrace instance.
|
31
|
+
#
|
32
|
+
# @param exp [Exception] The exception to format
|
33
|
+
# @param mine [String, Regexp] Pattern to match against backtrace lines.
|
34
|
+
# When matched, backtrace will stop printing at that line.
|
35
|
+
#
|
36
|
+
# @example With a string pattern
|
37
|
+
# Backtrace.new(exception, mine: 'myapp')
|
38
|
+
#
|
39
|
+
# @example With a regular expression
|
40
|
+
# Backtrace.new(exception, mine: /lib\/myapp/)
|
30
41
|
def initialize(exp, mine: '')
|
31
42
|
@exp = exp
|
32
43
|
@mine = (mine.is_a?(Regexp) ? mine : Regexp.new(Regexp.quote(mine)))
|
33
44
|
end
|
34
45
|
|
46
|
+
# Converts the backtrace to a formatted string.
|
47
|
+
#
|
48
|
+
# The output includes the exception class name, message, and a filtered
|
49
|
+
# backtrace. Lines are indented with tabs for readability.
|
50
|
+
#
|
51
|
+
# @return [String] Formatted backtrace string
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# begin
|
55
|
+
# 1 / 0
|
56
|
+
# rescue => e
|
57
|
+
# bt = Backtrace.new(e)
|
58
|
+
# puts bt.to_s
|
59
|
+
# # => "ZeroDivisionError: divided by 0
|
60
|
+
# # \t/path/to/file.rb:10:in `/'
|
61
|
+
# # \t/path/to/file.rb:20:in `calculate'"
|
62
|
+
# end
|
35
63
|
def to_s
|
64
|
+
bt = @exp.backtrace
|
65
|
+
&.reverse
|
66
|
+
&.drop_while { |t| @mine.match(t).nil? }
|
67
|
+
&.reverse
|
68
|
+
&.join("\n\t")
|
36
69
|
[
|
37
70
|
@exp.class.name,
|
38
71
|
': ',
|
39
72
|
@exp.message,
|
40
|
-
"\n\t"
|
41
|
-
@exp.backtrace.reverse
|
42
|
-
.drop_while { |t| @mine.match(t).nil? }
|
43
|
-
.reverse.join("\n\t")
|
73
|
+
("\n\t#{bt}" if bt)
|
44
74
|
].join
|
45
75
|
end
|
46
76
|
|
77
|
+
# Executes a block and handles exceptions with formatted backtrace.
|
78
|
+
#
|
79
|
+
# This method provides a convenient way to wrap code that might raise
|
80
|
+
# exceptions. It will format and display (or log) any exceptions that occur.
|
81
|
+
#
|
82
|
+
# @param swallow [Boolean] Whether to swallow the exception (default: false)
|
83
|
+
# @param log [Object] Logger object that responds to #error (optional)
|
84
|
+
# @param mine [String, Regexp] Pattern to filter backtrace lines
|
85
|
+
#
|
86
|
+
# @yield The block of code to execute
|
87
|
+
#
|
88
|
+
# @raise [StandardError] Re-raises the exception unless swallow is true
|
89
|
+
#
|
90
|
+
# @example Basic usage
|
91
|
+
# Backtrace.exec do
|
92
|
+
# risky_operation
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# @example Swallow exceptions
|
96
|
+
# Backtrace.exec(swallow: true) do
|
97
|
+
# optional_operation
|
98
|
+
# end
|
99
|
+
#
|
100
|
+
# @example With logging
|
101
|
+
# logger = Logger.new(STDOUT)
|
102
|
+
# Backtrace.exec(log: logger) do
|
103
|
+
# database_operation
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# @example With filtering
|
107
|
+
# Backtrace.exec(mine: 'myapp', swallow: true) do
|
108
|
+
# complex_operation
|
109
|
+
# end
|
47
110
|
def self.exec(swallow: false, log: nil, mine: '')
|
48
111
|
yield
|
49
112
|
rescue StandardError => e
|
data/logo.svg
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<svg width="314px" height="314px" viewBox="0 0 314 314" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
+
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
|
4
|
+
<title>Group 2</title>
|
5
|
+
<desc>Created with Sketch.</desc>
|
6
|
+
<defs></defs>
|
7
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8
|
+
<g id="Group-2">
|
9
|
+
<g id="Group">
|
10
|
+
<circle id="Oval" fill="#053C5E" cx="157" cy="157" r="157"></circle>
|
11
|
+
<rect id="Rectangle" fill="#2B2B2B" x="0" y="234" width="300" height="68"></rect>
|
12
|
+
<text id="backtrace" font-family="CourierNewPS-BoldMT, Courier New" font-size="50" font-weight="bold" fill="#FFFFFF">
|
13
|
+
<tspan x="15.4780273" y="284">backtrace</tspan>
|
14
|
+
</text>
|
15
|
+
<path d="M135.676765,111.215287 C135.211714,113.540467 132.770932,120.688823 130.252813,127.100603 C127.734621,133.512383 125.2898,140.431445 124.819828,142.476214 C123.6868,147.405663 121.517836,147.185477 119.69487,141.95608 C116.899865,133.938362 105.171362,111.043501 103.859129,111.043501 C100.420089,111.043501 101.508757,114.986149 109.1771,130.30227 C113.739327,139.414532 118.032086,147.448041 118.716515,148.15443 C120.694817,150.196115 120.172626,154.319657 117.358599,158.877992 C113.567467,165.019055 107.570942,183.721189 108.054206,187.896804 C108.804956,194.383204 112.436054,192.210274 113.355359,184.724515 C114.48376,175.535577 120.945556,159.641154 124.897459,156.333653 C127.109021,154.482778 128.268636,151.905536 128.573284,148.163978 C128.818001,145.157747 131.906711,135.560972 135.437115,126.837819 C138.96752,118.114666 141.511492,110.079835 141.090434,108.982574 C139.755727,105.504315 136.554941,106.824333 135.676765,111.215287 M174.714659,126.841564 C169.37392,129.699438 169.197653,130.049915 167.452978,141.283475 C165.577352,153.360398 165.225112,168.513913 166.548289,180.203784 L167.566817,189.202501 L161.346213,191.9541 C154.601949,194.937416 150.91195,200.302465 153.156708,203.861146 C155.104824,206.949562 157.09025,206.70198 157.571826,203.310532 C158.083734,199.706169 166.097413,193.204052 170.29418,192.987978 C172.116999,192.894116 173.522874,191.717021 173.97823,189.903529 C174.383277,188.290613 177.740353,184.944554 181.438431,182.467858 C188.546172,177.707551 194.317883,170.450278 194.317883,166.273341 C194.317883,162.684548 189.493165,158.361603 185.487795,158.361603 C180.701636,158.361603 180.027195,155.239403 183.731222,150.229385 C188.308065,144.038966 188.284856,130.867646 183.690534,127.147387 C179.896537,124.075276 179.885006,124.074836 174.714659,126.841564 M182.67318,134.240439 C184.752542,140.153164 174.808961,161.185104 171.588639,157.68562 C169.868715,155.81653 172.863122,135.012708 175.266374,132.134564 C177.872553,129.013319 181.163896,129.949075 182.67318,134.240439 M184.854262,162.269586 C190.589839,163.855621 189.673839,167.881335 181.645765,176.371155 C177.281618,180.986262 173.904933,183.573859 173.371946,182.711474 C172.876636,181.91012 172.127869,176.711937 171.707987,171.159972 L170.944531,161.065463 L176.209475,161.200234 C179.105172,161.274339 182.995308,161.755548 184.854262,162.269586 M132.642184,172.492256 C131.593837,175.224098 133.152917,177.288844 136.264027,177.288844 C139.014965,177.288844 139.431396,176.221769 138.067531,172.667568 C137.039234,169.987871 133.645289,169.878218 132.642184,172.492256 M203.781503,185.840798 C203.781503,187.657595 209.264724,193.512152 210.966361,193.512152 C212.534035,193.512152 211.991059,187.391138 210.270768,185.670847 C208.092403,183.492409 203.781503,183.605293 203.781503,185.840798" id="Fill-6" fill="#427B8A" fill-rule="nonzero"></path>
|
16
|
+
</g>
|
17
|
+
</g>
|
18
|
+
</g>
|
19
|
+
</svg>
|
data/renovate.json
ADDED
data/screenshot.png
CHANGED
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-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 || ENV['PICKS']
|
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 95
|
19
|
+
SimpleCov.minimum_coverage_by_file 90
|
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_backtrace.rb
CHANGED
@@ -1,41 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (
|
4
|
-
#
|
5
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
6
|
-
#
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
12
|
-
# furnished to do so, subject to the following conditions:
|
13
|
-
#
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
15
|
-
# copies or substantial portions of the Software.
|
16
|
-
#
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
-
# SOFTWARE.
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
24
5
|
|
25
|
-
require 'minitest/autorun'
|
26
6
|
require_relative '../lib/backtrace'
|
7
|
+
require_relative 'test__helper'
|
27
8
|
|
28
9
|
# Backtract test.
|
29
10
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
-
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
|
11
|
+
# Copyright:: Copyright (c) 2018-2025 Yegor Bugayenko
|
31
12
|
# License:: MIT
|
32
13
|
class BacktraceTest < Minitest::Test
|
33
14
|
def test_prints_exception
|
34
15
|
raise 'Just a test'
|
35
16
|
rescue StandardError => e
|
36
17
|
text = Backtrace.new(e).to_s
|
37
|
-
|
38
|
-
|
18
|
+
assert_includes(text, "RuntimeError: Just a test\n", text)
|
19
|
+
assert_includes(text, 'test/test_backtrace.rb', text)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_prints_synthetic_exception
|
23
|
+
text = Backtrace.new(StandardError.new('boom!')).to_s
|
24
|
+
assert_includes(text, 'StandardError: boom!', text)
|
39
25
|
end
|
40
26
|
|
41
27
|
def test_runs_a_block
|
@@ -43,7 +29,7 @@ class BacktraceTest < Minitest::Test
|
|
43
29
|
Backtrace.exec(swallow: true, log: log) do
|
44
30
|
raise 'It is intended'
|
45
31
|
end
|
46
|
-
|
32
|
+
assert_includes(log.sent, 'intended')
|
47
33
|
end
|
48
34
|
|
49
35
|
def test_runs_a_block_to_console
|
@@ -60,6 +46,7 @@ class BacktraceTest < Minitest::Test
|
|
60
46
|
|
61
47
|
class FakeLog
|
62
48
|
attr_reader :sent
|
49
|
+
|
63
50
|
def error(msg)
|
64
51
|
@sent = msg
|
65
52
|
end
|
metadata
CHANGED
@@ -1,86 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backtrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
name: minitest
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.11'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5.11'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '12.3'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '12.3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rdoc
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '4.2'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '4.2'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.58.1
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.58.1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.27.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.27.0
|
83
|
-
description: Nicely prints Ruby backtrace
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies: []
|
12
|
+
description: Nicely prints Ruby backtrace to the console
|
84
13
|
email: yegor256@gmail.com
|
85
14
|
executables: []
|
86
15
|
extensions: []
|
@@ -88,23 +17,38 @@ extra_rdoc_files:
|
|
88
17
|
- README.md
|
89
18
|
files:
|
90
19
|
- ".0pdd.yml"
|
20
|
+
- ".github/workflows/actionlint.yml"
|
21
|
+
- ".github/workflows/copyrights.yml"
|
22
|
+
- ".github/workflows/markdown-lint.yml"
|
23
|
+
- ".github/workflows/pdd.yml"
|
24
|
+
- ".github/workflows/rake.yml"
|
25
|
+
- ".github/workflows/reuse.yml"
|
26
|
+
- ".github/workflows/typos.yml"
|
27
|
+
- ".github/workflows/xcop.yml"
|
28
|
+
- ".github/workflows/yamllint.yml"
|
91
29
|
- ".gitignore"
|
92
30
|
- ".pdd"
|
93
31
|
- ".rubocop.yml"
|
94
32
|
- ".rultor.yml"
|
95
|
-
- ".travis.yml"
|
96
33
|
- Gemfile
|
34
|
+
- Gemfile.lock
|
35
|
+
- LICENSE.txt
|
36
|
+
- LICENSES/MIT.txt
|
97
37
|
- README.md
|
38
|
+
- REUSE.toml
|
98
39
|
- Rakefile
|
99
40
|
- backtrace.gemspec
|
100
41
|
- lib/backtrace.rb
|
42
|
+
- logo.svg
|
43
|
+
- renovate.json
|
101
44
|
- screenshot.png
|
45
|
+
- test/test__helper.rb
|
102
46
|
- test/test_backtrace.rb
|
103
|
-
homepage:
|
47
|
+
homepage: https://github.com/yegor256/backtrace
|
104
48
|
licenses:
|
105
49
|
- MIT
|
106
|
-
metadata:
|
107
|
-
|
50
|
+
metadata:
|
51
|
+
rubygems_mfa_required: 'true'
|
108
52
|
rdoc_options:
|
109
53
|
- "--charset=UTF-8"
|
110
54
|
require_paths:
|
@@ -120,10 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
64
|
- !ruby/object:Gem::Version
|
121
65
|
version: '0'
|
122
66
|
requirements: []
|
123
|
-
|
124
|
-
|
125
|
-
signing_key:
|
126
|
-
specification_version: 2
|
67
|
+
rubygems_version: 3.6.7
|
68
|
+
specification_version: 4
|
127
69
|
summary: Backtrace printer
|
128
|
-
test_files:
|
129
|
-
- test/test_backtrace.rb
|
70
|
+
test_files: []
|