R3EXS 1.0.3 → 1.0.5
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/CHANGELOG.md +12 -0
- data/bin/R3EXS +18 -10
- data/lib/R3EXS/extract_strings.rb +2 -2
- data/lib/R3EXS/inject_strings.rb +10 -2
- data/lib/R3EXS/json_rvdata2.rb +2 -2
- data/lib/R3EXS/rvdata2_json.rb +10 -11
- data/lib/R3EXS/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d0aab9e1fbe2fdb0012fc2222c16254ada40699942e7fd969c22100fb974c7
|
4
|
+
data.tar.gz: 534e2e482ef2ff5fb9ae1814d06d82014a72fce10920610647138e7beae2831f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19c16fc2eac9df25d58a9e6a9b254ad3079d8dd0dba39936fed663b916b26b1a6f6e6fe158810f832c16cf522b36862cf0debaa82dd070c1a36e6d66a9bdbd93
|
7
|
+
data.tar.gz: a858596624ae00c8e263e2b82f57630a549b6ffee46197e9a69b616811c453391ae54766da743bd7f167bd9feffd6224c39fd563a0c30a35b3c10b7ba9f0aa42
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# [R3EXS]
|
2
2
|
|
3
|
+
## [1.0.5] - 2025-03-12
|
4
|
+
|
5
|
+
- rb_in_strings 方法里面添加将 Scripts_info.json 文件拷贝至目标目录里面,以避免后续报错
|
6
|
+
- 优化了一下 json_rvdata2 方法里的输出
|
7
|
+
|
8
|
+
## [1.0.4] - 2025-03-11
|
9
|
+
|
10
|
+
- 修复 rvdata2_json 方法里处理 Scripts 的 BUG
|
11
|
+
- rb_ex_strings 方法里 Extract 单词拼写修正
|
12
|
+
- oj 版本更新到 3.16.10
|
13
|
+
- redcarpet 版本更新到 3.6.1
|
14
|
+
|
3
15
|
## [1.0.3] - 2025-02-15
|
4
16
|
|
5
17
|
- 添加 RGSS3AFileError 类以处理加密格式不支持的问题
|
data/bin/R3EXS
CHANGED
@@ -61,7 +61,7 @@ class App
|
|
61
61
|
c.action do |global_options, options, args|
|
62
62
|
begin
|
63
63
|
R3EXS.rvdata2_json(args[0], options[:output_dir], options[:complete], options[:with_scripts], options[:with_notes])
|
64
|
-
|
64
|
+
puts "#{R3EXS::Utils::GREEN_COLOR}All JSON files have been written to #{options[:output_dir]}#{R3EXS::Utils::RESET_COLOR}"
|
65
65
|
rescue R3EXS::Rvdata2FileError => e
|
66
66
|
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
67
67
|
$stderr.puts 'Please make sure the rvdata2 files are not corrupted.'
|
@@ -93,7 +93,7 @@ class App
|
|
93
93
|
c.action do |global_options, options, args|
|
94
94
|
begin
|
95
95
|
R3EXS.json_rvdata2(args[0], options[:output_dir], options[:original_dir], options[:complete], options[:with_scripts])
|
96
|
-
|
96
|
+
puts "#{R3EXS::Utils::GREEN_COLOR}All new rvdata2 files have been written to #{options[:output_dir]}#{R3EXS::Utils::RESET_COLOR}"
|
97
97
|
rescue R3EXS::RPGJsonFileError => e
|
98
98
|
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
99
99
|
$stderr.puts 'Your JSON files are not in RPG module'
|
@@ -146,16 +146,20 @@ class App
|
|
146
146
|
c.action do |global_options, options, args|
|
147
147
|
begin
|
148
148
|
R3EXS.ex_strings(args[0], options[:output_dir], options[:with_scripts], options[:with_symbol], options[:with_scripts_separate])
|
149
|
-
|
149
|
+
if options[:with_scripts_separate]
|
150
|
+
puts "#{R3EXS::Utils::GREEN_COLOR}All strings have been extracted to #{File.join(options[:output_dir], 'ManualTransFile.json')} and #{File.join(options[:output_dir], 'ManualTransFile_scripts.json')}#{R3EXS::Utils::RESET_COLOR}"
|
151
|
+
else
|
152
|
+
puts "#{R3EXS::Utils::GREEN_COLOR}All strings have been extracted to #{File.join(options[:output_dir], 'ManualTransFile.json')}#{R3EXS::Utils::RESET_COLOR}"
|
153
|
+
end
|
150
154
|
rescue R3EXS::R3EXSJsonFileError => e
|
151
|
-
puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
155
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
152
156
|
$stderr.puts 'Your JSON files are not in R3EXS module'
|
153
157
|
$stderr.puts "You are #{R3EXS::Utils::RED_COLOR}NOT#{R3EXS::Utils::RESET_COLOR} supposed to use '#{R3EXS::Utils::GREEN_COLOR}-c#{R3EXS::Utils::RESET_COLOR}' or '#{R3EXS::Utils::GREEN_COLOR}--complete#{R3EXS::Utils::RESET_COLOR}' to enable complete serialization in #{R3EXS::Utils::GREEN_COLOR}rvdata2_json#{R3EXS::Utils::RESET_COLOR} subcommand"
|
154
158
|
$stderr.puts "For more information, please enter '#{R3EXS::Utils::GREEN_COLOR}R3EXS help json_rvdata2#{R3EXS::Utils::RESET_COLOR}'"
|
155
159
|
rescue R3EXS::JsonDirError => e
|
156
|
-
puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
160
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
157
161
|
rescue R3EXS::ScriptsDirError => e
|
158
|
-
puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
162
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
159
163
|
$stderr.puts "You are supposed to use '#{R3EXS::Utils::GREEN_COLOR}-s#{R3EXS::Utils::RESET_COLOR}' or '#{R3EXS::Utils::GREEN_COLOR}--scripts#{R3EXS::Utils::RESET_COLOR}' to enable serialization of Scripts in #{R3EXS::Utils::GREEN_COLOR}rvdata2_json#{R3EXS::Utils::RESET_COLOR} subcommand"
|
160
164
|
$stderr.puts "For more information, please enter '#{R3EXS::Utils::GREEN_COLOR}R3EXS help rvdata2_json#{R3EXS::Utils::RESET_COLOR}'"
|
161
165
|
end
|
@@ -183,18 +187,22 @@ class App
|
|
183
187
|
R3EXS.in_strings(args[0], options[:output_dir], options[:manualtransfile_path], options[:with_scripts])
|
184
188
|
puts "#{R3EXS::Utils::GREEN_COLOR}All new JSON files have been written to #{options[:output_dir]}#{R3EXS::Utils::RESET_COLOR}"
|
185
189
|
rescue R3EXS::R3EXSJsonFileError => e
|
186
|
-
puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
190
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
187
191
|
$stderr.puts 'Your JSON files are not in R3EXS module'
|
188
192
|
$stderr.puts "You are #{R3EXS::Utils::RED_COLOR}NOT#{R3EXS::Utils::RESET_COLOR} supposed to use '#{R3EXS::Utils::GREEN_COLOR}-c#{R3EXS::Utils::RESET_COLOR}' or '#{R3EXS::Utils::GREEN_COLOR}--complete#{R3EXS::Utils::RESET_COLOR}' to enable complete serialization in #{R3EXS::Utils::GREEN_COLOR}rvdata2_json#{R3EXS::Utils::RESET_COLOR} subcommand"
|
189
193
|
$stderr.puts "For more information, please enter '#{R3EXS::Utils::GREEN_COLOR}R3EXS help json_rvdata2#{R3EXS::Utils::RESET_COLOR}'"
|
190
194
|
rescue R3EXS::JsonDirError => e
|
191
|
-
puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
195
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
192
196
|
rescue R3EXS::ScriptsDirError => e
|
193
|
-
puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
197
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
194
198
|
$stderr.puts "You are supposed to use '#{R3EXS::Utils::GREEN_COLOR}-s#{R3EXS::Utils::RESET_COLOR}' or '#{R3EXS::Utils::GREEN_COLOR}--scripts#{R3EXS::Utils::RESET_COLOR}' to enable serialization of Scripts in #{R3EXS::Utils::GREEN_COLOR}rvdata2_json#{R3EXS::Utils::RESET_COLOR} subcommand"
|
195
199
|
$stderr.puts "For more information, please enter '#{R3EXS::Utils::GREEN_COLOR}R3EXS help rvdata2_json#{R3EXS::Utils::RESET_COLOR}'"
|
200
|
+
rescue R3EXS::ScriptsInfoPathError => e
|
201
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
202
|
+
$stderr.puts "Make sure the Scripts_info.json is in the #{args[0]}/Scripts directory"
|
203
|
+
$stderr.puts "For more information, please enter '#{R3EXS::Utils::GREEN_COLOR}R3EXS help rvdata2_json#{R3EXS::Utils::RESET_COLOR}'"
|
196
204
|
rescue R3EXS::ManualTransFilePathError => e
|
197
|
-
puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
205
|
+
$stderr.puts "#{R3EXS::Utils::RED_COLOR}#{e.message}#{R3EXS::Utils::RESET_COLOR}"
|
198
206
|
$stderr.puts "You are supposed to use #{R3EXS::Utils::GREEN_COLOR}ex_strings#{R3EXS::Utils::RESET_COLOR} subcommand to generate the ManualTransFile.json"
|
199
207
|
$stderr.puts "For more information, please enter '#{R3EXS::Utils::GREEN_COLOR}R3EXS help ex_strings#{R3EXS::Utils::RESET_COLOR}'"
|
200
208
|
end
|
@@ -22,11 +22,11 @@ module R3EXS
|
|
22
22
|
strings = []
|
23
23
|
strings_extractor = StringsExtractor.new(strings, with_symbol)
|
24
24
|
Dir.glob(File.join(full_dir, '*.rb')).each do |script_file_path|
|
25
|
-
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}
|
25
|
+
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}Extracting from #{Utils::RESET_COLOR}#{script_file_path}...\r" if $global_options[:verbose]
|
26
26
|
|
27
27
|
strings_extractor.visit(Prism.parse_file(script_file_path).value)
|
28
28
|
|
29
|
-
print "#{Utils::ESCAPE}#{Utils::GREEN_COLOR}
|
29
|
+
print "#{Utils::ESCAPE}#{Utils::GREEN_COLOR}Extracted #{Utils::RESET_COLOR}#{script_file_path}\n" if $global_options[:verbose]
|
30
30
|
end
|
31
31
|
strings
|
32
32
|
end
|
data/lib/R3EXS/inject_strings.rb
CHANGED
@@ -14,13 +14,20 @@ module R3EXS
|
|
14
14
|
# @param hash [Hash]
|
15
15
|
#
|
16
16
|
# @raise [ScriptsDirError] Scripts 目录不存在
|
17
|
+
# @raise [ScriptsInfoPathError] Scripts_info.json 文件不存在
|
17
18
|
#
|
18
19
|
# @return [void]
|
19
20
|
def R3EXS.rb_in_strings(target_dir, output_dir, hash)
|
20
|
-
target_full_dir
|
21
|
-
output_full_dir
|
21
|
+
target_full_dir = File.join(target_dir, 'Scripts')
|
22
|
+
output_full_dir = File.join(output_dir, 'Scripts')
|
23
|
+
script_info_file_path = File.join(target_full_dir, 'Scripts_info.json')
|
24
|
+
|
22
25
|
FileUtils.mkdir(output_full_dir) unless Dir.exist?(output_full_dir)
|
23
26
|
Dir.exist?(target_full_dir) or raise ScriptsDirError.new(target_full_dir), "Scripts directory not found: #{target_full_dir}"
|
27
|
+
File.exist?(script_info_file_path) or raise ScriptsInfoPathError.new(script_info_file_path), "Scripts_info.json not found: #{script_info_file_path}"
|
28
|
+
|
29
|
+
print "#{Utils::ESCAPE}#{Utils::YELLOW_COLOR}Copying #{Utils::RESET_COLOR}Scripts_info.json to #{output_full_dir}...\r" if $global_options[:verbose]
|
30
|
+
FileUtils.cp(script_info_file_path, output_full_dir)
|
24
31
|
|
25
32
|
Dir.glob(File.join(target_full_dir, "*.rb")).each do |script_file_path|
|
26
33
|
output_script_file_dir = File.join(output_full_dir, File.basename(script_file_path))
|
@@ -42,6 +49,7 @@ module R3EXS
|
|
42
49
|
# @raise [R3EXSJsonFileError] json 文件不是 R3EXS 模块中的对象
|
43
50
|
# @raise [JsonDirError] target_dir 不存在
|
44
51
|
# @raise [ScriptsDirError] Scripts 目录不存在
|
52
|
+
# @raise [ScriptsInfoPathError] Scripts_info.json 文件不存在
|
45
53
|
# @raise [ManualTransFilePath] ManualTransFile.json 不存在
|
46
54
|
#
|
47
55
|
# @return [void]
|
data/lib/R3EXS/json_rvdata2.rb
CHANGED
@@ -59,7 +59,7 @@ module R3EXS
|
|
59
59
|
if complete
|
60
60
|
Utils.all_json_files(target_dir, :RPG) do |object, file_basename|
|
61
61
|
file_path = File.join(output_dir, "#{file_basename}.rvdata2")
|
62
|
-
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}Serializing to #{Utils::RESET_COLOR}#{file_path}...\
|
62
|
+
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}Serializing to #{Utils::RESET_COLOR}#{file_path}...\r" if $global_options[:verbose]
|
63
63
|
Utils.object_rvdata2(object, file_path)
|
64
64
|
print "#{Utils::ESCAPE}#{Utils::GREEN_COLOR}Serialized #{Utils::RESET_COLOR}#{file_basename}\n" if $global_options[:verbose]
|
65
65
|
end
|
@@ -80,7 +80,7 @@ module R3EXS
|
|
80
80
|
end
|
81
81
|
|
82
82
|
file_path = File.join(output_dir, "#{file_basename}.rvdata2")
|
83
|
-
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}Serializing to #{Utils::RESET_COLOR}#{file_path}...\
|
83
|
+
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}Serializing to #{Utils::RESET_COLOR}#{file_path}...\r" if $global_options[:verbose]
|
84
84
|
|
85
85
|
# 根据是否为数组进行不同的处理
|
86
86
|
if object.is_a?(Array)
|
data/lib/R3EXS/rvdata2_json.rb
CHANGED
@@ -45,21 +45,20 @@ module R3EXS
|
|
45
45
|
def R3EXS.rvdata2_json(target_dir, output_dir, complete, with_scripts, with_notes)
|
46
46
|
FileUtils.mkdir(output_dir) unless Dir.exist?(output_dir)
|
47
47
|
Utils.all_rvdata2_files(target_dir) do |object, file_basename|
|
48
|
-
|
49
48
|
if file_basename == 'Scripts'
|
50
|
-
|
49
|
+
next unless with_scripts
|
50
|
+
scripts_rb(object, output_dir)
|
51
51
|
print "#{Utils::ESCAPE}#{Utils::GREEN_COLOR}Serialized #{Utils::RESET_COLOR}#{file_basename}\n" if $global_options[:verbose]
|
52
|
-
next
|
53
|
-
end
|
54
|
-
|
55
|
-
file_path = File.join(output_dir, "#{file_basename}.json")
|
56
|
-
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}Serializing to #{Utils::RESET_COLOR}#{file_path}...\r" if $global_options[:verbose]
|
57
|
-
if complete
|
58
|
-
Utils.object_json(object, file_path)
|
59
52
|
else
|
60
|
-
|
53
|
+
file_path = File.join(output_dir, "#{file_basename}.json")
|
54
|
+
print "#{Utils::ESCAPE}#{Utils::MAGENTA_COLOR}Serializing to #{Utils::RESET_COLOR}#{file_path}...\r" if $global_options[:verbose]
|
55
|
+
if complete
|
56
|
+
Utils.object_json(object, file_path)
|
57
|
+
else
|
58
|
+
Utils.object_json(Utils.rpg_r3exs(object, file_basename, with_notes), file_path)
|
59
|
+
end
|
60
|
+
print "#{Utils::ESCAPE}#{Utils::GREEN_COLOR}Serialized #{Utils::RESET_COLOR}#{file_basename}\n" if $global_options[:verbose]
|
61
61
|
end
|
62
|
-
print "#{Utils::ESCAPE}#{Utils::GREEN_COLOR}Serialized #{Utils::RESET_COLOR}#{file_basename}\n" if $global_options[:verbose]
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
data/lib/R3EXS/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: R3EXS
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LuoTat
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-12 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 3.6.
|
60
|
+
version: 3.6.1
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 3.6.
|
67
|
+
version: 3.6.1
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: ocran
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,14 +99,14 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 3.16.
|
102
|
+
version: 3.16.10
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 3.16.
|
109
|
+
version: 3.16.10
|
110
110
|
email: LuoTat.s@gmail.com
|
111
111
|
executables:
|
112
112
|
- R3EXS
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.6.
|
160
|
+
rubygems_version: 3.6.5
|
161
161
|
specification_version: 4
|
162
162
|
summary: A tool for extracting and translating strings from the RGSS3 game engine
|
163
163
|
test_files: []
|