neeto-translate-cli 0.2.7 → 0.2.9

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: a99642e6a7302e4fd97a8bb9cda071fe97ec31b3ad9faae8b8b8275dfb0afd7a
4
- data.tar.gz: 0c6964b29f8d912441adb46791db159f8ebc5e28c052c9618bad21af8b3c363c
3
+ metadata.gz: 69664999355e94a492f7b2143f475555d5d34f74952be53360b636d08eacdd11
4
+ data.tar.gz: e662a70a78a0aa498611279feb5179bcb76e219c10d17678c4b365c6f68836bf
5
5
  SHA512:
6
- metadata.gz: 885a22b76117b8cc493c446f66ae9247c4759520edbc7adcaac6d4b488de885776c0624eb813b23151afda6d634f70b6b1be14daa3b0590c89c0e6bccf160b95
7
- data.tar.gz: a9a3b6ede2e72e06eae2d2f66abd6d856fc2de89650fef03c78de36c6b4d9a2036f723444d0372a92040bce51795a698081838b84c64b83b5eb598bd0a2d1811
6
+ metadata.gz: 9b0196c1e6a1afaa03af7689c547f8cfd00000b25d085f4e3ac708c517f39f977fb4159ea381fb25a7fbb0ac2c0ec878beedd89e40fc4acfb020ec094e4a7033
7
+ data.tar.gz: 225d4a6721608b13f41d86680080f916807d6cd08d52cf5d776b2696ebfb75d8900e3395374f8b913a497046f84f0296009421277d1a8e9e151fcd4ec3dab923
@@ -10,7 +10,7 @@ module NeetoTranslateCli
10
10
  def initialize(options)
11
11
  @options = options
12
12
  commit_id = git_commit_id
13
- @updated_keys = commit_id.empty? ? { frontend: {} } : find_updated_keys(commit_id)
13
+ @updated_keys = commit_id.empty? ? [] : find_updated_keys(commit_id)
14
14
  end
15
15
 
16
16
  def process!
@@ -39,11 +39,33 @@ module NeetoTranslateCli
39
39
  end
40
40
 
41
41
  def find_updated_keys(commit_id)
42
- updated_frontend_keys = {}
42
+ 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
+
43
49
  frontend_translations[:en].each do |file_path, content|
44
50
  lang_file_path = "#{options[:frontend]}/en/#{file_path}.json"
45
51
  relative_path_from_pwd = Pathname.new(lang_file_path).to_s
46
- previous_content = `git show #{commit_id}:#{relative_path_from_pwd}`
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
69
  next if previous_content.empty?
48
70
 
49
71
  previous_json = JSON.parse(previous_content)
@@ -54,31 +76,30 @@ module NeetoTranslateCli
54
76
  flat_previous_json.key?(key) && flat_current_json[key] != flat_previous_json[key]
55
77
  end
56
78
 
79
+ puts "DEBUG: updated_keys_for_file = #{updated_keys_for_file}"
80
+
57
81
  next if updated_keys_for_file.empty?
58
82
 
59
- updated_frontend_keys[lang_file_path] = updated_keys_for_file
83
+ updated_frontend_keys.concat(updated_keys_for_file.map { |key| "#{file_path}::#{key}" })
60
84
  end
61
- { frontend: updated_frontend_keys }
85
+
86
+ puts "DEBUG: final updated_frontend_keys = #{updated_frontend_keys}"
87
+ updated_frontend_keys
62
88
  end
63
89
 
64
90
  def find_missing_keys
65
- missing_keys = {}
66
91
  base_translations = frontend_translations[:en]
67
92
 
68
- options[:default_languages].each do |lang|
69
- missing_keys[lang] = []
70
- base_translations.each do |base_file_path, base_content|
93
+ options[:default_languages].each_with_object({}) do |lang, missing_keys|
94
+ missing_keys[lang] = base_translations.flat_map do |base_file_path, base_content|
71
95
  lang_file_path = "#{options[:frontend]}/#{lang}/#{base_file_path}.json"
72
96
 
73
97
  base_keys = flatten_hash(base_content).keys
74
98
  lang_keys = File.file?(lang_file_path) ? flatten_hash(load_json(lang_file_path)).keys : []
75
99
 
76
- missing_in_file = (base_keys - lang_keys).uniq
77
- missing_keys[lang].concat(missing_in_file.map { |key| "#{base_file_path}::#{key}" })
78
- end
100
+ (base_keys - lang_keys).map { |key| "#{base_file_path}::#{key}" } + updated_keys
101
+ end.uniq
79
102
  end
80
-
81
- missing_keys
82
103
  end
83
104
 
84
105
  def frontend_translations
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NeetoTranslateCli
4
- VERSION = "0.2.7"
4
+ VERSION = "0.2.9"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neeto-translate-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhay V Ashokan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-25 00:00:00.000000000 Z
11
+ date: 2025-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday