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.
Files changed (43) 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 +6 -23
  6. data/.github/workflows/pdd.yml +19 -0
  7. data/.github/workflows/rake.yml +9 -26
  8. data/.github/workflows/reuse.yml +19 -0
  9. data/.github/workflows/xcop.yml +19 -0
  10. data/.github/workflows/yamllint.yml +5 -22
  11. data/.gitignore +9 -3
  12. data/.rubocop.yml +11 -22
  13. data/.rultor.yml +4 -22
  14. data/Gemfile +14 -29
  15. data/LICENSE.txt +1 -1
  16. data/LICENSES/MIT.txt +21 -0
  17. data/README.md +10 -6
  18. data/REUSE.toml +35 -0
  19. data/Rakefile +3 -31
  20. data/features/cli.feature +2 -0
  21. data/features/gem_package.feature +2 -0
  22. data/features/step_definitions/steps.rb +2 -19
  23. data/features/support/env.rb +2 -19
  24. data/jekyll-chatgpt-translate.gemspec +11 -30
  25. data/lib/jekyll-chatgpt-translate/chatgpt.rb +5 -24
  26. data/lib/jekyll-chatgpt-translate/generator.rb +8 -23
  27. data/lib/jekyll-chatgpt-translate/pars.rb +3 -22
  28. data/lib/jekyll-chatgpt-translate/permalink.rb +3 -22
  29. data/lib/jekyll-chatgpt-translate/ping.rb +3 -22
  30. data/lib/jekyll-chatgpt-translate/plain.rb +3 -22
  31. data/lib/jekyll-chatgpt-translate/prompt.rb +3 -22
  32. data/lib/jekyll-chatgpt-translate/version.rb +3 -22
  33. data/lib/jekyll-chatgpt-translate.rb +2 -21
  34. data/logo.png +0 -0
  35. data/test/test__helper.rb +30 -24
  36. data/test/test_chatgpt.rb +4 -24
  37. data/test/test_generator.rb +3 -23
  38. data/test/test_pars.rb +3 -23
  39. data/test/test_permalink.rb +3 -23
  40. data/test/test_ping.rb +7 -27
  41. data/test/test_plain.rb +4 -24
  42. data/test/test_prompt.rb +5 -25
  43. metadata +9 -2
@@ -1,23 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2023-2024 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 NONINFINGEMENT. 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) 2023-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'simplecov'
@@ -1,26 +1,7 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'English'
26
7
 
@@ -28,7 +9,7 @@ Gem::Specification.new do |s|
28
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
29
10
  s.required_ruby_version = '>= 3.0'
30
11
  s.name = 'jekyll-chatgpt-translate'
31
- s.version = '0.0.44'
12
+ s.version = '0.1.0'
32
13
  s.license = 'MIT'
33
14
  s.summary = 'Translate Jekyll Pages Through ChatGPT'
34
15
  s.description = [
@@ -42,13 +23,13 @@ Gem::Specification.new do |s|
42
23
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
43
24
  s.rdoc_options = ['--charset=UTF-8']
44
25
  s.extra_rdoc_files = %w[README.md LICENSE.txt]
45
- s.add_runtime_dependency 'humanize', '>= 2'
46
- s.add_runtime_dependency 'iri', '>= 0'
47
- s.add_runtime_dependency 'iso-639', '>= 0'
48
- s.add_runtime_dependency 'jekyll', '>= 3'
49
- s.add_runtime_dependency 'json', '>= 2'
50
- s.add_runtime_dependency 'redcarpet', '>= 3'
51
- s.add_runtime_dependency 'ruby-openai', '>= 5'
52
- s.add_runtime_dependency 'tiktoken_ruby', '>= 0.0.6'
26
+ s.add_dependency 'humanize', '>= 2'
27
+ s.add_dependency 'iri', '>= 0'
28
+ s.add_dependency 'iso-639', '>= 0'
29
+ s.add_dependency 'jekyll', '>= 3'
30
+ s.add_dependency 'json', '>= 2'
31
+ s.add_dependency 'redcarpet', '>= 3'
32
+ s.add_dependency 'ruby-openai', '>= 5'
33
+ s.add_dependency 'tiktoken_ruby', '>= 0.0.6'
53
34
  s.metadata['rubygems_mfa_required'] = 'true'
54
35
  end
@@ -1,26 +1,7 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'jekyll'
26
7
  require 'json'
@@ -35,7 +16,7 @@ module GptTranslate; end
35
16
 
36
17
  # Abstraction of ChatGPT.
37
18
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
38
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
19
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
39
20
  # License:: MIT
40
21
  class GptTranslate::ChatGPT
41
22
  # Is TRUE if we already shown to the user the available models.
@@ -89,9 +70,9 @@ class GptTranslate::ChatGPT
89
70
  ready[i] = "> #{translate_par(par[2..])}"
90
71
  elsif par.start_with?('* ')
91
72
  ready[i] = "* #{translate_par(par[2..])}"
92
- elsif par =~ /^[0-9]+\. /
73
+ elsif /^[0-9]+\. /.match?(par)
93
74
  ready[i] = "1. #{translate_par(par.split('.', 2)[1])}"
94
- elsif par =~ /^[^\p{Alnum}\*'"\[]/
75
+ elsif /^[^\p{Alnum}\*'"\[]/.match?(par)
95
76
  Jekyll.logger.debug("Not translating this, b/c it's not a plain text: #{par.inspect}")
96
77
  ready[i] = par
97
78
  else
@@ -1,26 +1,7 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'jekyll'
26
7
  require 'fileutils'
@@ -36,7 +17,7 @@ module GptTranslate; end
36
17
 
37
18
  # Pages generator.
38
19
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
39
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
20
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
40
21
  # License:: MIT
41
22
  class GptTranslate::Generator < Jekyll::Generator
42
23
  safe true
@@ -44,6 +25,10 @@ class GptTranslate::Generator < Jekyll::Generator
44
25
 
45
26
  # Main plugin action, called by Jekyll-core
46
27
  def generate(site)
28
+ if ARGV.include?('--offline')
29
+ Jekyll.logger.info("jekyll-chatgpt-translate #{GptTranslate::VERSION} skipped, due to the --offline option")
30
+ return
31
+ end
47
32
  Jekyll.logger.info("jekyll-chatgpt-translate #{GptTranslate::VERSION} starting...")
48
33
  config ||= site.config['chatgpt-translate'] || {}
49
34
  home = config['tmpdir'] || '_chatgpt-translate'
@@ -117,7 +102,7 @@ class GptTranslate::Generator < Jekyll::Generator
117
102
  gpt = GptTranslate::ChatGPT.new(
118
103
  key,
119
104
  model,
120
- config['source'] || 'en',
105
+ target['source'] || config['source'] || 'en',
121
106
  lang
122
107
  )
123
108
  foreign = gpt.translate(
@@ -1,33 +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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  # The module we are in.
26
7
  module GptTranslate; end
27
8
 
28
9
  # Markdown broken down ito pars.
29
10
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
11
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
31
12
  # License:: MIT
32
13
  class GptTranslate::Pars
33
14
  # Ctor.
@@ -1,26 +1,7 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'cgi'
26
7
 
@@ -29,7 +10,7 @@ module GptTranslate; end
29
10
 
30
11
  # Permalink.
31
12
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
13
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
33
14
  # License:: MIT
34
15
  class GptTranslate::Permalink
35
16
  def initialize(doc, template)
@@ -1,26 +1,7 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'iri'
26
7
  require 'net/http'
@@ -36,7 +17,7 @@ module GptTranslate; end
36
17
 
37
18
  # Ping one page of a site.
38
19
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
39
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
20
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
40
21
  # License:: MIT
41
22
  class GptTranslate::Ping
42
23
  # Ctor.
@@ -1,26 +1,7 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'redcarpet'
26
7
 
@@ -29,7 +10,7 @@ module GptTranslate; end
29
10
 
30
11
  # Markdown to plain text.
31
12
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
13
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
33
14
  # License:: MIT
34
15
  class GptTranslate::Plain
35
16
  # Ctor.
@@ -1,26 +1,7 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'iso-639'
26
7
  require 'humanize'
@@ -30,7 +11,7 @@ module GptTranslate; end
30
11
 
31
12
  # Prompt for ChatGPT.
32
13
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
14
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
34
15
  # License:: MIT
35
16
  class GptTranslate::Prompt
36
17
  # Ctor.
@@ -1,27 +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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  module GptTranslate
26
- VERSION = '0.0.44'
7
+ VERSION = '0.1.0'
27
8
  end
@@ -1,25 +1,6 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'jekyll-chatgpt-translate/generator'
data/logo.png CHANGED
Binary file
data/test/test__helper.rb CHANGED
@@ -1,39 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2023-2024 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 NONINFINGEMENT. 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) 2023-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  $stdout.sync = true
24
7
 
25
8
  require 'simplecov'
26
- SimpleCov.start
9
+ require 'simplecov-cobertura'
10
+ unless SimpleCov.running
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 85
19
+ SimpleCov.minimum_coverage_by_file 80
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/reporters'
30
+ Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
31
+
32
+ require 'minitest/autorun'
27
33
 
28
34
  require 'jekyll'
29
- Jekyll.logger.adjust_verbosity(verbose: true)
35
+ Jekyll.logger.adjust_verbosity(verbose: false)
30
36
 
31
37
  # The module we are in.
32
38
  module GptTranslate; end
33
39
 
34
40
  # Fake.
35
41
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
36
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
42
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
37
43
  # License:: MIT
38
44
  class GptTranslate::FakeSite
39
45
  attr_reader :config, :pages, :static_files
@@ -81,7 +87,7 @@ end
81
87
 
82
88
  # Fake.
83
89
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
84
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
90
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
85
91
  # License:: MIT
86
92
  class GptTranslate::FakeDocument
87
93
  attr_reader :data
@@ -118,7 +124,7 @@ end
118
124
 
119
125
  # Fake.
120
126
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
121
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
127
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
122
128
  # License:: MIT
123
129
  class GptTranslate::FakePosts
124
130
  attr_reader :config
data/test/test_chatgpt.rb CHANGED
@@ -1,35 +1,15 @@
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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
5
+
26
6
  require 'webmock/minitest'
27
7
  require_relative 'test__helper'
28
8
  require_relative '../lib/jekyll-chatgpt-translate/chatgpt'
29
9
 
30
10
  # ChatGPT test.
31
11
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
12
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
33
13
  # License:: MIT
34
14
  class GptTranslate::ChatGPTTest < Minitest::Test
35
15
  def test_short_text
@@ -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-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
- require 'minitest/autorun'
26
6
  require 'tmpdir'
27
7
  require 'webmock/minitest'
28
8
  require_relative 'test__helper'
@@ -30,7 +10,7 @@ require_relative '../lib/jekyll-chatgpt-translate/generator'
30
10
 
31
11
  # Generator test.
32
12
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2023-2024 Yegor Bugayenko
13
+ # Copyright:: Copyright (c) 2023-2025 Yegor Bugayenko
34
14
  # License:: MIT
35
15
  class GptTranslate::GeneratorTest < Minitest::Test
36
16
  def test_simple_scenario
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-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/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-2025 Yegor Bugayenko
32
12
  # License:: MIT
33
13
  class GptTranslate::ParsTest < Minitest::Test
34
14
  def test_simple_cases