ehbrs-tools 0.35.0 → 0.36.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +139 -149
  3. data/lib/ehbrs/telegram/message_sending.rb +1 -2
  4. data/lib/ehbrs/tools/core_ext.rb +0 -1
  5. data/lib/ehbrs/tools/runner/cooking_book/build.rb +2 -2
  6. data/lib/ehbrs/tools/runner/cooking_book.rb +2 -2
  7. data/lib/ehbrs/tools/runner/vg/wii.rb +4 -4
  8. data/lib/ehbrs/tools/runner/web_utils/videos/download.rb +0 -4
  9. data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +6 -11
  10. data/lib/ehbrs/tools/version.rb +1 -1
  11. metadata +29 -80
  12. data/lib/ehbrs/cooking_book/build/base_page.rb +0 -42
  13. data/lib/ehbrs/cooking_book/build/index_page.rb +0 -26
  14. data/lib/ehbrs/cooking_book/build/recipe_page.rb +0 -26
  15. data/lib/ehbrs/cooking_book/build.rb +0 -45
  16. data/lib/ehbrs/cooking_book/project.rb +0 -31
  17. data/lib/ehbrs/cooking_book/recipe/ingredient.rb +0 -21
  18. data/lib/ehbrs/cooking_book/recipe/measure.rb +0 -60
  19. data/lib/ehbrs/cooking_book/recipe/part.rb +0 -32
  20. data/lib/ehbrs/cooking_book/recipe.rb +0 -37
  21. data/lib/ehbrs/cooking_book.rb +0 -9
  22. data/lib/ehbrs/patches/object/template.rb +0 -7
  23. data/lib/ehbrs/patches.rb +0 -4
  24. data/lib/ehbrs/vg/wii/file_move.rb +0 -89
  25. data/lib/ehbrs/vg/wii/game_file.rb +0 -87
  26. data/lib/ehbrs/vg/wii/wit/image_format.rb +0 -46
  27. data/lib/ehbrs/vg/wii/wit/parsers/dump.rb +0 -67
  28. data/lib/ehbrs/vg/wii/wit/parsers/info.rb +0 -39
  29. data/lib/ehbrs/vg/wii/wit/path.rb +0 -55
  30. data/lib/ehbrs/vg/wii/wit.rb +0 -13
  31. data/lib/ehbrs/vg/wii.rb +0 -11
  32. data/lib/ehbrs/vg.rb +0 -9
  33. data/spec/lib/ehbrs/cooking_book/recipe/measure_spec.rb +0 -21
  34. data/spec/lib/ehbrs/vg/wii/game_file_spec.rb +0 -21
  35. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec.rb +0 -11
  36. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.source.witdump +0 -27
  37. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.target.yaml +0 -22
  38. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.source.witdump +0 -28
  39. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.target.yaml +0 -21
  40. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.source.witdump +0 -16
  41. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.target.yaml +0 -19
  42. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.source.witdump +0 -28
  43. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.target.yaml +0 -23
  44. data/spec/lib/ehbrs/vg/wii/wit/path_spec.rb +0 -33
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehbrs-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.0
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-01 00:00:00.000000000 Z
11
+ date: 2023-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-tools
@@ -16,68 +16,62 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.145'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.145.1
19
+ version: '0.156'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0.145'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.145.1
26
+ version: '0.156'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: eac_cli
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: '0.30'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 0.30.1
33
+ version: '0.38'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
38
  - - "~>"
48
39
  - !ruby/object:Gem::Version
49
- version: '0.30'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 0.30.1
40
+ version: '0.38'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: eac_ruby_utils
55
43
  requirement: !ruby/object:Gem::Requirement
56
44
  requirements:
57
45
  - - "~>"
58
46
  - !ruby/object:Gem::Version
59
- version: '0.112'
47
+ version: '0.119'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.119.2
60
51
  type: :runtime
61
52
  prerelease: false
62
53
  version_requirements: !ruby/object:Gem::Requirement
63
54
  requirements:
64
55
  - - "~>"
65
56
  - !ruby/object:Gem::Version
66
- version: '0.112'
57
+ version: '0.119'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.119.2
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: ehbrs_ruby_utils
69
63
  requirement: !ruby/object:Gem::Requirement
70
64
  requirements:
71
65
  - - "~>"
72
66
  - !ruby/object:Gem::Version
73
- version: '0.21'
67
+ version: '0.33'
74
68
  type: :runtime
75
69
  prerelease: false
76
70
  version_requirements: !ruby/object:Gem::Requirement
77
71
  requirements:
78
72
  - - "~>"
79
73
  - !ruby/object:Gem::Version
80
- version: '0.21'
74
+ version: '0.33'
81
75
  - !ruby/object:Gem::Dependency
82
76
  name: filesize
83
77
  requirement: !ruby/object:Gem::Requirement
@@ -146,14 +140,14 @@ dependencies:
146
140
  requirements:
147
141
  - - "~>"
148
142
  - !ruby/object:Gem::Version
149
- version: '0.3'
143
+ version: 0.5.1
150
144
  type: :development
151
145
  prerelease: false
152
146
  version_requirements: !ruby/object:Gem::Requirement
153
147
  requirements:
154
148
  - - "~>"
155
149
  - !ruby/object:Gem::Version
156
- version: '0.3'
150
+ version: 0.5.1
157
151
  description:
158
152
  email:
159
153
  executables:
@@ -168,16 +162,6 @@ files:
168
162
  - Gemfile.lock
169
163
  - exe/ehbrs
170
164
  - lib/ehbrs.rb
171
- - lib/ehbrs/cooking_book.rb
172
- - lib/ehbrs/cooking_book/build.rb
173
- - lib/ehbrs/cooking_book/build/base_page.rb
174
- - lib/ehbrs/cooking_book/build/index_page.rb
175
- - lib/ehbrs/cooking_book/build/recipe_page.rb
176
- - lib/ehbrs/cooking_book/project.rb
177
- - lib/ehbrs/cooking_book/recipe.rb
178
- - lib/ehbrs/cooking_book/recipe/ingredient.rb
179
- - lib/ehbrs/cooking_book/recipe/measure.rb
180
- - lib/ehbrs/cooking_book/recipe/part.rb
181
165
  - lib/ehbrs/executables.rb
182
166
  - lib/ehbrs/gems.rb
183
167
  - lib/ehbrs/google.rb
@@ -187,8 +171,6 @@ files:
187
171
  - lib/ehbrs/observers.rb
188
172
  - lib/ehbrs/observers/base.rb
189
173
  - lib/ehbrs/observers/with_persistence.rb
190
- - lib/ehbrs/patches.rb
191
- - lib/ehbrs/patches/object/template.rb
192
174
  - lib/ehbrs/self.rb
193
175
  - lib/ehbrs/self/observers/used_space.rb
194
176
  - lib/ehbrs/self/observers/with_persistence.rb
@@ -239,15 +221,6 @@ files:
239
221
  - lib/ehbrs/tools/runner/web_utils/videos/upload.rb
240
222
  - lib/ehbrs/tools/version.rb
241
223
  - lib/ehbrs/user_dirs.rb
242
- - lib/ehbrs/vg.rb
243
- - lib/ehbrs/vg/wii.rb
244
- - lib/ehbrs/vg/wii/file_move.rb
245
- - lib/ehbrs/vg/wii/game_file.rb
246
- - lib/ehbrs/vg/wii/wit.rb
247
- - lib/ehbrs/vg/wii/wit/image_format.rb
248
- - lib/ehbrs/vg/wii/wit/parsers/dump.rb
249
- - lib/ehbrs/vg/wii/wit/parsers/info.rb
250
- - lib/ehbrs/vg/wii/wit/path.rb
251
224
  - lib/ehbrs/videos.rb
252
225
  - lib/ehbrs/videos/convert_job.rb
253
226
  - lib/ehbrs/videos/extract.rb
@@ -279,7 +252,6 @@ files:
279
252
  - lib/ehbrs/videos/unsupported/search.rb
280
253
  - lib/ehbrs/videos/unsupported/track.rb
281
254
  - spec/code/rubocop_spec.rb
282
- - spec/lib/ehbrs/cooking_book/recipe/measure_spec.rb
283
255
  - spec/lib/ehbrs/observers/base_spec.rb
284
256
  - spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb
285
257
  - spec/lib/ehbrs/tools/runner/vg/ips_spec.rb
@@ -292,17 +264,6 @@ files:
292
264
  - spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb
293
265
  - spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml
294
266
  - spec/lib/ehbrs/tools/runner_spec.rb
295
- - spec/lib/ehbrs/vg/wii/game_file_spec.rb
296
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec.rb
297
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.source.witdump
298
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.target.yaml
299
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.source.witdump
300
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.target.yaml
301
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.source.witdump
302
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.target.yaml
303
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.source.witdump
304
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.target.yaml
305
- - spec/lib/ehbrs/vg/wii/wit/path_spec.rb
306
267
  - spec/spec_helper.rb
307
268
  - spec/spec_helper/videos.rb
308
269
  - spec/spec_helper/videos_files/stub_source.mp4
@@ -333,33 +294,21 @@ signing_key:
333
294
  specification_version: 4
334
295
  summary: Tools for EHB/RS.
335
296
  test_files:
336
- - spec/spec_helper/videos_files/stub_source.mp4
337
- - spec/spec_helper/videos.rb
297
+ - spec/spec_helper.rb
338
298
  - spec/lib/ehbrs/observers/base_spec.rb
339
- - spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb
340
- - spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb
341
- - spec/lib/ehbrs/tools/runner/videos/probe_spec.rb
342
- - spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml
343
- - spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml
344
- - spec/lib/ehbrs/tools/runner/vg/ips_spec.rb
345
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom
299
+ - spec/lib/ehbrs/tools/runner_spec.rb
346
300
  - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom
347
301
  - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips
348
302
  - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips
349
- - spec/lib/ehbrs/tools/runner_spec.rb
350
- - spec/lib/ehbrs/cooking_book/recipe/measure_spec.rb
351
- - spec/lib/ehbrs/vg/wii/wit/path_spec.rb
352
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec.rb
353
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.target.yaml
354
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.source.witdump
355
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.source.witdump
356
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.target.yaml
357
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.target.yaml
358
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.source.witdump
359
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.target.yaml
360
- - spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.source.witdump
361
- - spec/lib/ehbrs/vg/wii/game_file_spec.rb
362
- - spec/spec_helper.rb
303
+ - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom
304
+ - spec/lib/ehbrs/tools/runner/vg/ips_spec.rb
305
+ - spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb
306
+ - spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml
307
+ - spec/lib/ehbrs/tools/runner/videos/probe_spec.rb
308
+ - spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml
309
+ - spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb
363
310
  - spec/code/rubocop_spec.rb
311
+ - spec/spec_helper/videos_files/stub_source.mp4
312
+ - spec/spec_helper/videos.rb
364
313
  - ".rubocop.yml"
365
314
  - ".rspec"
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Ehbrs
6
- module CookingBook
7
- class Build
8
- class BasePage < SimpleDelegator
9
- attr_reader :parent
10
-
11
- def initialize(parent, source_object)
12
- super(source_object)
13
- @parent = parent
14
- end
15
-
16
- def build
17
- target_path.write(target_content)
18
- end
19
-
20
- def href
21
- "#{target_basename}.html"
22
- end
23
-
24
- def target_path
25
- parent.target_dir.join(href)
26
- end
27
-
28
- def target_content
29
- erb_result('layout', ::Ehbrs::CookingBook::Build::BasePage)
30
- end
31
-
32
- def inner_content
33
- erb_result('inner', self.class)
34
- end
35
-
36
- def erb_result(template_basename, template_source = self)
37
- template_source.erb_template("#{template_basename}.html.erb", self)
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs/cooking_book/build/base_page'
5
-
6
- module Ehbrs
7
- module CookingBook
8
- class Build
9
- class IndexPage < ::Ehbrs::CookingBook::Build::BasePage
10
- TITLE = 'Início'
11
-
12
- def initialize(parent)
13
- super(parent, nil)
14
- end
15
-
16
- def target_basename
17
- 'index'
18
- end
19
-
20
- def title
21
- TITLE
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs/cooking_book/build/base_page'
5
-
6
- module Ehbrs
7
- module CookingBook
8
- class Build
9
- class RecipePage < ::Ehbrs::CookingBook::Build::BasePage
10
- def target_basename
11
- title.variableize
12
- end
13
-
14
- def parts
15
- @parts ||= super.map { |e| Part.new(e) }
16
- end
17
-
18
- class Part < SimpleDelegator
19
- def content
20
- ::Ehbrs::CookingBook::Build::RecipePage.erb_template('part.html.erb', self)
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/fs/clearable_directory'
5
-
6
- module Ehbrs
7
- module CookingBook
8
- class Build
9
- require_sub __FILE__
10
- enable_simple_cache
11
- enable_listable
12
- lists.add_symbol :option, :target_dir
13
-
14
- common_constructor :project, :options, default: [{}] do
15
- self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
16
- end
17
-
18
- def run
19
- target_dir.clear
20
- index_page.build
21
- recipes_pages.each(&:build)
22
- end
23
-
24
- private
25
-
26
- def index_page_uncached
27
- ::Ehbrs::CookingBook::Build::IndexPage.new(self)
28
- end
29
-
30
- def recipes_pages_uncached
31
- project.recipes.map do |recipe|
32
- ::Ehbrs::CookingBook::Build::RecipePage.new(self, recipe)
33
- end
34
- end
35
-
36
- def target_dir_uncached
37
- ::EacRubyUtils::Fs::ClearableDirectory.new(options[OPTION_TARGET_DIR] || default_target_dir)
38
- end
39
-
40
- def default_target_dir
41
- project.root.join('dist')
42
- end
43
- end
44
- end
45
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs/cooking_book/recipe'
5
-
6
- module Ehbrs
7
- module CookingBook
8
- class Project
9
- RECIPES_ROOT_SUBPATH = 'recipes'
10
-
11
- enable_simple_cache
12
- common_constructor :root do
13
- self.root = root.to_pathname
14
- end
15
-
16
- delegate :to_s, to: :root
17
-
18
- private
19
-
20
- def recipes_root_uncached
21
- root.join(RECIPES_ROOT_SUBPATH)
22
- end
23
-
24
- def recipes_uncached
25
- ::Dir.glob(File.join('**', '*.{yml,yaml}'), base: recipes_root.to_path).map do |subpath|
26
- ::Ehbrs::CookingBook::Recipe.from_file(recipes_root.join(subpath))
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs/cooking_book/recipe/measure'
5
-
6
- module Ehbrs
7
- module CookingBook
8
- class Recipe
9
- class Ingredient
10
- class << self
11
- def build(label, value)
12
- new(label, ::Ehbrs::CookingBook::Recipe::Measure.build(value))
13
- end
14
- end
15
-
16
- enable_simple_cache
17
- common_constructor :name, :measure
18
- end
19
- end
20
- end
21
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/yaml'
5
- require 'ehbrs/cooking_book/recipe/ingredient'
6
-
7
- module Ehbrs
8
- module CookingBook
9
- class Recipe
10
- class Measure
11
- FLOAT_PATTERN = /\d+(?:\.\d+)?/.freeze
12
- FRACTION_PATTERN = %r{(#{FLOAT_PATTERN})(?:\s*/\s*(#{FLOAT_PATTERN}))?}.freeze
13
- QUANTITY_UNIT_PATTERN = /\A#{FRACTION_PATTERN}(?:\s*(\S+))?\z/.freeze
14
- VARIABLE_PATTERN = /\A\~\z/.freeze
15
- VARIABLE_TEXT = 'a gosto'
16
-
17
- class << self
18
- def build(value)
19
- value = value.to_s.strip
20
- build_from_variable(value) || build_from_pattern(value) || build_unknown(value)
21
- end
22
-
23
- private
24
-
25
- def build_from_variable(value)
26
- VARIABLE_PATTERN.if_match(value, false) do
27
- new(nil, nil, nil)
28
- end
29
- end
30
-
31
- def build_from_pattern(value)
32
- QUANTITY_UNIT_PATTERN.if_match(value, false) do |m|
33
- new(m[1].if_present(&:to_f), m[2].if_present(&:to_f), m[3])
34
- end
35
- end
36
-
37
- def build_unknown(value)
38
- new(nil, nil, "unknown format: |#{value}|")
39
- end
40
- end
41
-
42
- common_constructor :numerator, :denominator, :unit
43
-
44
- def to_s
45
- return VARIABLE_TEXT if variable?
46
-
47
- "#{quantity_to_s} #{unit}"
48
- end
49
-
50
- def quantity_to_s
51
- numerator.to_s + (denominator.if_present('') { |v| "/ #{v}" })
52
- end
53
-
54
- def variable?
55
- numerator.blank?
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/yaml'
5
- require 'ehbrs/cooking_book/recipe/ingredient'
6
-
7
- module Ehbrs
8
- module CookingBook
9
- class Recipe
10
- class Part
11
- enable_simple_cache
12
- common_constructor :title, :source_data
13
-
14
- def notes
15
- source_data[:notes]
16
- end
17
-
18
- private
19
-
20
- def ingredients_uncached
21
- source_data.fetch(:ingredients).map do |label, value|
22
- ::Ehbrs::CookingBook::Recipe::Ingredient.build(label, value)
23
- end
24
- end
25
-
26
- def steps_uncached
27
- source_data.fetch(:steps)
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/yaml'
5
-
6
- module Ehbrs
7
- module CookingBook
8
- class Recipe
9
- enable_simple_cache
10
- require_sub __FILE__
11
-
12
- class << self
13
- def from_file(path)
14
- new(::EacRubyUtils::Yaml.load_file(path))
15
- end
16
- end
17
-
18
- common_constructor :source_data do
19
- self.source_data = source_data.deep_symbolize_keys
20
- end
21
-
22
- def title
23
- source_data.fetch(:title)
24
- end
25
-
26
- def notes
27
- source_data[:notes]
28
- end
29
-
30
- def parts
31
- @parts ||= source_data.fetch(:parts).map do |k, v|
32
- ::Ehbrs::CookingBook::Recipe::Part.new(k, v)
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Ehbrs
6
- module CookingBook
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ehbrs/tools/application'
4
- require 'eac_templates/patches/object/template'
5
-
6
- ::EacTemplates::Searcher.default.included_paths <<
7
- ::Ehbrs::Tools.application.gemspec_dir.join('template').to_path
data/lib/ehbrs/patches.rb DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
@@ -1,89 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs/executables'
5
- require 'ehbrs/vg/wii/wit/image_format'
6
- require 'ehbrs/vg/wii/wit/path'
7
- require 'fileutils'
8
-
9
- module Ehbrs
10
- module Vg
11
- module Wii
12
- class FileMove
13
- common_constructor :game, :target do
14
- self.target = ::Ehbrs::Vg::Wii::Wit::Path.assert(target)
15
- end
16
-
17
- ['', 'path_', 'type_'].each do |prefix|
18
- method_name = "#{prefix}change?"
19
- define_method(method_name) do
20
- source.send(method_name, target)
21
- end
22
- end
23
-
24
- def run
25
- [%w[path type], %w[path], %w[type]].each do |parts|
26
- next unless parts.all? { |part| send("#{part}_change?") }
27
-
28
- assert_target_dir
29
- send("change_#{parts.join('_and_')}")
30
- check_target
31
- break
32
- end
33
- end
34
-
35
- def source
36
- game.wit_path
37
- end
38
-
39
- private
40
-
41
- def assert_target_dir
42
- target.path.parent.mkpath
43
- end
44
-
45
- def change_path
46
- ::FileUtils.mv(source.path, target.path)
47
- end
48
-
49
- def change_path_and_type
50
- ::Ehbrs::Executables.wit.command
51
- .append(change_path_and_type_args)
52
- .system!
53
- check_target
54
- source.path.unlink
55
- end
56
-
57
- def change_path_and_type_args
58
- r = %w[copy]
59
- target_image_format.if_present { |v| r << v.option }
60
- r + [source.path, target.path]
61
- end
62
-
63
- def change_type
64
- ::Ehbrs::Executables.wit.command
65
- .append(change_type_args)
66
- .system!
67
- end
68
-
69
- def change_type_args
70
- r = %w[convert]
71
- target_image_format.if_present { |v| r << v.option }
72
- r + [target.path]
73
- end
74
-
75
- def check_target
76
- return if ::Ehbrs::Vg::Wii::GameFile.new(target.path).valid?
77
-
78
- raise "Target \"#{target}\" is not a valid Wii game"
79
- end
80
-
81
- def target_image_format
82
- return nil if target.type.blank?
83
-
84
- ::Ehbrs::Vg::Wii::Wit::ImageFormat.by_name(target.type)
85
- end
86
- end
87
- end
88
- end
89
- end