ehbrs-tools 0.23.1 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/.avm.yml +4 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +39 -0
  5. data/Gemfile.lock +285 -0
  6. data/lib/ehbrs/{core_ext.rb → tools/core_ext.rb} +0 -0
  7. data/lib/ehbrs/tools/runner/finances/bb_browser.rb +38 -9
  8. data/lib/ehbrs/tools/runner/fs/selected.rb +1 -1
  9. data/lib/ehbrs/tools/runner/music/lyrics.rb +69 -0
  10. data/lib/ehbrs/tools/runner/web_utils/videos/download.rb +20 -10
  11. data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +1 -1
  12. data/lib/ehbrs/tools/version.rb +1 -1
  13. data/spec/code/rubocop_spec.rb +3 -0
  14. data/spec/lib/ehbrs/cooking_book/recipe/measure_spec.rb +21 -0
  15. data/spec/lib/ehbrs/observers/base_spec.rb +93 -0
  16. data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +61 -0
  17. data/spec/lib/ehbrs/tools/runner/vg/ips_spec.rb +31 -0
  18. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom +0 -0
  19. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips +0 -0
  20. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips +0 -0
  21. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom +0 -0
  22. data/spec/lib/ehbrs/tools/runner/videos/probe_spec.rb +19 -0
  23. data/spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml +105 -0
  24. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb +75 -0
  25. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml +90 -0
  26. data/spec/lib/ehbrs/tools/runner_spec.rb +16 -0
  27. data/spec/lib/ehbrs/vg/wii/game_file_spec.rb +21 -0
  28. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec.rb +11 -0
  29. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.source.witdump +27 -0
  30. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.target.yaml +22 -0
  31. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.source.witdump +28 -0
  32. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.target.yaml +21 -0
  33. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.source.witdump +16 -0
  34. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.target.yaml +19 -0
  35. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.source.witdump +28 -0
  36. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.target.yaml +23 -0
  37. data/spec/lib/ehbrs/vg/wii/wit/path_spec.rb +33 -0
  38. data/spec/spec_helper/videos.rb +30 -0
  39. data/spec/spec_helper/videos_files/stub_source.mp4 +0 -0
  40. data/spec/spec_helper.rb +7 -0
  41. data/vendor/aranha-parsers/aranha-parsers.gemspec +3 -2
  42. data/vendor/aranha-parsers/lib/aranha/parsers/rspec/setup.rb +15 -0
  43. data/vendor/aranha-parsers/lib/aranha/parsers/{spec/source_target_fixtures_example.rb → rspec/shared_examples/source_target_fixtures.rb} +0 -0
  44. data/vendor/aranha-parsers/lib/aranha/parsers/rspec.rb +11 -0
  45. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/fetch_content_error.rb +10 -0
  46. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/http_get.rb +15 -2
  47. data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
  48. data/vendor/aranha-parsers/spec/lib/rubocop_check_spec.rb +1 -1
  49. data/vendor/aranha-parsers/spec/spec_helper.rb +2 -9
  50. data/vendor/aranha-selenium/aranha-selenium.gemspec +2 -2
  51. data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +1 -1
  52. data/vendor/aranha-selenium/spec/rubocop_check_spec.rb +1 -5
  53. data/vendor/aranha-selenium/spec/spec_helper.rb +2 -98
  54. data/vendor/eac_cli/eac_cli.gemspec +3 -3
  55. data/vendor/eac_cli/lib/eac_cli/config/entry.rb +0 -2
  56. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  57. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -1
  58. data/vendor/eac_cli/spec/spec_helper.rb +2 -101
  59. data/vendor/eac_config/eac_config.gemspec +2 -2
  60. data/vendor/eac_config/lib/eac_config/version.rb +1 -1
  61. data/vendor/eac_config/spec/rubocop_spec.rb +1 -1
  62. data/vendor/eac_config/spec/spec_helper.rb +2 -15
  63. data/vendor/eac_docker/eac_docker.gemspec +2 -2
  64. data/vendor/eac_docker/lib/eac_docker/container.rb +7 -3
  65. data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +4 -0
  66. data/vendor/eac_docker/lib/eac_docker/rspec/setup.rb +17 -0
  67. data/vendor/eac_docker/lib/eac_docker/rspec.rb +2 -10
  68. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  69. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -1
  70. data/vendor/eac_docker/spec/spec_helper.rb +2 -104
  71. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
  72. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  73. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -1
  74. data/vendor/eac_ruby_base0/spec/spec_helper.rb +2 -101
  75. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  76. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/compact.rb +22 -0
  77. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +15 -3
  78. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +1 -1
  79. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +75 -0
  80. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +35 -0
  81. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/compact.rb +20 -0
  82. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/delimited.rb +16 -0
  83. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/recursive_builder.rb +51 -0
  84. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/default_setup.rb +20 -0
  85. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup/conditionals.rb +17 -0
  86. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb +12 -0
  87. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup_manager.rb +49 -0
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/string_delimited.rb +70 -0
  89. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  90. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/compact_spec.rb +20 -0
  91. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb +20 -0
  92. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/string/delimited_spec.rb +34 -0
  93. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/recursive_builder_spec.rb +65 -0
  94. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -1
  95. data/vendor/eac_ruby_utils/spec/spec_helper.rb +6 -6
  96. data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +9 -4
  97. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/finances/bb_browser/docker_image.rb +18 -0
  98. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music.rb +9 -0
  99. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object/template.rb +6 -0
  100. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
  101. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +31 -0
  102. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +1 -1
  103. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/file/rename.rb +28 -0
  104. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/file.rb +11 -8
  105. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb +0 -1
  106. data/vendor/ehbrs_ruby_utils/spec/rubocop_check_spec.rb +1 -1
  107. data/vendor/ehbrs_ruby_utils/spec/spec_helper.rb +2 -101
  108. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Dockerfile +44 -0
  109. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Makefile +35 -0
  110. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/README.md +16 -0
  111. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/firefox.service +8 -0
  112. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/startbrowser.sh +9 -0
  113. data/vendor/ultimate_lyrics/Gemfile +5 -0
  114. data/vendor/ultimate_lyrics/bin/download_parser_spec_files.rb +94 -0
  115. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/field.rb +83 -0
  116. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/lyrics.rb +13 -0
  117. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/parser.rb +28 -0
  118. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/exclude_item.rb +17 -0
  119. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/extract_item.rb +21 -0
  120. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/item.rb +48 -0
  121. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/replace_fields.rb +13 -0
  122. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/rule.rb +52 -0
  123. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb +21 -0
  124. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider.rb +92 -0
  125. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider_search.rb +43 -0
  126. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/providers_data.xml +355 -0
  127. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata/field.rb +24 -0
  128. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata.rb +28 -0
  129. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/version.rb +5 -0
  130. data/vendor/ultimate_lyrics/lib/ultimate_lyrics.rb +7 -0
  131. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec.rb +20 -0
  132. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.source.html +8 -0
  133. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.target.yaml +3 -0
  134. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.url +1 -0
  135. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.source.html +8 -0
  136. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.target.yaml +3 -0
  137. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.url +1 -0
  138. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.source.html +193 -0
  139. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.target.yaml +3 -0
  140. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.url +1 -0
  141. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.source.html +193 -0
  142. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.target.yaml +3 -0
  143. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.url +1 -0
  144. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.source.html +87 -0
  145. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.target.yaml +36 -0
  146. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.url +1 -0
  147. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.source.html +4 -0
  148. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.target.yaml +5 -0
  149. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.url +1 -0
  150. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.source.html +2 -0
  151. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.target.yaml +3 -0
  152. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.url +1 -0
  153. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.source.html +2 -0
  154. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.target.yaml +3 -0
  155. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.url +1 -0
  156. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.source.html +101 -0
  157. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.target.yaml +3 -0
  158. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.url +1 -0
  159. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.source.html +29 -0
  160. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.target.yaml +3 -0
  161. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.url +1 -0
  162. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.source.html +29 -0
  163. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.target.yaml +3 -0
  164. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.url +1 -0
  165. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.source.html +1298 -0
  166. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.target.yaml +3 -0
  167. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.url +1 -0
  168. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/provider_search_spec.rb +72 -0
  169. data/vendor/ultimate_lyrics/spec/rubocop_spec.rb +3 -0
  170. data/vendor/ultimate_lyrics/spec/spec_helper.rb +4 -0
  171. data/vendor/ultimate_lyrics/ultimate_lyrics.gemspec +19 -0
  172. metadata +179 -11
  173. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb +0 -35
  174. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/stubbed_ssh.rb +0 -44
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ class StringDelimited
5
+ attr_reader :string, :begin_delimiter, :end_delimiter
6
+
7
+ def initialize(string, begin_delimiter, end_delimiter)
8
+ @string = string
9
+ @begin_delimiter = begin_delimiter
10
+ @end_delimiter = end_delimiter
11
+ end
12
+
13
+ def inner
14
+ between_indexes(content_index, end_index).to_s
15
+ end
16
+
17
+ def outer
18
+ between_indexes(begin_index, after_end_index).to_s
19
+ end
20
+
21
+ def without_inner
22
+ without_join(
23
+ between_indexes(sos_index, content_index), between_indexes(end_index, eos_index)
24
+ )
25
+ end
26
+
27
+ def without_outer
28
+ without_join(
29
+ between_indexes(sos_index, begin_index),
30
+ between_indexes(after_end_index, eos_index)
31
+ )
32
+ end
33
+
34
+ private
35
+
36
+ def after_end_index
37
+ end_index.if_present { |v| v + end_delimiter.length }
38
+ end
39
+
40
+ def begin_index
41
+ string.index(begin_delimiter)
42
+ end
43
+
44
+ def between_indexes(a_begin_index, a_end_index)
45
+ a_begin_index && a_end_index ? string[a_begin_index, a_end_index - a_begin_index] : nil
46
+ end
47
+
48
+ def content_index
49
+ begin_index.if_present { |v| v + begin_delimiter.length }
50
+ end
51
+
52
+ def without_join(*strings)
53
+ return string if strings.any?(&:nil?)
54
+
55
+ strings.join('')
56
+ end
57
+
58
+ def end_index
59
+ content_index.if_present { |_v| string.index(end_delimiter, content_index) }
60
+ end
61
+
62
+ def sos_index
63
+ 0
64
+ end
65
+
66
+ def eos_index
67
+ string.length
68
+ end
69
+ end
70
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.69.1'
4
+ VERSION = '0.75.0'
5
5
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/compact'
4
+
5
+ ::RSpec.describe ::EacRubyUtils::Compact do
6
+ let(:object) { ::OpenStruct.new(a_attr: 'a_value', b_attr: 'b_value') }
7
+ let(:instance) { described_class.new(object, %w[a_attr b_attr]) }
8
+
9
+ describe '#to_a' do
10
+ it do
11
+ expect(instance.to_a).to eq(%w[a_value b_value])
12
+ end
13
+ end
14
+
15
+ describe '#to_h' do
16
+ it do
17
+ expect(instance.to_h).to eq(a_attr: 'a_value', b_attr: 'b_value')
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/patches/object/compact'
4
+
5
+ ::RSpec.describe ::Object do
6
+ let(:instance) { ::OpenStruct.new(a_attr: 'a_value', b_attr: 'b_value') }
7
+ let(:attributes) { %w[a_attr b_attr] }
8
+
9
+ describe '#compact' do
10
+ it do
11
+ expect(instance.compact_to_a(*attributes)).to eq(%w[a_value b_value])
12
+ end
13
+ end
14
+
15
+ describe '#to_h' do
16
+ it do
17
+ expect(instance.compact_to_h(*attributes)).to eq(a_attr: 'a_value', b_attr: 'b_value')
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/patches/string/delimited'
4
+
5
+ ::RSpec.describe ::String do
6
+ let(:instance) { 'A text with <b>content between</b> tags.' }
7
+
8
+ {
9
+ ['<b>', '</b>'] => {
10
+ 'inner' => 'content between',
11
+ 'without_inner' => 'A text with <b></b> tags.',
12
+ 'outer' => '<b>content between</b>',
13
+ 'without_outer' => 'A text with tags.'
14
+ },
15
+ ['<b>', '</br>'] => {
16
+ 'inner' => '',
17
+ 'without_inner' => 'A text with <b>content between</b> tags.',
18
+ 'outer' => '',
19
+ 'without_outer' => 'A text with <b>content between</b> tags.'
20
+ }
21
+ }.each do |delimiters, expected_values|
22
+ context "when delimiters are #{delimiters}" do
23
+ let(:bdel) { delimiters[0] }
24
+ let(:edel) { delimiters[1] }
25
+
26
+ expected_values.each do |method_suffix, expected_value|
27
+ method_name = "delimited_#{method_suffix}"
28
+ it "#{method_name} should return \"#{expected_value}\"" do
29
+ expect(instance.send(method_name, bdel, edel)).to eq(expected_value)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/recursive_builder'
4
+
5
+ RSpec.describe ::EacRubyUtils::RecursiveBuilder do
6
+ let(:item_class) do
7
+ ::Class.new do
8
+ class << self
9
+ def create(label, dependencies_keys)
10
+ item = new(label, dependencies_keys)
11
+ registry[item.label] = item
12
+ item
13
+ end
14
+
15
+ def registry
16
+ @registry ||= {}
17
+ end
18
+ end
19
+
20
+ attr_reader :label, :dependencies_keys
21
+
22
+ def initialize(label, dependencies_keys)
23
+ @label = label
24
+ @dependencies_keys = dependencies_keys.freeze
25
+ end
26
+
27
+ def dependencies
28
+ dependencies_keys.map { |key| self.class.registry.fetch(key) }
29
+ end
30
+
31
+ def to_s
32
+ label
33
+ end
34
+ end
35
+ end
36
+
37
+ items = [
38
+ [:a, %w[c], %w[a c]],
39
+ [:b, %w[a], %w[b a c]],
40
+ [:c, [], %w[c]],
41
+ [:d, %w[a b c e], %w[d a b c e]],
42
+ [:e, %w[c b], %w[e c b a]]
43
+ ]
44
+
45
+ items.each do |item|
46
+ let(item[0]) { item_class.create(item[0].to_s, item[1]) }
47
+ before { send(item[0]) }
48
+ end
49
+
50
+ describe '#result' do
51
+ items.each do |item|
52
+ context "when root is \"#{item[0]}\"" do
53
+ let(:root) { send(item[0]) }
54
+ let(:dependencies) { item[2].map { |d| send(d) } }
55
+ let(:builder) do
56
+ described_class.new(root, &:dependencies)
57
+ end
58
+
59
+ it "is #{item[2]}" do
60
+ expect(builder.result).to eq(dependencies)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ::EacRubyGemSupport::Rspec.default.describe_rubocop
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -3,13 +3,13 @@
3
3
  $LOAD_PATH.push File.expand_path('../lib', __dir__)
4
4
  require 'tmpdir'
5
5
 
6
+ require 'i18n'
7
+ ::I18n.load_path << ::File.join(__dir__, 'locales/pt-BR.yml')
8
+ ::I18n.locale = 'pt-BR'
9
+
6
10
  RSpec.configure do |config|
7
11
  config.example_status_persistence_file_path = ::File.join(::Dir.tmpdir, 'eac_ruby_utils_rspec')
8
12
 
9
- require 'eac_ruby_gem_support/rspec'
10
- ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
13
+ require 'eac_ruby_utils/rspec/default_setup'
14
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__), config)
11
15
  end
12
-
13
- require 'i18n'
14
- ::I18n.load_path << ::File.join(__dir__, 'locales/pt-BR.yml')
15
- ::I18n.locale = 'pt-BR'
@@ -12,10 +12,15 @@ Gem::Specification.new do |s|
12
12
  s.authors = ['Eduardo H. Bogoni']
13
13
  s.summary = 'Utilities for EHB/RS\'s Ruby projects.'
14
14
 
15
- s.files = Dir['{lib}/**/*']
15
+ s.files = Dir['{lib,template}/**/*']
16
+ s.test_files = Dir['{spec}/**/*', '.rubocop.yml', '.rspec']
16
17
 
17
- s.add_dependency 'eac_ruby_utils', '~> 0.69', '>= 0.69.1'
18
+ s.add_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.70'
20
+ s.add_dependency 'eac_templates', '~> 0.1', '>= 0.1.1'
21
+ s.add_dependency 'taglib-ruby', '~> 1.1'
22
+ s.add_dependency 'ultimate_lyrics', '~> 0.1'
18
23
 
19
- s.add_development_dependency 'aranha-parsers', '~> 0.7', '>= 0.7.2'
20
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
24
+ s.add_development_dependency 'aranha-parsers', '~> 0.8'
25
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3'
21
26
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_docker/images/templatized'
4
+ require 'ehbrs_ruby_utils/patches/object/template'
5
+
6
+ module EhbrsRubyUtils
7
+ module Finances
8
+ module BbBrowser
9
+ class DockerImage < ::EacDocker::Images::Templatized
10
+ class << self
11
+ def create
12
+ new.tag(name.variableize)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Music
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/patches/object/template'
4
+
5
+ ::EacTemplates::Searcher.default.included_paths <<
6
+ ::File.expand_path('../../../../template', __dir__)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.6.0'
4
+ VERSION = '0.10.0'
5
5
  end
@@ -4,23 +4,49 @@ require 'eac_ruby_utils/core_ext'
4
4
  require 'ehbrs_ruby_utils/executables'
5
5
  require 'ehbrs_ruby_utils/videos/stream'
6
6
  require 'json'
7
+ require 'taglib'
8
+ require 'ultimate_lyrics/provider_search'
9
+ require 'ultimate_lyrics/song_metadata'
7
10
 
8
11
  module EhbrsRubyUtils
9
12
  module Videos
10
13
  class Container
14
+ class << self
15
+ def from_file(path)
16
+ new(path)
17
+ end
18
+ end
19
+
11
20
  enable_simple_cache
12
21
  common_constructor :path do
13
22
  self.path = path.to_pathname
14
23
  end
15
24
 
25
+ delegate :tag, to: :tag_file
26
+ delegate :to_s, to: :path
27
+
16
28
  ::EhbrsRubyUtils::Videos::Stream.lists.codec_type.each_value do |stream_type|
17
29
  define_method stream_type.to_s.pluralize do
18
30
  streams.select { |stream| stream.codec_type == stream_type }
19
31
  end
20
32
  end
21
33
 
34
+ # @param provider [UltimateLyrics::Provider]
35
+ # @return [UltimateLyrics::Lyrics]
36
+ def lyrics_by_provider(provider)
37
+ ::UltimateLyrics::ProviderSearch.new(provider, song_metadata).lyrics
38
+ end
39
+
22
40
  private
23
41
 
42
+ # @return [UltimateLyrics::SongMetadata]
43
+ def song_metadata_uncached
44
+ ::UltimateLyrics::SongMetadata.new(
45
+ ::UltimateLyrics::SongMetadata::Field.lists.sources.values
46
+ .map { |source| [source, tag.send(source)] }.to_h
47
+ )
48
+ end
49
+
24
50
  def probe_data_uncached
25
51
  ::JSON.parse(
26
52
  ::EhbrsRubyUtils::Executables.ffprobe.command(
@@ -34,6 +60,11 @@ module EhbrsRubyUtils
34
60
  ::EhbrsRubyUtils::Videos::Stream.new(stream_ffprobe_data)
35
61
  end
36
62
  end
63
+
64
+ # @return [TagLib::FileRef]
65
+ def tag_file_uncached
66
+ ::TagLib::FileRef.new(path.to_path)
67
+ end
37
68
  end
38
69
  end
39
70
  end
@@ -35,7 +35,7 @@ module EhbrsRubyUtils
35
35
  end
36
36
  end
37
37
 
38
- %i[codec_name codec_long_name].each do |method_name|
38
+ %i[codec_name codec_long_name height width].each do |method_name|
39
39
  define_method method_name do
40
40
  ffprobe_data[method_name]
41
41
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module WebUtils
7
+ module Videos
8
+ class File < ::SimpleDelegator
9
+ class Rename
10
+ common_constructor :file, :target_path
11
+
12
+ delegate :original_path, to: :file
13
+
14
+ def can_rename?
15
+ ::File.exist?(original_path) && !::File.exist?(target_path)
16
+ end
17
+
18
+ def perform
19
+ return unless can_rename?
20
+
21
+ ::FileUtils.mkdir_p(::File.dirname(target_path))
22
+ ::FileUtils.mv(original_path, target_path)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ostruct'
4
+ require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module EhbrsRubyUtils
6
7
  module WebUtils
7
8
  module Videos
8
9
  class File < ::SimpleDelegator
10
+ require_sub __FILE__
11
+
9
12
  def initialize(data)
10
13
  super(::OpenStruct.new(data))
11
14
  end
@@ -14,12 +17,15 @@ module EhbrsRubyUtils
14
17
  ::File.exist?(original_path)
15
18
  end
16
19
 
17
- def path_changed?
18
- original_path != new_path
20
+ def move(target_dir)
21
+ ::EhbrsRubyUtils::WebUtils::Videos::File::Rename.new(
22
+ self,
23
+ target_dir.to_pathname.join(original_path.to_pathname.relative_path_from(root_path))
24
+ ).perform
19
25
  end
20
26
 
21
- def can_rename?
22
- ::File.exist?(original_path) && !::File.exist?(new_path)
27
+ def path_changed?
28
+ original_path != new_path
23
29
  end
24
30
 
25
31
  def remove
@@ -29,10 +35,7 @@ module EhbrsRubyUtils
29
35
  end
30
36
 
31
37
  def rename
32
- return unless can_rename?
33
-
34
- ::FileUtils.mkdir_p(::File.dirname(new_path))
35
- ::FileUtils.mv(original_path, new_path)
38
+ ::EhbrsRubyUtils::WebUtils::Videos::File::Rename.new(self, new_path).perform
36
39
  end
37
40
  end
38
41
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aranha/parsers/spec/source_target_fixtures_example'
4
3
  require 'ehbrs_ruby_utils/videos/stream'
5
4
 
6
5
  RSpec.describe ::EhbrsRubyUtils::Videos::Stream do
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ::EacRubyGemSupport::Rspec.default.describe_rubocop
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,103 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This file was generated by the `rspec --init` command. Conventionally, all
4
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
- # The generated `.rspec` file contains `--require spec_helper` which will cause
6
- # this file to always be loaded, without a need to explicitly require it in any
7
- # files.
8
- #
9
- # Given that it is always loaded, you are encouraged to keep this file as
10
- # light-weight as possible. Requiring heavyweight dependencies from this file
11
- # will add to the boot time of your test suite on EVERY test run, even for an
12
- # individual file that may not need all of that loaded. Instead, consider making
13
- # a separate helper file that requires the additional dependencies and performs
14
- # the additional setup, and require it from the spec files that actually need
15
- # it.
16
- #
17
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
- RSpec.configure do |config|
19
- require 'eac_ruby_gem_support/rspec'
20
- ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
21
-
22
- # rspec-expectations config goes here. You can use an alternate
23
- # assertion/expectation library such as wrong or the stdlib/minitest
24
- # assertions if you prefer.
25
- config.expect_with :rspec do |expectations|
26
- # This option will default to `true` in RSpec 4. It makes the `description`
27
- # and `failure_message` of custom matchers include text for helper methods
28
- # defined using `chain`, e.g.:
29
- # be_bigger_than(2).and_smaller_than(4).description
30
- # # => "be bigger than 2 and smaller than 4"
31
- # ...rather than:
32
- # # => "be bigger than 2"
33
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
- end
35
-
36
- # rspec-mocks config goes here. You can use an alternate test double
37
- # library (such as bogus or mocha) by changing the `mock_with` option here.
38
- config.mock_with :rspec do |mocks|
39
- # Prevents you from mocking or stubbing a method that does not exist on
40
- # a real object. This is generally recommended, and will default to
41
- # `true` in RSpec 4.
42
- mocks.verify_partial_doubles = true
43
- end
44
-
45
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
46
- # have no way to turn it off -- the option exists only for backwards
47
- # compatibility in RSpec 3). It causes shared context metadata to be
48
- # inherited by the metadata hash of host groups and examples, rather than
49
- # triggering implicit auto-inclusion in groups with matching metadata.
50
- config.shared_context_metadata_behavior = :apply_to_host_groups
51
-
52
- # The settings below are suggested to provide a good initial experience
53
- # with RSpec, but feel free to customize to your heart's content.
54
- # # This allows you to limit a spec run to individual examples or groups
55
- # # you care about by tagging them with `:focus` metadata. When nothing
56
- # # is tagged with `:focus`, all examples get run. RSpec also provides
57
- # # aliases for `it`, `describe`, and `context` that include `:focus`
58
- # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
59
- # config.filter_run_when_matching :focus
60
- #
61
- # # Allows RSpec to persist some state between runs in order to support
62
- # # the `--only-failures` and `--next-failure` CLI options. We recommend
63
- # # you configure your source control system to ignore this file.
64
- # config.example_status_persistence_file_path = "spec/examples.txt"
65
- #
66
- # # Limits the available syntax to the non-monkey patched syntax that is
67
- # # recommended. For more details, see:
68
- # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
69
- # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
70
- # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
71
- # config.disable_monkey_patching!
72
- #
73
- # # This setting enables warnings. It's recommended, but in some cases may
74
- # # be too noisy due to issues in dependencies.
75
- # config.warnings = true
76
- #
77
- # # Many RSpec users commonly either run the entire suite or an individual
78
- # # file, and it's useful to allow more verbose output when running an
79
- # # individual spec file.
80
- # if config.files_to_run.one?
81
- # # Use the documentation formatter for detailed output,
82
- # # unless a formatter has already been configured
83
- # # (e.g. via a command-line flag).
84
- # config.default_formatter = "doc"
85
- # end
86
- #
87
- # # Print the 10 slowest examples and example groups at the
88
- # # end of the spec run, to help surface which specs are running
89
- # # particularly slow.
90
- # config.profile_examples = 10
91
- #
92
- # # Run specs in random order to surface order dependencies. If you find an
93
- # # order dependency and want to debug it, you can fix the order by providing
94
- # # the seed, which is printed after each run.
95
- # # --seed 1234
96
- # config.order = :random
97
- #
98
- # # Seed global randomization in this process using the `--seed` CLI option.
99
- # # Setting this allows you to use `--seed` to deterministically reproduce
100
- # # test failures related to randomization by passing the same `--seed` value
101
- # # as the one that triggered the failure.
102
- # Kernel.srand config.seed
103
- end
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -0,0 +1,44 @@
1
+ FROM ubuntu:18.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV USER_UID=1000
5
+ ENV USER_GID=1000
6
+ ENV USERNAME=user
7
+
8
+ # sudo gosu \
9
+
10
+ RUN ln -sf /bin/true /usr/bin/chfn && apt-get update && apt-get install -y \
11
+ libnss3-tools \
12
+ zenity \
13
+ libgtk2.0-0 \
14
+ dbus-x11 \
15
+ yad \
16
+ libcurl3 \
17
+ libdbus-1.3 \
18
+ libxss1 \
19
+ lsb-release \
20
+ net-tools \
21
+ openssl \
22
+ firefox \
23
+ systemd \
24
+ systemd-sysv
25
+
26
+
27
+ ADD https://cloud.gastecnologia.com.br/cef/warsaw/install/GBPCEFwr64.deb /src/warsaw.deb
28
+ RUN groupadd -g ${USER_GID} user && useradd -u ${USER_UID} -g ${USER_GID} -ms /bin/bash user && chown -R user.user /home/user
29
+
30
+ #RUN dpkg -i /w.deb || exit 0
31
+
32
+ COPY context/firefox.service /etc/systemd/system/
33
+ COPY context/startbrowser.sh /usr/local/bin/
34
+
35
+ # systemctl enable warsaw && \
36
+
37
+ RUN mkdir -p /var/run/dbus && \
38
+ systemctl enable firefox && \
39
+ systemctl disable systemd-resolved && systemctl disable systemd-tmpfiles-setup.service
40
+
41
+ STOPSIGNAL SIGRTMIN+3
42
+
43
+
44
+ ENTRYPOINT [ "/sbin/init" ]
@@ -0,0 +1,35 @@
1
+ IMG=jsalatiel/wsbb-podman:latest
2
+ CONTAINER_NAME=wsbb
3
+ DOCKERCMD=sudo podman
4
+
5
+
6
+ USER_UID = $(shell id -u $(USER))
7
+ USER_GID = $(shell id -g $(USER))
8
+ ifeq ($(shell uname),Darwin)
9
+ USER_GID = $(shell id -u $(USER))
10
+ endif
11
+
12
+ build:
13
+ $(DOCKERCMD) build -t ${IMG} .
14
+
15
+ start:
16
+ $(DOCKERCMD) run -d --rm -it --name ${CONTAINER_NAME} \
17
+ --cap-add CAP_AUDIT_WRITE --cap-add CAP_SYS_PTRACE \
18
+ -e USER_UID=$(USER_UID) \
19
+ -e USER_GID=$(USER_GID) \
20
+ -v "$(HOME)/.Xauthority:/home/user/.Xauthority:ro" \
21
+ -v "/tmp/.X11-unix:/tmp/.X11-unix:ro" \
22
+ -v "/etc/machine-id:/etc/machine-id:ro" \
23
+ $(IMG) seg.bb.com.br
24
+ logs:
25
+ $(DOCKERCMD) logs -f ${CONTAINER_NAME}
26
+
27
+ shell:
28
+ $(DOCKERCMD) exec -it ${CONTAINER_NAME} bash
29
+
30
+ stop:
31
+ -$(DOCKERCMD) kill ${CONTAINER_NAME}
32
+
33
+ remove:
34
+ -$(DOCKERCMD) image rm ${CONTAINER_NAME}
35
+