jekyll-chatgpt-translate 0.0.44 → 0.1.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/.0pdd.yml +2 -21
- data/.github/workflows/actionlint.yml +25 -0
- data/.github/workflows/copyrights.yml +19 -0
- data/.github/workflows/markdown-lint.yml +6 -23
- data/.github/workflows/pdd.yml +19 -0
- data/.github/workflows/rake.yml +9 -26
- data/.github/workflows/reuse.yml +19 -0
- data/.github/workflows/xcop.yml +19 -0
- data/.github/workflows/yamllint.yml +5 -22
- data/.gitignore +9 -3
- data/.rubocop.yml +11 -22
- data/.rultor.yml +4 -22
- data/Gemfile +14 -29
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +10 -6
- data/REUSE.toml +35 -0
- data/Rakefile +3 -31
- data/features/cli.feature +2 -0
- data/features/gem_package.feature +2 -0
- data/features/step_definitions/steps.rb +2 -19
- data/features/support/env.rb +2 -19
- data/jekyll-chatgpt-translate.gemspec +11 -30
- data/lib/jekyll-chatgpt-translate/chatgpt.rb +5 -24
- data/lib/jekyll-chatgpt-translate/generator.rb +8 -23
- data/lib/jekyll-chatgpt-translate/pars.rb +3 -22
- data/lib/jekyll-chatgpt-translate/permalink.rb +3 -22
- data/lib/jekyll-chatgpt-translate/ping.rb +3 -22
- data/lib/jekyll-chatgpt-translate/plain.rb +3 -22
- data/lib/jekyll-chatgpt-translate/prompt.rb +3 -22
- data/lib/jekyll-chatgpt-translate/version.rb +3 -22
- data/lib/jekyll-chatgpt-translate.rb +2 -21
- data/logo.png +0 -0
- data/test/test__helper.rb +30 -24
- data/test/test_chatgpt.rb +4 -24
- data/test/test_generator.rb +3 -23
- data/test/test_pars.rb +3 -23
- data/test/test_permalink.rb +3 -23
- data/test/test_ping.rb +7 -27
- data/test/test_plain.rb +4 -24
- data/test/test_prompt.rb +5 -25
- metadata +9 -2
data/test/test_permalink.rb
CHANGED
@@ -1,34 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (
|
4
|
-
#
|
5
|
-
# Copyright (c) 2023-2024 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) 2023-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
24
5
|
|
25
|
-
require 'minitest/autorun'
|
26
6
|
require_relative 'test__helper'
|
27
7
|
require_relative '../lib/jekyll-chatgpt-translate/permalink'
|
28
8
|
|
29
9
|
# Permalink test.
|
30
10
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2023-
|
11
|
+
# Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
|
32
12
|
# License:: MIT
|
33
13
|
class GptTranslate::PermalinkTest < Minitest::Test
|
34
14
|
def test_simple_link
|
data/test/test_ping.rb
CHANGED
@@ -1,28 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (
|
4
|
-
#
|
5
|
-
# Copyright (c) 2023-2024 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) 2023-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
24
5
|
|
25
|
-
require 'minitest/autorun'
|
26
6
|
require 'webmock/minitest'
|
27
7
|
require 'jekyll'
|
28
8
|
require 'tempfile'
|
@@ -31,32 +11,32 @@ require_relative '../lib/jekyll-chatgpt-translate/ping'
|
|
31
11
|
|
32
12
|
# Ping test.
|
33
13
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
34
|
-
# Copyright:: Copyright (c) 2023-
|
14
|
+
# Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
|
35
15
|
# License:: MIT
|
36
16
|
class GptTranslate::PingTest < Minitest::Test
|
37
17
|
def test_when_exists
|
38
18
|
stub_request(:any, 'https://www.yegor256.com/about-me.html').to_return(body: 'Hello!')
|
39
19
|
site = GptTranslate::FakeSite.new({ 'url' => 'https://www.yegor256.com/' })
|
40
20
|
ping = GptTranslate::Ping.new(site, '/about-me.html')
|
41
|
-
|
21
|
+
refute_nil(ping.download)
|
42
22
|
end
|
43
23
|
|
44
24
|
def test_when_not_exists
|
45
25
|
stub_request(:any, 'https://www.yegor256.com/absent.html').to_return(status: 404)
|
46
26
|
site = GptTranslate::FakeSite.new({ 'url' => 'https://www.yegor256.com/' })
|
47
27
|
ping = GptTranslate::Ping.new(site, '/absent.html')
|
48
|
-
|
28
|
+
assert_nil(ping.download)
|
49
29
|
end
|
50
30
|
|
51
31
|
def test_wrong_address
|
52
32
|
WebMock.allow_net_connect!
|
53
33
|
site = GptTranslate::FakeSite.new({ 'url' => 'https://localhost:1/' })
|
54
34
|
ping = GptTranslate::Ping.new(site, '/boom.html')
|
55
|
-
|
35
|
+
assert_nil(ping.download)
|
56
36
|
end
|
57
37
|
|
58
38
|
def test_relative_path
|
59
|
-
assert_raises do
|
39
|
+
assert_raises(StandardError) do
|
60
40
|
GptTranslate::Ping.new({}, '404.html')
|
61
41
|
end
|
62
42
|
end
|
data/test/test_plain.rb
CHANGED
@@ -1,34 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (
|
4
|
-
#
|
5
|
-
|
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.
|
24
|
-
|
25
|
-
require 'minitest/autorun'
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2023-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
5
|
+
|
26
6
|
require_relative 'test__helper'
|
27
7
|
require_relative '../lib/jekyll-chatgpt-translate/plain'
|
28
8
|
|
29
9
|
# Plain test.
|
30
10
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2023-
|
11
|
+
# Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
|
32
12
|
# License:: MIT
|
33
13
|
class GptTranslate::PlainTest < Minitest::Test
|
34
14
|
def test_simple_map
|
data/test/test_prompt.rb
CHANGED
@@ -1,34 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (
|
4
|
-
#
|
5
|
-
# Copyright (c) 2023-2024 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) 2023-2025 Yegor Bugayenko
|
4
|
+
# SPDX-License-Identifier: MIT
|
24
5
|
|
25
|
-
require 'minitest/autorun'
|
26
6
|
require_relative 'test__helper'
|
27
7
|
require_relative '../lib/jekyll-chatgpt-translate/prompt'
|
28
8
|
|
29
9
|
# Prompt test.
|
30
10
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2023-
|
11
|
+
# Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
|
32
12
|
# License:: MIT
|
33
13
|
class GptTranslate::PromptTest < Minitest::Test
|
34
14
|
def head(source, target)
|
@@ -54,8 +34,8 @@ class GptTranslate::PromptTest < Minitest::Test
|
|
54
34
|
end
|
55
35
|
|
56
36
|
def test_multiple_paragraphs
|
57
|
-
|
58
|
-
GptTranslate::Prompt.new("Hello,\n\nJeff!", 'en', 'zh').to_s
|
37
|
+
assert_includes(
|
38
|
+
GptTranslate::Prompt.new("Hello,\n\nJeff!", 'en', 'zh').to_s, "\"Hello,\n\nJeff!\""
|
59
39
|
)
|
60
40
|
end
|
61
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-chatgpt-translate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: humanize
|
@@ -132,8 +132,13 @@ extra_rdoc_files:
|
|
132
132
|
- LICENSE.txt
|
133
133
|
files:
|
134
134
|
- ".0pdd.yml"
|
135
|
+
- ".github/workflows/actionlint.yml"
|
136
|
+
- ".github/workflows/copyrights.yml"
|
135
137
|
- ".github/workflows/markdown-lint.yml"
|
138
|
+
- ".github/workflows/pdd.yml"
|
136
139
|
- ".github/workflows/rake.yml"
|
140
|
+
- ".github/workflows/reuse.yml"
|
141
|
+
- ".github/workflows/xcop.yml"
|
137
142
|
- ".github/workflows/yamllint.yml"
|
138
143
|
- ".gitignore"
|
139
144
|
- ".pdd"
|
@@ -141,7 +146,9 @@ files:
|
|
141
146
|
- ".rultor.yml"
|
142
147
|
- Gemfile
|
143
148
|
- LICENSE.txt
|
149
|
+
- LICENSES/MIT.txt
|
144
150
|
- README.md
|
151
|
+
- REUSE.toml
|
145
152
|
- Rakefile
|
146
153
|
- features/cli.feature
|
147
154
|
- features/gem_package.feature
|