jekyll-chatgpt-translate 0.0.45 → 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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +2 -21
  3. data/.github/workflows/actionlint.yml +25 -0
  4. data/.github/workflows/copyrights.yml +19 -0
  5. data/.github/workflows/markdown-lint.yml +7 -24
  6. data/.github/workflows/pdd.yml +19 -0
  7. data/.github/workflows/rake.yml +10 -27
  8. data/.github/workflows/reuse.yml +19 -0
  9. data/.github/workflows/typos.yml +19 -0
  10. data/.github/workflows/xcop.yml +19 -0
  11. data/.github/workflows/yamllint.yml +6 -23
  12. data/.gitignore +9 -3
  13. data/.rubocop.yml +12 -22
  14. data/.rultor.yml +4 -22
  15. data/Gemfile +14 -29
  16. data/LICENSE.txt +1 -1
  17. data/LICENSES/MIT.txt +21 -0
  18. data/README.md +5 -5
  19. data/REUSE.toml +35 -0
  20. data/Rakefile +3 -31
  21. data/features/cli.feature +2 -0
  22. data/features/gem_package.feature +2 -0
  23. data/features/step_definitions/steps.rb +2 -19
  24. data/features/support/env.rb +2 -19
  25. data/jekyll-chatgpt-translate.gemspec +12 -30
  26. data/lib/jekyll-chatgpt-translate/chatgpt.rb +5 -24
  27. data/lib/jekyll-chatgpt-translate/generator.rb +10 -23
  28. data/lib/jekyll-chatgpt-translate/pars.rb +3 -22
  29. data/lib/jekyll-chatgpt-translate/permalink.rb +3 -22
  30. data/lib/jekyll-chatgpt-translate/ping.rb +4 -23
  31. data/lib/jekyll-chatgpt-translate/plain.rb +3 -22
  32. data/lib/jekyll-chatgpt-translate/prompt.rb +3 -22
  33. data/lib/jekyll-chatgpt-translate/version.rb +3 -22
  34. data/lib/jekyll-chatgpt-translate.rb +2 -21
  35. data/logo.png +0 -0
  36. data/test/test__helper.rb +31 -24
  37. data/test/test_chatgpt.rb +4 -24
  38. data/test/test_generator.rb +3 -23
  39. data/test/test_pars.rb +3 -23
  40. data/test/test_permalink.rb +3 -23
  41. data/test/test_ping.rb +7 -27
  42. data/test/test_plain.rb +4 -24
  43. data/test/test_prompt.rb +5 -25
  44. metadata +56 -34
data/test/test_pars.rb CHANGED
@@ -1,34 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
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-2026 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/pars'
28
8
 
29
9
  # Test for Pars.
30
10
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
11
+ # Copyright:: Copyright (c) 2023-2026 Yegor Bugayenko
32
12
  # License:: MIT
33
13
  class GptTranslate::ParsTest < Minitest::Test
34
14
  def test_simple_cases
@@ -1,34 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
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-2026 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-2024 Yegor Bugayenko
11
+ # Copyright:: Copyright (c) 2023-2026 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
- # (The MIT License)
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-2026 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-2024 Yegor Bugayenko
14
+ # Copyright:: Copyright (c) 2023-2026 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
- assert(!ping.download.nil?)
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
- assert(ping.download.nil?)
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
- assert(ping.download.nil?)
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
- # (The MIT License)
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.
24
-
25
- require 'minitest/autorun'
3
+ # SPDX-FileCopyrightText: Copyright (c) 2023-2026 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-2024 Yegor Bugayenko
11
+ # Copyright:: Copyright (c) 2023-2026 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
- # (The MIT License)
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-2026 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-2024 Yegor Bugayenko
11
+ # Copyright:: Copyright (c) 2023-2026 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
- assert(
58
- GptTranslate::Prompt.new("Hello,\n\nJeff!", 'en', 'zh').to_s.include?("\"Hello,\n\nJeff!\"")
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,127 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-chatgpt-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.45
4
+ version: 0.2.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: 2024-04-20 00:00:00.000000000 Z
11
+ date: 2026-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.3'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: humanize
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ">="
31
+ - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '2'
33
+ version: '3.1'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ">="
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '2'
40
+ version: '3.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: iri
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ">="
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: '0.11'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ">="
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: '0.11'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: iso-639
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ">="
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: '0.3'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ">="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: '0.3'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: jekyll
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '3'
75
+ version: '3.10'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '3'
82
+ version: '3.10'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: json
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ">="
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '2'
89
+ version: '2.18'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ">="
94
+ - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '2'
96
+ version: '2.18'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: redcarpet
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ">="
101
+ - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '3'
103
+ version: '3.6'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ">="
108
+ - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '3'
110
+ version: '3.6'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: ruby-openai
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ">="
115
+ - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '5'
117
+ version: '8.3'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ">="
122
+ - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '5'
124
+ version: '8.3'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: tiktoken_ruby
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ">="
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: 0.0.6
131
+ version: '0.0'
118
132
  type: :runtime
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ">="
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: 0.0.6
138
+ version: '0.0'
125
139
  description: Add this plugin to your Jekyll site and all posts will be automatically
126
140
  translated to the languages of your choice through ChatGPT
127
141
  email: yegor256@gmail.com
@@ -132,8 +146,14 @@ extra_rdoc_files:
132
146
  - LICENSE.txt
133
147
  files:
134
148
  - ".0pdd.yml"
149
+ - ".github/workflows/actionlint.yml"
150
+ - ".github/workflows/copyrights.yml"
135
151
  - ".github/workflows/markdown-lint.yml"
152
+ - ".github/workflows/pdd.yml"
136
153
  - ".github/workflows/rake.yml"
154
+ - ".github/workflows/reuse.yml"
155
+ - ".github/workflows/typos.yml"
156
+ - ".github/workflows/xcop.yml"
137
157
  - ".github/workflows/yamllint.yml"
138
158
  - ".gitignore"
139
159
  - ".pdd"
@@ -141,7 +161,9 @@ files:
141
161
  - ".rultor.yml"
142
162
  - Gemfile
143
163
  - LICENSE.txt
164
+ - LICENSES/MIT.txt
144
165
  - README.md
166
+ - REUSE.toml
145
167
  - Rakefile
146
168
  - features/cli.feature
147
169
  - features/gem_package.feature