neeto-translate-cli 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bad5339300cb0c1c593de99fc39b90f92b5ca27fa61303a71f0c71d9a289f0c8
|
|
4
|
+
data.tar.gz: e04aa6853d444eb7fc384729896400822fcd09033e9f0e240a3b46bfab14a5fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47ea06d77e4a68268399506f7a25603c419bf5ba7248aa83a8d3f41a82e169b6e5ff65ec7c66f6ab65571bc07841e010dc097cdbe95a72830c5eeab1616f5ef7
|
|
7
|
+
data.tar.gz: 2f8e263f782b9b3c1d49e267009f10558569ce9e25079be8e61b30523c0c95fa0108c5a9b1bdd0276677711ceb5ed445d91db018ae63789d067bd0a825dcb29b
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NeetoTranslateCli
|
|
4
|
+
module GitHelper
|
|
5
|
+
def self.find_neeto_translate_commit
|
|
6
|
+
result = `git log --grep="[neeto-translate]" --fixed-strings -n 1 --pretty=format:"%H"`.strip
|
|
7
|
+
|
|
8
|
+
if result.empty?
|
|
9
|
+
result = progressive_fetch
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
result
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def self.progressive_fetch
|
|
18
|
+
puts "No neeto-translate commits found, fetching depth 50..."
|
|
19
|
+
`git fetch --depth=50 2>/dev/null`
|
|
20
|
+
result = `git log --grep="[neeto-translate]" --fixed-strings -n 1 --pretty=format:"%H"`.strip
|
|
21
|
+
|
|
22
|
+
return result unless result.empty?
|
|
23
|
+
|
|
24
|
+
puts "Still no commits found, fetching depth 100..."
|
|
25
|
+
`git fetch --depth=100 2>/dev/null`
|
|
26
|
+
result = `git log --grep="[neeto-translate]" --fixed-strings -n 1 --pretty=format:"%H"`.strip
|
|
27
|
+
|
|
28
|
+
return result unless result.empty?
|
|
29
|
+
|
|
30
|
+
puts "Still no commits found, fetching depth 500..."
|
|
31
|
+
`git fetch --depth=500 2>/dev/null`
|
|
32
|
+
result = `git log --grep="[neeto-translate]" --fixed-strings -n 1 --pretty=format:"%H"`.strip
|
|
33
|
+
|
|
34
|
+
return result unless result.empty?
|
|
35
|
+
|
|
36
|
+
puts "Still no commits found, fetching full history..."
|
|
37
|
+
`git fetch --unshallow 2>/dev/null`
|
|
38
|
+
`git log --grep="[neeto-translate]" --fixed-strings -n 1 --pretty=format:"%H"`.strip
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "pathname"
|
|
4
|
+
require_relative "../git_helper"
|
|
4
5
|
|
|
5
6
|
module NeetoTranslateCli
|
|
6
7
|
module NextI18next
|
|
@@ -35,37 +36,15 @@ module NeetoTranslateCli
|
|
|
35
36
|
private
|
|
36
37
|
|
|
37
38
|
def git_commit_id
|
|
38
|
-
|
|
39
|
+
GitHelper.find_neeto_translate_commit
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def find_updated_keys(commit_id)
|
|
42
43
|
updated_frontend_keys = []
|
|
43
|
-
|
|
44
|
-
# Debug: Log the commit_id and current working directory
|
|
45
|
-
puts "DEBUG: commit_id = '#{commit_id}'"
|
|
46
|
-
puts "DEBUG: current working directory = '#{Dir.pwd}'"
|
|
47
|
-
puts "DEBUG: frontend path = '#{options[:frontend]}'"
|
|
48
|
-
|
|
49
44
|
frontend_translations[:en].each do |file_path, content|
|
|
50
45
|
lang_file_path = "#{options[:frontend]}/en/#{file_path}.json"
|
|
51
46
|
relative_path_from_pwd = Pathname.new(lang_file_path).to_s
|
|
52
|
-
|
|
53
|
-
# Debug: Log the paths being used
|
|
54
|
-
puts "DEBUG: file_path = '#{file_path}'"
|
|
55
|
-
puts "DEBUG: lang_file_path = '#{lang_file_path}'"
|
|
56
|
-
puts "DEBUG: relative_path_from_pwd = '#{relative_path_from_pwd}'"
|
|
57
|
-
|
|
58
|
-
# Debug: Check if file exists
|
|
59
|
-
puts "DEBUG: file exists? #{File.exist?(relative_path_from_pwd)}"
|
|
60
|
-
|
|
61
|
-
# Debug: Try the git show command and log the result
|
|
62
|
-
git_command = "git show #{commit_id}:#{relative_path_from_pwd}"
|
|
63
|
-
puts "DEBUG: running git command: #{git_command}"
|
|
64
|
-
|
|
65
|
-
previous_content = `#{git_command}`
|
|
66
|
-
puts "DEBUG: git show result length = #{previous_content.length}"
|
|
67
|
-
puts "DEBUG: git show result (first 100 chars) = '#{previous_content[0..99]}'"
|
|
68
|
-
|
|
47
|
+
previous_content = `git show #{commit_id}:#{relative_path_from_pwd}`
|
|
69
48
|
next if previous_content.empty?
|
|
70
49
|
|
|
71
50
|
previous_json = JSON.parse(previous_content)
|
|
@@ -76,14 +55,11 @@ module NeetoTranslateCli
|
|
|
76
55
|
flat_previous_json.key?(key) && flat_current_json[key] != flat_previous_json[key]
|
|
77
56
|
end
|
|
78
57
|
|
|
79
|
-
puts "DEBUG: updated_keys_for_file = #{updated_keys_for_file}"
|
|
80
|
-
|
|
81
58
|
next if updated_keys_for_file.empty?
|
|
82
59
|
|
|
83
60
|
updated_frontend_keys.concat(updated_keys_for_file.map { |key| "#{file_path}::#{key}" })
|
|
84
61
|
end
|
|
85
62
|
|
|
86
|
-
puts "DEBUG: final updated_frontend_keys = #{updated_frontend_keys}"
|
|
87
63
|
updated_frontend_keys
|
|
88
64
|
end
|
|
89
65
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
require "yaml"
|
|
3
|
+
require_relative "git_helper"
|
|
3
4
|
|
|
4
5
|
module NeetoTranslateCli
|
|
5
6
|
class PayloadBuilder
|
|
@@ -31,7 +32,7 @@ module NeetoTranslateCli
|
|
|
31
32
|
private
|
|
32
33
|
|
|
33
34
|
def git_commit_id
|
|
34
|
-
|
|
35
|
+
GitHelper.find_neeto_translate_commit
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def en_json_flattened
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: neeto-translate-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abhay V Ashokan
|
|
@@ -40,6 +40,7 @@ files:
|
|
|
40
40
|
- exe/neeto-translate-cli
|
|
41
41
|
- lib/neeto_translate_cli/api.rb
|
|
42
42
|
- lib/neeto_translate_cli/cli.rb
|
|
43
|
+
- lib/neeto_translate_cli/git_helper.rb
|
|
43
44
|
- lib/neeto_translate_cli/next_i18next/payload_builder.rb
|
|
44
45
|
- lib/neeto_translate_cli/payload_builder.rb
|
|
45
46
|
- lib/neeto_translate_cli/translator.rb
|