pixab 2.5.0 → 2.6.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.
- checksums.yaml +4 -4
- data/exe/pixab +3 -3
- data/lib/localization/smartcat/LocalizationSmartcat.rb +23 -13
- data/lib/pixab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33b23dbba4b6ae53666ba3ff936c868143cc3a7926d7bf61738a3cc0709a092b
|
4
|
+
data.tar.gz: 86b9a0d5878707673ba300b87ae77837d7ff22cba239ab012598f0ae30e6c8e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e418e5acf0a57ece9ccc811a460c58b97a8105dc67ba70a92826af07f9d8883e0816099cbf6a0e97b03318a48282234335a9ce4de7eb9fc6627db77bc10e4df3
|
7
|
+
data.tar.gz: 79536dd5536769dfc6392eaf7ebc17ade6129a3add815776d562f78fd9b0ad400b1b3755d1463805a1d72f2ca8f4f92eb6e164fe2ce8ba8f94507bcea938160c
|
data/exe/pixab
CHANGED
@@ -7,7 +7,7 @@ require_relative '../lib/projects/MergeRequest.rb'
|
|
7
7
|
require_relative '../lib/projects/ComponentSynchronizer.rb'
|
8
8
|
require_relative '../lib/projects/Package.rb'
|
9
9
|
require_relative '../lib/localization/phrase/Localization.rb'
|
10
|
-
require_relative '../lib/localization/smartcat/
|
10
|
+
require_relative '../lib/localization/smartcat/SmartcatBatch.rb'
|
11
11
|
require_relative '../lib/localization/smartcat/LocalizationSmartcatImport.rb'
|
12
12
|
require_relative '../lib/localization/smartcat/LocalizationSmartcatMerge.rb'
|
13
13
|
require_relative '../lib/mbox/Mbox.rb'
|
@@ -51,10 +51,10 @@ when 'localize'
|
|
51
51
|
when 'merge'
|
52
52
|
Pixab::LocalizationSmartcatMerge.new.run(ARGV[2..-1])
|
53
53
|
else
|
54
|
-
Pixab::
|
54
|
+
Pixab::SmartcatBatch.new.run(ARGV[1..-1])
|
55
55
|
end
|
56
56
|
else
|
57
|
-
Pixab::
|
57
|
+
Pixab::SmartcatBatch.new.run(ARGV[1..-1])
|
58
58
|
end
|
59
59
|
when 'mbox'
|
60
60
|
Pixab::Mbox.new.run(ARGV[1..-1])
|
@@ -71,15 +71,18 @@ module Pixab
|
|
71
71
|
export_params = generate_export_params
|
72
72
|
download_url = 'https://smartcat.com/api/integration/v1/document/export'
|
73
73
|
|
74
|
-
puts "\n
|
74
|
+
puts "\n📥 正在导出【#{@collections}】文案".green
|
75
75
|
export_id = fetch_export_id(export_url, export_params)
|
76
76
|
export_id = export_id.tr('"','')
|
77
|
-
|
78
|
-
|
79
|
-
unzip_file(Localization_FILE_NAME)
|
80
|
-
puts "\n✅ #{@collections}文案更新已完成!".green
|
77
|
+
unless download_zip_file_with_retry(download_url, export_id)
|
78
|
+
return
|
81
79
|
end
|
82
80
|
|
81
|
+
unless unzip_file(Localization_FILE_NAME)
|
82
|
+
return
|
83
|
+
end
|
84
|
+
|
85
|
+
puts "\n✅ #{@collections}文案更新已完成!".green
|
83
86
|
end
|
84
87
|
|
85
88
|
# 第一步:通过POST请求获取export ID
|
@@ -127,19 +130,26 @@ module Pixab
|
|
127
130
|
|
128
131
|
# 第三步:解压缩ZIP文件
|
129
132
|
def unzip_file(zip_path)
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
is_success = true
|
134
|
+
begin
|
135
|
+
Zip::File.open(zip_path) do |zip_file|
|
136
|
+
case platform
|
137
|
+
when 'android'
|
138
|
+
unzip_file_android(zip_file)
|
139
|
+
when 'iOS'
|
140
|
+
unzip_file_iOS(zip_file)
|
141
|
+
else
|
142
|
+
unzip_file_common(zip_file)
|
143
|
+
end
|
138
144
|
end
|
145
|
+
rescue Zip::Error => e
|
146
|
+
puts "\nError: #{e.message}".red
|
147
|
+
is_success = false
|
139
148
|
end
|
140
149
|
|
141
150
|
File.delete(zip_path) if File.exist?(zip_path)
|
142
151
|
|
152
|
+
return is_success
|
143
153
|
end
|
144
154
|
|
145
155
|
def unzip_file_common(zip_file)
|
data/lib/pixab/version.rb
CHANGED