Class: ModpackLocalizer::JAR::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/modpack_localizer/jar/writer.rb

Overview

.jarファイルを翻訳してリソースパックを作成するクラス

Constant Summary collapse

PACK_FORMAT =

1.19.2

9

Instance Method Summary collapse

Constructor Details

#initializeModpackLocalizer::JAR::Writer



11
12
13
14
# File 'lib/modpack_localizer/jar/writer.rb', line 11

def initialize
  @output_path_base = "output/mods/modpack_localizer"
  @output_path = nil
end

Instance Method Details

#make_resource_pack(results) ⇒ void

This method returns an undefined value.

リソースパックを作成する

Parameters:



20
21
22
23
24
25
26
27
28
29
# File 'lib/modpack_localizer/jar/writer.rb', line 20

def make_resource_pack(results)
  results.file_name = replace_default_locale_code(results.file_name.name, results.locale_code)
  @output_path = merge_base_path(results.file_name)

  make_file(@output_path, results.json)
  mcmeta_info = mcmeta(PACK_FORMAT, results.locale_code)
  make_file(mcmeta_info[:file_path], mcmeta_info[:meta_data])

  zipping_resource_pack
end

#remove_before_zipping_directoryObject

zipにする前に作成したリソースパックを削除する return [void]



33
34
35
# File 'lib/modpack_localizer/jar/writer.rb', line 33

def remove_before_zipping_directory
  FileUtils.rm_rf(@output_path_base)
end