pixab 2.5.0 → 2.6.1
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/localization/smartcat/SmartcatBatch.rb +17 -0
- data/lib/pixab/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bd7c2f70afda370b52d1053f29c31cf57de92b8b83773d2274062faa8ec7444
|
4
|
+
data.tar.gz: 5b708bdf573d20c2e8dd7386f706fd70e10674f28bdf51057d4c612ee8753d49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ce7a74b7b42ee05dd4db01ad342ccb4b0183926a92e450b20915fdf49bb063251536eca8e8964acb7e37dcc8d0b71c1b002e73f7d79a49618e0e35b38581eb1
|
7
|
+
data.tar.gz: 3aaa2d852128c0cbdc8fc1a9623dd37d3031e03926d2a823e626dea4ba059fabc56d02c38bd908505807b793dfe97deeeebdc59e48ba337c2295dd321603787f
|
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)
|
@@ -16,6 +16,10 @@ module Pixab
|
|
16
16
|
smartcat = Pixab::LocalizationSmartcat.new
|
17
17
|
new_commands = commands.nil? ? [] : commands
|
18
18
|
collections.each_with_index do |collection, index|
|
19
|
+
if is_skipped_collection(collection)
|
20
|
+
next
|
21
|
+
end
|
22
|
+
|
19
23
|
new_commands.push('--collections', collection)
|
20
24
|
if index > 0
|
21
25
|
new_commands.push('--mode', 'a')
|
@@ -24,6 +28,19 @@ module Pixab
|
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
31
|
+
# 判断合集后缀为-debug, -ongoing, -bug时。忽略此合集拉取
|
32
|
+
def is_skipped_collection(collection)
|
33
|
+
if collection.nil?
|
34
|
+
return true
|
35
|
+
end
|
36
|
+
|
37
|
+
if collection.end_with?('-debug', '-ongoing', '-bug')
|
38
|
+
return true
|
39
|
+
end
|
40
|
+
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
|
27
44
|
end
|
28
45
|
|
29
46
|
end
|
data/lib/pixab/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 廖再润
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored2
|