ehbrs_ruby_utils 0.44.2 → 0.45.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.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs_ruby_utils/bga/game/image.rb +0 -1
  3. data/lib/ehbrs_ruby_utils/bga/game.rb +0 -2
  4. data/lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_content.rb +0 -2
  5. data/lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_title.rb +0 -2
  6. data/lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb +0 -3
  7. data/lib/ehbrs_ruby_utils/bga/game_statistics.rb +0 -2
  8. data/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress.rb +0 -3
  9. data/lib/ehbrs_ruby_utils/bga/parsers/game_stats/players.rb +0 -3
  10. data/lib/ehbrs_ruby_utils/bga/parsers/game_stats.rb +0 -3
  11. data/lib/ehbrs_ruby_utils/bga/parsers/table/active_players.rb +0 -3
  12. data/lib/ehbrs_ruby_utils/bga/parsers/table/ended_players.rb +0 -3
  13. data/lib/ehbrs_ruby_utils/bga/parsers/table/options.rb +0 -4
  14. data/lib/ehbrs_ruby_utils/bga/parsers/table.rb +1 -4
  15. data/lib/ehbrs_ruby_utils/bga/player.rb +0 -3
  16. data/lib/ehbrs_ruby_utils/bga/session/login.rb +1 -3
  17. data/lib/ehbrs_ruby_utils/bga/session/player.rb +0 -2
  18. data/lib/ehbrs_ruby_utils/bga/session/player_tables_on_game_in_progress.rb +0 -4
  19. data/lib/ehbrs_ruby_utils/bga/session/player_tables_on_game_stats.rb +1 -5
  20. data/lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb +0 -2
  21. data/lib/ehbrs_ruby_utils/bga/session/table.rb +0 -5
  22. data/lib/ehbrs_ruby_utils/bga/session/user.rb +0 -2
  23. data/lib/ehbrs_ruby_utils/bga/session.rb +0 -4
  24. data/lib/ehbrs_ruby_utils/bga/table/option.rb +0 -3
  25. data/lib/ehbrs_ruby_utils/bga/table/player.rb +0 -3
  26. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base/format_option.rb +0 -3
  27. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base/format_player.rb +0 -2
  28. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb +0 -3
  29. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/beginning/format_player.rb +0 -3
  30. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/beginning.rb +0 -3
  31. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/ending/format_player.rb +0 -3
  32. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/ending.rb +0 -3
  33. data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters.rb +0 -2
  34. data/lib/ehbrs_ruby_utils/bga/table.rb +0 -6
  35. data/lib/ehbrs_ruby_utils/bga/urls.rb +0 -3
  36. data/lib/ehbrs_ruby_utils/bga/whatsapp_formatter/option.rb +0 -2
  37. data/lib/ehbrs_ruby_utils/bga/whatsapp_formatter.rb +0 -2
  38. data/lib/ehbrs_ruby_utils/bga.rb +0 -2
  39. data/lib/ehbrs_ruby_utils/booking/parsers/list.rb +2 -4
  40. data/lib/ehbrs_ruby_utils/booking/processors/list/build_accommodation.rb +0 -2
  41. data/lib/ehbrs_ruby_utils/booking/processors/list.rb +0 -4
  42. data/lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb +0 -2
  43. data/lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb +0 -4
  44. data/lib/ehbrs_ruby_utils/circular_list_spreader/item_level.rb +0 -3
  45. data/lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb +0 -2
  46. data/lib/ehbrs_ruby_utils/circular_list_spreader/list.rb +0 -2
  47. data/lib/ehbrs_ruby_utils/circular_list_spreader.rb +0 -2
  48. data/lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb +0 -2
  49. data/lib/ehbrs_ruby_utils/cooking_book/build/index_page.rb +0 -3
  50. data/lib/ehbrs_ruby_utils/cooking_book/build/recipe_page.rb +0 -3
  51. data/lib/ehbrs_ruby_utils/cooking_book/build.rb +0 -3
  52. data/lib/ehbrs_ruby_utils/cooking_book/project.rb +0 -3
  53. data/lib/ehbrs_ruby_utils/cooking_book/recipe/ingredient.rb +0 -3
  54. data/lib/ehbrs_ruby_utils/cooking_book/recipe/measure.rb +0 -4
  55. data/lib/ehbrs_ruby_utils/cooking_book/recipe/part.rb +0 -4
  56. data/lib/ehbrs_ruby_utils/cooking_book/recipe.rb +0 -3
  57. data/lib/ehbrs_ruby_utils/cooking_book.rb +0 -2
  58. data/lib/ehbrs_ruby_utils/core_ext.rb +0 -2
  59. data/lib/ehbrs_ruby_utils/executables.rb +2 -4
  60. data/lib/ehbrs_ruby_utils/finances/bb_browser/docker_image.rb +0 -1
  61. data/lib/ehbrs_ruby_utils/fs/compressed_package.rb +0 -2
  62. data/lib/ehbrs_ruby_utils/fs/iso_9660_file.rb +0 -3
  63. data/lib/ehbrs_ruby_utils/fs/selected/build.rb +0 -3
  64. data/lib/ehbrs_ruby_utils/fs/selected/build_file.rb +0 -2
  65. data/lib/ehbrs_ruby_utils/fs/selected.rb +0 -1
  66. data/lib/ehbrs_ruby_utils/fs/to_file_format.rb +5 -3
  67. data/lib/ehbrs_ruby_utils/fs/to_utf8_unix.rb +0 -2
  68. data/lib/ehbrs_ruby_utils/fs/to_windows_pt_br.rb +0 -3
  69. data/lib/ehbrs_ruby_utils/fs.rb +0 -2
  70. data/lib/ehbrs_ruby_utils/gjt1/manager.rb +0 -6
  71. data/lib/ehbrs_ruby_utils/gjt1.rb +0 -2
  72. data/lib/ehbrs_ruby_utils/mudslide/message.rb +0 -3
  73. data/lib/ehbrs_ruby_utils/mudslide.rb +0 -2
  74. data/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb +0 -3
  75. data/lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb +0 -2
  76. data/lib/ehbrs_ruby_utils/music/lyrics_book/song.rb +0 -3
  77. data/lib/ehbrs_ruby_utils/music/lyrics_book.rb +0 -2
  78. data/lib/ehbrs_ruby_utils/music/ous/album.rb +0 -4
  79. data/lib/ehbrs_ruby_utils/music/ous/artist.rb +0 -4
  80. data/lib/ehbrs_ruby_utils/music/ous/category.rb +0 -3
  81. data/lib/ehbrs_ruby_utils/music/ous/node.rb +0 -2
  82. data/lib/ehbrs_ruby_utils/music/sort/files/base.rb +0 -2
  83. data/lib/ehbrs_ruby_utils/music/sort/files/factory.rb +0 -2
  84. data/lib/ehbrs_ruby_utils/music/sort/files/scanner.rb +0 -3
  85. data/lib/ehbrs_ruby_utils/music/sort/files.rb +0 -2
  86. data/lib/ehbrs_ruby_utils/music/sort.rb +0 -2
  87. data/lib/ehbrs_ruby_utils/music.rb +0 -2
  88. data/lib/ehbrs_ruby_utils/patches/object.rb +0 -1
  89. data/lib/ehbrs_ruby_utils/patches.rb +0 -1
  90. data/lib/ehbrs_ruby_utils/version.rb +1 -1
  91. data/lib/ehbrs_ruby_utils/vg/patchers/applier_factory.rb +38 -0
  92. data/lib/ehbrs_ruby_utils/vg/patchers/base_applier.rb +33 -0
  93. data/lib/ehbrs_ruby_utils/vg/patchers/bps_applier.rb +10 -0
  94. data/lib/ehbrs_ruby_utils/vg/patchers/ips_applier.rb +17 -0
  95. data/lib/ehbrs_ruby_utils/vg/patchers/temp_files.rb +36 -0
  96. data/lib/ehbrs_ruby_utils/vg/patchers/vcdiff_applier.rb +17 -0
  97. data/lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb +0 -3
  98. data/lib/ehbrs_ruby_utils/vg/ps2.rb +0 -2
  99. data/lib/ehbrs_ruby_utils/vg/wii/file_move.rb +0 -4
  100. data/lib/ehbrs_ruby_utils/vg/wii/game_file.rb +0 -5
  101. data/lib/ehbrs_ruby_utils/vg/wii/wit/image_format.rb +0 -4
  102. data/lib/ehbrs_ruby_utils/vg/wii/wit/parsers/dump.rb +0 -2
  103. data/lib/ehbrs_ruby_utils/vg/wii/wit/parsers/info.rb +0 -1
  104. data/lib/ehbrs_ruby_utils/vg/wii/wit/path.rb +0 -2
  105. data/lib/ehbrs_ruby_utils/vg/wii/wit.rb +0 -2
  106. data/lib/ehbrs_ruby_utils/vg/wii.rb +0 -2
  107. data/lib/ehbrs_ruby_utils/vg.rb +0 -2
  108. data/lib/ehbrs_ruby_utils/videos/convert_job.rb +0 -2
  109. data/lib/ehbrs_ruby_utils/videos/file.rb +0 -3
  110. data/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb +0 -3
  111. data/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title.rb +0 -3
  112. data/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers.rb +0 -2
  113. data/lib/ehbrs_ruby_utils/videos/opensubtitles/processors/episode.rb +0 -5
  114. data/lib/ehbrs_ruby_utils/videos/opensubtitles/processors/subtitle.rb +0 -2
  115. data/lib/ehbrs_ruby_utils/videos/opensubtitles/processors/subtitles_provider.rb +0 -5
  116. data/lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb +0 -5
  117. data/lib/ehbrs_ruby_utils/videos/opensubtitles/processors.rb +0 -2
  118. data/lib/ehbrs_ruby_utils/videos/opensubtitles.rb +0 -2
  119. data/lib/ehbrs_ruby_utils/videos/quality.rb +0 -2
  120. data/lib/ehbrs_ruby_utils/videos/resolution.rb +0 -3
  121. data/lib/ehbrs_ruby_utils/videos/series/rename/directory_group.rb +0 -3
  122. data/lib/ehbrs_ruby_utils/videos/series/rename/file/basename_parser.rb +0 -2
  123. data/lib/ehbrs_ruby_utils/videos/series/rename/file/renamer.rb +0 -2
  124. data/lib/ehbrs_ruby_utils/videos/series/rename/file.rb +0 -2
  125. data/lib/ehbrs_ruby_utils/videos/series/rename/line_result.rb +0 -2
  126. data/lib/ehbrs_ruby_utils/videos/series/rename/results_builder.rb +0 -3
  127. data/lib/ehbrs_ruby_utils/videos/series/rename.rb +0 -2
  128. data/lib/ehbrs_ruby_utils/videos/series.rb +0 -2
  129. data/lib/ehbrs_ruby_utils/videos/stream.rb +0 -2
  130. data/lib/ehbrs_ruby_utils/videos/subtitles/sanitize/content_sanitizer.rb +0 -4
  131. data/lib/ehbrs_ruby_utils/videos/subtitles/sanitize/with_pattern_matcher.rb +0 -3
  132. data/lib/ehbrs_ruby_utils/videos/subtitles/sanitize/with_term_matcher.rb +0 -3
  133. data/lib/ehbrs_ruby_utils/videos/subtitles/sanitize.rb +0 -2
  134. data/lib/ehbrs_ruby_utils/videos.rb +0 -2
  135. data/lib/ehbrs_ruby_utils/videos2/convert_job.rb +0 -2
  136. data/lib/ehbrs_ruby_utils/videos2/extract/package.rb +0 -4
  137. data/lib/ehbrs_ruby_utils/videos2/extract/package_file.rb +0 -2
  138. data/lib/ehbrs_ruby_utils/videos2/extract.rb +0 -2
  139. data/lib/ehbrs_ruby_utils/videos2/profiles/same_quality.rb +0 -2
  140. data/lib/ehbrs_ruby_utils/videos2/unsupported/check_result.rb +0 -2
  141. data/lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb +0 -2
  142. data/lib/ehbrs_ruby_utils/videos2/unsupported/check_support.rb +0 -3
  143. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_extra_unsupported.rb +0 -2
  144. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_unsupported.rb +0 -2
  145. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/invalid_extension.rb +0 -2
  146. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks.rb +0 -2
  147. data/lib/ehbrs_ruby_utils/videos2/unsupported/file/fix.rb +0 -4
  148. data/lib/ehbrs_ruby_utils/videos2/unsupported/file.rb +0 -5
  149. data/lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb +0 -3
  150. data/lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec.rb +0 -2
  151. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/aoc.rb +0 -2
  152. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/philco.rb +0 -2
  153. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/samsung.rb +0 -3
  154. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles.rb +0 -2
  155. data/lib/ehbrs_ruby_utils/videos2/unsupported/search.rb +2 -4
  156. data/lib/ehbrs_ruby_utils/videos2/unsupported/track.rb +0 -2
  157. data/lib/ehbrs_ruby_utils/videos2.rb +0 -2
  158. data/lib/ehbrs_ruby_utils/web_utils/instance/finances/bills/consume/file.rb +0 -1
  159. data/lib/ehbrs_ruby_utils/web_utils/instance/finances/bills/consume.rb +0 -1
  160. data/lib/ehbrs_ruby_utils/web_utils/instance/finances/bills.rb +0 -1
  161. data/lib/ehbrs_ruby_utils/web_utils/instance/finances.rb +0 -1
  162. data/lib/ehbrs_ruby_utils/web_utils/instance/http_request.rb +1 -2
  163. data/lib/ehbrs_ruby_utils/web_utils/instance.rb +1 -1
  164. data/lib/ehbrs_ruby_utils/web_utils/request_error.rb +0 -2
  165. data/lib/ehbrs_ruby_utils/web_utils/videos/file/rename.rb +0 -2
  166. data/lib/ehbrs_ruby_utils/web_utils/videos/file.rb +0 -1
  167. data/lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb +0 -2
  168. data/lib/ehbrs_ruby_utils/web_utils/videos.rb +0 -2
  169. data/lib/ehbrs_ruby_utils/web_utils.rb +0 -2
  170. data/lib/ehbrs_ruby_utils.rb +4 -2
  171. metadata +44 -38
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/executables'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Fs
8
5
  class Iso9660File
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/fs/selected/build_file'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Fs
8
5
  class Selected
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Fs
7
5
  class Selected
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_fs/traverser'
4
- require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module EhbrsRubyUtils
7
6
  module Fs
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_fs/patches'
4
- require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module EhbrsRubyUtils
7
6
  module Fs
@@ -10,6 +9,8 @@ module EhbrsRubyUtils
10
9
  enable_simple_cache
11
10
  abstract_methods :convert, :convert?, :target_encoding
12
11
 
12
+ TEXT_MIME_TYPES = [%r{\Atext/\S+}, 'application/x-subrip'].freeze
13
+
13
14
  common_constructor(:file) do
14
15
  self.file = file.to_pathname
15
16
  end
@@ -32,7 +33,7 @@ module EhbrsRubyUtils
32
33
  end
33
34
  end
34
35
 
35
- def run
36
+ def run # rubocop:disable Naming/PredicateMethod
36
37
  return false unless convert?
37
38
 
38
39
  convert
@@ -75,8 +76,9 @@ module EhbrsRubyUtils
75
76
  r
76
77
  end
77
78
 
79
+ # @return [Boolean]
78
80
  def text?
79
- file.info.content_type.type == 'text'
81
+ TEXT_MIME_TYPES.any? { |e| e.match?(file.info.content_type.mime_type) }
80
82
  end
81
83
  end
82
84
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/fs/to_file_format'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Fs
7
5
  class ToUtf8Unix < ::EhbrsRubyUtils::Fs::ToFileFormat
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/fs/to_file_format'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Fs
8
5
  class ToWindowsPtBr < ::EhbrsRubyUtils::Fs::ToFileFormat
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  # Filesystem utilities.
7
5
  module Fs
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/bga/session'
4
- require 'ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter'
5
- require 'ehbrs_ruby_utils/executables'
6
- require 'ehbrs_ruby_utils/mudslide/message'
7
- require 'eac_ruby_utils/core_ext'
8
-
9
3
  module EhbrsRubyUtils
10
4
  module Gjt1
11
5
  class Manager
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Gjt1
7
5
  require_sub __FILE__
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/executables'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Mudslide
8
5
  class Message
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Mudslide
7
5
  require_sub __FILE__
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/music/lyrics_book/resource'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Music
8
5
  class LyricsBook
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  class LyricsBook
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/music/lyrics_book/resource'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Music
8
5
  class LyricsBook
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  class LyricsBook
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/music/ous/artist'
5
- require 'ehbrs_ruby_utils/music/ous/node'
6
-
7
3
  module EhbrsRubyUtils
8
4
  module Music
9
5
  module Ous
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/music/ous/category'
5
- require 'ehbrs_ruby_utils/music/ous/node'
6
-
7
3
  module EhbrsRubyUtils
8
4
  module Music
9
5
  module Ous
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/music/ous/node'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Music
8
5
  module Ous
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  module Ous
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  module Sort
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  module Sort
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/music/sort/files/factory'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Music
8
5
  module Sort
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  module Sort
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  module Sort
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Music
7
5
  require_sub __FILE__
@@ -1,4 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/require_sub'
4
3
  EacRubyUtils.require_sub __FILE__
@@ -1,4 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/require_sub'
4
3
  EacRubyUtils.require_sub __FILE__
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.44.2'
4
+ VERSION = '0.45.0'
5
5
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Vg
5
+ module Patchers
6
+ class ApplierFactory
7
+ APPLIERS_BY_TYPE = {
8
+ 'BPS patch file' => ::EhbrsRubyUtils::Vg::Patchers::BpsApplier,
9
+ 'IPS patch file' => ::EhbrsRubyUtils::Vg::Patchers::IpsApplier,
10
+ 'VCDIFF binary diff' => ::EhbrsRubyUtils::Vg::Patchers::VcdiffApplier
11
+ }.freeze
12
+
13
+ enable_simple_cache
14
+ common_constructor :patch_path do
15
+ self.patch_path = patch_path.to_pathname
16
+ end
17
+ delegate :apply, to: :applier_instance
18
+
19
+ # @return [String]
20
+ def patch_type
21
+ patch_path.info.description
22
+ end
23
+
24
+ protected
25
+
26
+ # @return [Class]
27
+ def applier_class_uncached
28
+ APPLIERS_BY_TYPE.fetch(patch_type)
29
+ end
30
+
31
+ # @return [Object]
32
+ def applier_instance_uncached
33
+ applier_class.new(patch_path)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Vg
5
+ module Patchers
6
+ class BaseApplier
7
+ acts_as_abstract
8
+ common_constructor :patch_path
9
+
10
+ # @param source_path [Pathname]
11
+ # @param output_path [Pathname]
12
+ # @raise [RuntimeError] Se o arquivo de saída não é criado.
13
+ def apply(source_path, output_path)
14
+ source_path = source_path.to_pathname
15
+ output_path = output_path.to_pathname
16
+ command(source_path, output_path).system!
17
+
18
+ return if output_path.exist?
19
+
20
+ fatal_error("Applier returned without error, but output file \"#{output_path}\"" \
21
+ 'does not exist')
22
+ end
23
+
24
+ # @param source_path [Pathname]
25
+ # @param output_path [Pathname]
26
+ # @return [EacRubyUtils::Envs::Command]
27
+ def command(source_path, output_path)
28
+ raise_abstract_method __method__, source_path, output_path
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Vg
5
+ module Patchers
6
+ class BpsApplier < ::EhbrsRubyUtils::Vg::Patchers::IpsApplier
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Vg
5
+ module Patchers
6
+ class IpsApplier < ::EhbrsRubyUtils::Vg::Patchers::BaseApplier
7
+ # @param source_path [Pathname]
8
+ # @param output_path [Pathname]
9
+ # @return [EacRubyUtils::Envs::Command]
10
+ def command(source_path, output_path)
11
+ ::EhbrsRubyUtils::Executables.flips.command
12
+ .append(['--apply', patch_path, source_path, output_path])
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Vg
5
+ module Patchers
6
+ class TempFiles
7
+ common_constructor :initial, :temp0, :temp1
8
+
9
+ def input
10
+ swaped? ? temp0 : initial
11
+ end
12
+
13
+ def move_result_to(dest)
14
+ return unless swaped?
15
+
16
+ ::FileUtils.mv(temp0.to_path, dest.to_path)
17
+ end
18
+
19
+ def output
20
+ temp1
21
+ end
22
+
23
+ def swap
24
+ temp0_current = temp0
25
+ self.temp0 = temp1
26
+ self.temp1 = temp0_current
27
+ @swaped = true
28
+ end
29
+
30
+ def swaped?
31
+ @swaped ? true : false
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Vg
5
+ module Patchers
6
+ class VcdiffApplier < ::EhbrsRubyUtils::Vg::Patchers::BaseApplier
7
+ # @param source_path [Pathname]
8
+ # @param output_path [Pathname]
9
+ # @return [EacRubyUtils::Envs::Command]
10
+ def command(source_path, output_path)
11
+ ::EhbrsRubyUtils::Executables.xdelta3.command
12
+ .append(['-d', '-s', source_path, patch_path, output_path])
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/fs/iso_9660_file'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Vg
8
5
  module Ps2
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Vg
7
5
  module Ps2
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/executables'
5
- require 'ehbrs_ruby_utils/vg/wii/wit/image_format'
6
- require 'ehbrs_ruby_utils/vg/wii/wit/path'
7
3
  require 'fileutils'
8
4
 
9
5
  module EhbrsRubyUtils
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/custom_format'
5
- require 'ehbrs_ruby_utils/executables'
6
- require 'ehbrs_ruby_utils/vg/wii/wit/parsers/dump'
7
- require 'ehbrs_ruby_utils/vg/wii/wit/path'
8
3
  require 'pathname'
9
4
 
10
5
  module EhbrsRubyUtils
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/executables'
5
- require 'ehbrs_ruby_utils/vg/wii/wit/parsers/info'
6
-
7
3
  module EhbrsRubyUtils
8
4
  module Vg
9
5
  module Wii
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Vg
7
5
  module Wii
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
3
  require 'inifile'
5
4
 
6
5
  module EhbrsRubyUtils
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Vg
7
5
  module Wii
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Vg
7
5
  module Wii
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Vg
7
5
  module Wii
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Vg
7
5
  require_sub __FILE__
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/executables'
5
3
  require 'fileutils'
6
4
 
7
5
  module EhbrsRubyUtils
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/executables'
5
- require 'ehbrs_ruby_utils/videos/stream'
6
3
  require 'json'
7
4
  require 'taglib'
8
5
  require 'ultimate_lyrics/provider_search'
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aranha/parsers/html/item_list'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Videos
8
5
  module Opensubtitles
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aranha/parsers/html/item_list'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module EhbrsRubyUtils
7
4
  module Videos
8
5
  module Opensubtitles
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EhbrsRubyUtils
6
4
  module Videos
7
5
  module Opensubtitles
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aranha/default_processor'
4
- require 'ehbrs_ruby_utils/videos/opensubtitles/parsers/episode'
5
- require 'ehbrs_ruby_utils/videos/opensubtitles/processors/subtitle'
6
- require 'eac_ruby_utils/core_ext'
7
-
8
3
  module EhbrsRubyUtils
9
4
  module Videos
10
5
  module Opensubtitles
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aranha/default_processor'
4
3
  require 'eac_fs/cached_download'
5
- require 'eac_ruby_utils/core_ext'
6
4
 
7
5
  module EhbrsRubyUtils
8
6
  module Videos
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aranha/default_processor'
4
- require 'ehbrs_ruby_utils/videos/opensubtitles/processors/episode'
5
- require 'ehbrs_ruby_utils/videos/opensubtitles/processors/title'
6
- require 'eac_ruby_utils/core_ext'
7
-
8
3
  module EhbrsRubyUtils
9
4
  module Videos
10
5
  module Opensubtitles
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aranha/default_processor'
4
- require 'ehbrs_ruby_utils/videos/opensubtitles/parsers/title'
5
- require 'ehbrs_ruby_utils/videos/opensubtitles/processors/episode'
6
- require 'eac_ruby_utils/core_ext'
7
-
8
3
  module EhbrsRubyUtils
9
4
  module Videos
10
5
  module Opensubtitles