cocoapods-aomi-bin 0.1.12 → 0.1.13

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: 9cfcbfeeae134c9aacd50c954533008ba3236e50fcafe6e15bfef70e4bbc3973
4
- data.tar.gz: 864e6bc1e2a0f42ccff3794f19947cedbd4f8bde8115162f776e0017d4576ef1
3
+ metadata.gz: 5ae3af0a13e50fda02f0dc94b7167bcc90dfbaeb4dbf7e41dacbbf473adbf584
4
+ data.tar.gz: cf58dc5598b22637808983c72c38d7051d9c927aa34769c7a8cf8429c970e90a
5
5
  SHA512:
6
- metadata.gz: 755402a04f78ef6a944739939c8ae4a193a255bbef817f2556e61a19659fb3b7e70d59ed5f50f79ccf4aa60f7c5f851b59bf0ed8494fc0b98b695958f211f28f
7
- data.tar.gz: 174b6b7804b20c4a76d5805357e28a98360c4ff0d626cab0089b28f3252ecb62990aa3a736b23226983c775562ecb90ed58b7ac1c064f5aa2d130d27cfe8263b
6
+ metadata.gz: 3837f523f1839690351f4d660a2735daf00bd50641175c9bf95c77f8e4c2f851ec4f171e52ebbfedcaa0fb8bffd54285493ee31443c844834700f8b1f5b4b30b
7
+ data.tar.gz: 83f0c980b2e5a8459dd4e406b86ec68fb7b6dd55e79d282659d52cd936ef6595bd391a40f47430eb3aa863a7a14fa54ee575eb392f30641764d412639b888c2a
@@ -18,8 +18,8 @@ module Pod
18
18
  end
19
19
 
20
20
  def push_cn_hk
21
- file = File.expand_path("#{Pod::Config.instance.home_dir}/zh2hant.yml")
22
- CBin::OSS::Helper.instance.upload('zh2hant.yml', file)
21
+ file = File.expand_path("#{Pod::Config.instance.home_dir}/localizable_config.yml")
22
+ CBin::OSS::Helper.instance.upload('localizable_config.yml', file)
23
23
  end
24
24
 
25
25
  def push
@@ -42,7 +42,7 @@ module Pod
42
42
 
43
43
  def run
44
44
  down_load_csv_file if need_download
45
- read_csv_file
45
+ read_csv
46
46
  if @key_map.keys.length.positive?
47
47
  write_en_strings
48
48
  write_zh_hk_strings
@@ -122,12 +122,27 @@ module Pod
122
122
  download_keys
123
123
  end
124
124
 
125
- def read_csv_file
125
+ def read_csv
126
126
  path = File.join(@current_path, read_csv_file_name)
127
- Dir.glob(path).each do |p|
128
- CSV.foreach(p) do |row|
129
- key = row[@key_col]
130
- @key_map[key] = { key: key, zh: row[@cn_col], en: row[@en_col] } unless key =~ /[\u4e00-\u9fa5]/
127
+ Dir.glob(path).each do |f|
128
+ read_csv_file f
129
+ end
130
+ end
131
+
132
+ def read_csv_file(file)
133
+ key_c = CBin::LocalConfig.instance.get_col_by_name(file, 'csv_key_col')
134
+ cn_c = CBin::LocalConfig.instance.get_col_by_name(file, 'csv_cn_col')
135
+ en_c = CBin::LocalConfig.instance.get_col_by_name(file, 'csv_en_col')
136
+ trans_hk = CBin::LocalConfig.instance.get_col_by_name(file, 'trans_zh_hk')
137
+ trans_cn = CBin::LocalConfig.instance.get_col_by_name(file, 'trans_zh_cn')
138
+ CSV.foreach(file) do |row|
139
+ if row.length > 2
140
+ key = row[key_c]
141
+ cn_str = row[cn_c]
142
+ hk_str = row[cn_c]
143
+ cn_str = CBin::Trans::Helper.instance.trans_zh_cn_str(cn_str) if trans_cn
144
+ hk_str = CBin::Trans::Helper.instance.trans_zh_hk_str(hk_str) if trans_hk
145
+ @key_map[key] = { key: key, cn: cn_str, hk: hk_str, en: row[en_c] } unless key =~ /[\u4e00-\u9fa5]/
131
146
  end
132
147
  end
133
148
  end
@@ -194,17 +209,10 @@ module Pod
194
209
  @key_map.values[index][:key] if index
195
210
  end
196
211
 
197
- def format_str(type, area = :origin)
212
+ def format_str(type)
198
213
  str = ''
199
214
  @key_map.each do |k, v|
200
- val = v[type]
201
- case area
202
- when :hk
203
- val = CBin::Trans::Helper.instance.trans_zh_hk_str val
204
- when :cn
205
- val = CBin::Trans::Helper.instance.trans_zh_cn_str val
206
- end
207
- str += "\"#{k}\" = \"#{val}\";\n"
215
+ str += "\"#{k}\" = \"#{v[type]}\";\n"
208
216
  end
209
217
  str
210
218
  end
@@ -229,18 +237,12 @@ module Pod
229
237
  end
230
238
 
231
239
  def write_zh_cn_strings
232
- if CBin::LocalConfig.instance.config['gen_zh_cn']
233
- gen_zh_cn_strings_file
234
- else
235
- copy_hk_to_cn_file
236
- end
240
+ gen_zh_cn_strings_file
237
241
  end
238
242
 
239
243
  def gen_zh_cn_strings_file
240
244
  file = File.join(@current_path, zh_cn_dir_name, generate_file_name)
241
- area = :origin
242
- area = :cn if CBin::LocalConfig.instance.config['trans_zh_cn']
243
- content = format_str(:zh, area)
245
+ content = format_str(:cn)
244
246
  write_to_file(file, content)
245
247
  UI.puts "生成简体中文配置完成.文件路径:#{File.absolute_path(file)}\n".green
246
248
  end
@@ -254,9 +256,7 @@ module Pod
254
256
 
255
257
  def write_zh_hk_strings
256
258
  file = File.join(@current_path, zh_hk_dir_name, generate_file_name)
257
- area = :origin
258
- area = :hk if CBin::LocalConfig.instance.config['trans_zh_hk']
259
- content = format_str(:zh, area)
259
+ content = format_str(:hk)
260
260
  write_to_file(file, content)
261
261
  UI.puts "生成繁体中文配置完成.文件路径:#{File.absolute_path(file)}\n".green
262
262
  end
@@ -33,11 +33,16 @@ module CBin
33
33
  end
34
34
 
35
35
  def load_config
36
- if File.exist?(config_file)
37
- YAML.load_file(config_file)
38
- else
39
- default_config
40
- end
36
+ syn_config_file unless File.exist?(config_file)
37
+ YAML.load_file(config_file)
38
+ end
39
+
40
+ def get_col_by_name(file_name, col_name = 'csv_key_col')
41
+ m = config
42
+ col = m[col_name]
43
+ fo = m['read_targets'].find{ |o| /#{o['csv_file']}/ =~ file_name }
44
+ col = fo[col_name] if fo
45
+ col
41
46
  end
42
47
 
43
48
  def config
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = '0.1.12'
2
+ VERSION = '0.1.13'
3
3
  end
4
4
 
5
5
  module Pod
@@ -19,8 +19,8 @@ module CBin
19
19
  @bucket.put_object(key, :file => file)
20
20
  end
21
21
 
22
- def down_load(key, file)
23
- @bucket.get_object(key, :file => file)
22
+ def down_load(key, file, &block)
23
+ @bucket.get_object(key, :file => file, &block)
24
24
  end
25
25
 
26
26
  def object_url(key)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-aomi-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods