ehbrs-tools 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +34 -13
  3. data/lib/ehbrs/tools/runner/fs/selected.rb +1 -5
  4. data/lib/ehbrs/tools/runner/music/lyrics.rb +3 -4
  5. data/lib/ehbrs/tools/runner/music/lyrics_book.rb +41 -0
  6. data/lib/ehbrs/tools/runner/music/selected.rb +6 -6
  7. data/lib/ehbrs/tools/version.rb +1 -1
  8. data/lib/ehbrs/user_dirs.rb +2 -2
  9. data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +2 -1
  10. data/vendor/eac_fs/Gemfile +5 -0
  11. data/vendor/eac_fs/eac_fs.gemspec +20 -0
  12. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb → eac_fs/lib/eac_fs/cache.rb} +7 -2
  13. data/vendor/eac_fs/lib/eac_fs/file_info.rb +24 -0
  14. data/vendor/eac_fs/lib/eac_fs/patches/module/fs_cache.rb +10 -0
  15. data/vendor/eac_fs/lib/eac_fs/patches/module.rb +4 -0
  16. data/vendor/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +10 -0
  17. data/vendor/eac_fs/lib/eac_fs/patches/object.rb +4 -0
  18. data/vendor/eac_fs/lib/eac_fs/patches/pathname/info.rb +12 -0
  19. data/vendor/eac_fs/lib/eac_fs/patches/pathname.rb +4 -0
  20. data/vendor/eac_fs/lib/eac_fs/patches.rb +4 -0
  21. data/vendor/eac_fs/lib/eac_fs/version.rb +5 -0
  22. data/vendor/eac_fs/lib/eac_fs.rb +7 -0
  23. data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/filesystem_cache_spec.rb → eac_fs/spec/lib/eac_fs/cache_spec.rb} +2 -2
  24. data/vendor/eac_fs/spec/rubocop_spec.rb +3 -0
  25. data/vendor/eac_fs/spec/spec_helper.rb +4 -0
  26. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +2 -1
  27. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +3 -3
  28. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +1 -0
  29. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +16 -7
  30. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  31. data/vendor/eac_ruby_gems_utils/Gemfile +5 -0
  32. data/vendor/eac_ruby_gems_utils/LICENCE +16 -0
  33. data/vendor/eac_ruby_gems_utils/README.rdoc +3 -0
  34. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +30 -0
  35. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +33 -0
  36. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +41 -0
  37. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +97 -0
  38. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +58 -0
  39. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/minitest.rb +25 -0
  40. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +48 -0
  41. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
  42. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +84 -0
  43. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb +21 -0
  44. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests.rb +9 -0
  45. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +5 -0
  46. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils.rb +7 -0
  47. data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +3 -0
  48. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
  49. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
  50. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb +20 -0
  51. data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +4 -0
  52. data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile +5 -0
  53. data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock +19 -0
  54. data/vendor/eac_ruby_gems_utils/spec/support/mygem/Rakefile +14 -0
  55. data/vendor/eac_ruby_gems_utils/spec/support/mygem/exe/myrunner +5 -0
  56. data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem/version.rb +5 -0
  57. data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem.rb +5 -0
  58. data/vendor/eac_ruby_gems_utils/spec/support/mygem/mygem.gemspec +16 -0
  59. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  60. data/vendor/eac_templates/Gemfile +5 -0
  61. data/vendor/eac_templates/eac_templates.gemspec +19 -0
  62. data/vendor/eac_templates/lib/eac_templates/directory.rb +108 -0
  63. data/vendor/eac_templates/lib/eac_templates/file.rb +48 -0
  64. data/vendor/eac_templates/lib/eac_templates/patches/module/erb_template.rb +9 -0
  65. data/vendor/eac_templates/lib/eac_templates/patches/module/template.rb +10 -0
  66. data/vendor/eac_templates/lib/eac_templates/patches/module.rb +4 -0
  67. data/vendor/eac_templates/lib/eac_templates/patches/object/erb_template.rb +9 -0
  68. data/vendor/eac_templates/lib/eac_templates/patches/object/template.rb +9 -0
  69. data/vendor/eac_templates/lib/eac_templates/patches/object.rb +4 -0
  70. data/vendor/eac_templates/lib/eac_templates/patches.rb +4 -0
  71. data/vendor/eac_templates/lib/eac_templates/searcher.rb +53 -0
  72. data/vendor/eac_templates/lib/eac_templates/variable_not_found_error.rb +5 -0
  73. data/vendor/eac_templates/lib/eac_templates/variable_providers/base.rb +21 -0
  74. data/vendor/eac_templates/lib/eac_templates/variable_providers/config_reader.rb +27 -0
  75. data/vendor/eac_templates/lib/eac_templates/variable_providers/entries_reader.rb +23 -0
  76. data/vendor/eac_templates/lib/eac_templates/variable_providers/generic.rb +23 -0
  77. data/vendor/eac_templates/lib/eac_templates/variable_providers/hash.rb +27 -0
  78. data/vendor/eac_templates/lib/eac_templates/variable_providers.rb +23 -0
  79. data/vendor/eac_templates/lib/eac_templates/version.rb +5 -0
  80. data/vendor/eac_templates/lib/eac_templates.rb +7 -0
  81. data/vendor/eac_templates/spec/lib/eac_templates/file_spec.rb +35 -0
  82. data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/expected_content +2 -0
  83. data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/source.template +2 -0
  84. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec.rb +30 -0
  85. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file1.template +1 -0
  86. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file2 +1 -0
  87. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path2/subdir1/file3.template +1 -0
  88. data/vendor/eac_templates/spec/lib/object/template_spec.rb +23 -0
  89. data/vendor/eac_templates/spec/lib/object/template_spec_files/path/my_stub_with_template +1 -0
  90. data/vendor/eac_templates/spec/rubocop_spec.rb +3 -0
  91. data/vendor/eac_templates/spec/spec_helper.rb +4 -0
  92. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/core_ext.rb +5 -0
  93. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build.rb +1 -1
  94. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build_file.rb +1 -1
  95. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected.rb +2 -2
  96. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb +42 -0
  97. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb +64 -0
  98. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/song.rb +68 -0
  99. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book.rb +65 -0
  100. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object.rb +4 -0
  101. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches.rb +4 -0
  102. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
  103. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/album/inner.html.erb +3 -0
  104. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/custom_style.css +11 -0
  105. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/index.html.erb +14 -0
  106. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/main.html.erb +24 -0
  107. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/resource/main.html.erb +8 -0
  108. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/song/inner.html.erb +5 -0
  109. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider.rb +4 -0
  110. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider_search.rb +1 -1
  111. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/providers_data.xml +2 -1
  112. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/version.rb +1 -1
  113. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.target.yaml +1 -1
  114. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.target.yaml +1 -1
  115. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.source.html +18 -18
  116. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.target.yaml +1 -1
  117. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.source.html +18 -18
  118. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.target.yaml +1 -1
  119. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.target.yaml +1 -3
  120. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.target.yaml +1 -1
  121. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.target.yaml +1 -1
  122. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.source.html +3 -3
  123. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.target.yaml +1 -1
  124. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.source.html +3 -3
  125. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.target.yaml +1 -1
  126. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.source.html +3 -3
  127. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.target.yaml +1 -1
  128. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.source.html +15 -12
  129. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.target.yaml +1 -1
  130. metadata +92 -7
  131. data/lib/ehbrs/patches/module/erb_template.rb +0 -11
  132. data/lib/ehbrs/patches/object/erb_template.rb +0 -9
  133. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2fcd84889771b212325a7f4315bb2e03a9584ffd36dfa13184efa56fe0294c7
4
- data.tar.gz: e4fba78ac97dfd0628bb7f1f4efc0c8fc2f46b6b598b74cb50c71bf5e3785156
3
+ metadata.gz: d120fac3799ba8b11dea2134287103606747746071469112c2fd8b78232666c4
4
+ data.tar.gz: bd700b8bfef75819deffd9e0894cb1956517f417643e975915764a77dff5423e
5
5
  SHA512:
6
- metadata.gz: b28bbf0f2abcf8cf7c4ff92f27b96a0f9d3761316cfa5796750606cc3249f00df80187410156b93caae02a649945b7bc2bc87afe656521b5fb6394828a566ee8
7
- data.tar.gz: f6e325bb6fd61d6ee7eca4cae4de5c0a057b2c1954df5e693cb28143be82c411804771071dcffdbee482ac6aee53412889fbb6eeab4bb21d45c8074abb49d6d6
6
+ metadata.gz: ee15c9a092934a7ee3d760f327919efa619da486bf615fc67c0c46fe02b49968b5523206303851694b6c4a4089c154818225e5bcc5d3eebc1ca78a22726aa6ac
7
+ data.tar.gz: 94c0648afebd291856a80a2f2214ba5ccab7e2d5a979373f0a72104f2b60b5b5053d1b7086db17ee95f688a4ed818799b6b6192116f3576c1cb31c99a1e03663
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ehbrs-tools (0.27.0)
4
+ ehbrs-tools (0.28.0)
5
5
  avm-tools (~> 0.82, >= 0.82.1)
6
6
  eac_cli (~> 0.12, >= 0.12.5)
7
7
  eac_ruby_utils (~> 0.71)
@@ -52,27 +52,50 @@ PATH
52
52
  eac_ruby_utils (~> 0.74)
53
53
  eac_templates (~> 0.1)
54
54
 
55
+ PATH
56
+ remote: vendor/eac_fs
57
+ specs:
58
+ eac_fs (0.3.0)
59
+ content-type
60
+ eac_ruby_utils (~> 0.70)
61
+ ruby-filemagic
62
+
55
63
  PATH
56
64
  remote: vendor/eac_ruby_base0
57
65
  specs:
58
- eac_ruby_base0 (0.10.1)
66
+ eac_ruby_base0 (0.11.0)
59
67
  eac_cli (~> 0.22, >= 0.22.2)
60
- eac_ruby_gems_utils (~> 0.9.5, ~> 0.9)
68
+ eac_fs (~> 0.3)
69
+ eac_ruby_gems_utils (~> 0.9.6, ~> 0.9)
70
+ eac_ruby_utils (~> 0.70)
71
+
72
+ PATH
73
+ remote: vendor/eac_ruby_gems_utils
74
+ specs:
75
+ eac_ruby_gems_utils (0.9.6)
76
+ bundler (~> 2.2, >= 2.2.17)
61
77
  eac_ruby_utils (~> 0.70)
62
78
 
63
79
  PATH
64
80
  remote: vendor/eac_ruby_utils
65
81
  specs:
66
- eac_ruby_utils (0.75.0)
82
+ eac_ruby_utils (0.76.0)
67
83
  activesupport (>= 4.0)
68
84
  addressable (~> 2.6)
69
85
  filesize
70
86
  net-ssh (~> 4.2)
71
87
 
88
+ PATH
89
+ remote: vendor/eac_templates
90
+ specs:
91
+ eac_templates (0.2.0)
92
+ eac_config (~> 0.5)
93
+ eac_ruby_utils (~> 0.64)
94
+
72
95
  PATH
73
96
  remote: vendor/ehbrs_ruby_utils
74
97
  specs:
75
- ehbrs_ruby_utils (0.11.0)
98
+ ehbrs_ruby_utils (0.12.0)
76
99
  aranha-parsers (~> 0.8, >= 0.8.5)
77
100
  avm (~> 0.3, >= 0.3.2)
78
101
  eac_ruby_utils (~> 0.70)
@@ -83,7 +106,7 @@ PATH
83
106
  PATH
84
107
  remote: vendor/ultimate_lyrics
85
108
  specs:
86
- ultimate_lyrics (0.1.1)
109
+ ultimate_lyrics (0.1.2)
87
110
  aranha-parsers (~> 0.8, >= 0.8.5)
88
111
  eac_ruby_utils (~> 0.74)
89
112
 
@@ -116,7 +139,7 @@ GEM
116
139
  avm-eac_webapp_base0 (0.1.1)
117
140
  avm (~> 0.1)
118
141
  eac_ruby_utils (~> 0.68)
119
- avm-tools (0.105.0)
142
+ avm-tools (0.106.0)
120
143
  aranha-parsers (~> 0.4)
121
144
  asciidoctor (~> 2.0, >= 2.0.12)
122
145
  avm (~> 0.1)
@@ -162,12 +185,6 @@ GEM
162
185
  rubocop (~> 0.80.1)
163
186
  rubocop-rails (~> 2.4.2)
164
187
  rubocop-rspec (~> 1.38.1)
165
- eac_ruby_gems_utils (0.9.5)
166
- bundler (~> 2.2, >= 2.2.17)
167
- eac_ruby_utils (~> 0.70)
168
- eac_templates (0.1.2)
169
- eac_config (~> 0.5)
170
- eac_ruby_utils (~> 0.64)
171
188
  faraday (1.8.0)
172
189
  faraday-em_http (~> 1.0)
173
190
  faraday-em_synchrony (~> 1.0)
@@ -245,6 +262,7 @@ GEM
245
262
  rubocop (>= 0.72.0)
246
263
  rubocop-rspec (1.38.1)
247
264
  rubocop (>= 0.68.1)
265
+ ruby-filemagic (0.7.2)
248
266
  ruby-progressbar (1.11.0)
249
267
  ruby2_keywords (0.0.5)
250
268
  rubyzip (2.3.2)
@@ -275,9 +293,12 @@ DEPENDENCIES
275
293
  eac_cli!
276
294
  eac_config!
277
295
  eac_docker!
296
+ eac_fs!
278
297
  eac_ruby_base0!
279
298
  eac_ruby_gem_support (~> 0.3)
299
+ eac_ruby_gems_utils!
280
300
  eac_ruby_utils!
301
+ eac_templates!
281
302
  ehbrs-tools!
282
303
  ehbrs_ruby_utils!
283
304
  ultimate_lyrics!
@@ -29,10 +29,6 @@ module Ehbrs
29
29
 
30
30
  protected
31
31
 
32
- def build_selected_directory(path)
33
- path
34
- end
35
-
36
32
  def directory_label(directory)
37
33
  directory.to_s
38
34
  end
@@ -58,7 +54,7 @@ module Ehbrs
58
54
 
59
55
  def selected_directories_uncached
60
56
  infom 'Searching selected directories...'
61
- selected.found.map { |path| build_selected_directory(path) }
57
+ selected.found
62
58
  end
63
59
 
64
60
  def selected_uncached
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/fs_cache'
4
3
  require 'ehbrs/tools/core_ext'
5
4
  require 'ehbrs_ruby_utils/videos/container'
6
5
  require 'ultimate_lyrics/provider'
@@ -13,7 +12,7 @@ module Ehbrs
13
12
  DEFAULT_PROVIDER = 'lyrics.com'
14
13
 
15
14
  runner_with :help, :output do
16
- arg_opt '-p', '--provider', "Nome do provedor [Nome do #{DEFAULT_PROVIDER}]"
15
+ arg_opt '-p', '--provider', 'Nome do provedor.', default: DEFAULT_PROVIDER
17
16
  pos_arg :file
18
17
  end
19
18
 
@@ -33,7 +32,7 @@ module Ehbrs
33
32
 
34
33
  def start_banner
35
34
  infov 'File', file
36
- %w[artist album track title].each do |attr|
35
+ %w[artist album track title year].each do |attr|
37
36
  infov attr.humanize, container.tag_file.tag.send(attr)
38
37
  end
39
38
  infov 'Selected provider', provider
@@ -60,7 +59,7 @@ module Ehbrs
60
59
  end
61
60
 
62
61
  def provider_name
63
- parsed.provider.if_present(DEFAULT_PROVIDER)
62
+ parsed.provider
64
63
  end
65
64
  end
66
65
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs/tools/core_ext'
4
+ require 'ehbrs_ruby_utils/music/lyrics_book'
5
+ require 'ehbrs_ruby_utils/videos/container'
6
+ require 'ultimate_lyrics/provider'
7
+
8
+ module Ehbrs
9
+ module Tools
10
+ class Runner
11
+ class Music
12
+ class LyricsBook
13
+ runner_with :help, :output do
14
+ arg_opt '-p', '--provider', 'Nome do provedor.',
15
+ default: ::EhbrsRubyUtils::Music::LyricsBook::DEFAULT_PROVIDER_NAME
16
+ pos_arg :source_dir
17
+ end
18
+
19
+ def run
20
+ start_banner
21
+ run_output
22
+ end
23
+
24
+ def start_banner
25
+ infov 'Source directory', book.source_dir
26
+ infov 'Selected provider', book.provider
27
+ end
28
+
29
+ def book_uncached
30
+ ::EhbrsRubyUtils::Music::LyricsBook.new(parsed.source_dir,
31
+ provider_name: parsed.provider)
32
+ end
33
+
34
+ def output_content
35
+ book.output
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -10,16 +10,16 @@ module Ehbrs
10
10
  class Selected < ::Ehbrs::Tools::Runner::Fs::Selected
11
11
  protected
12
12
 
13
- def build_selected_directory(path)
14
- ::Ehbrs::Music::Album.new(path)
15
- end
16
-
17
13
  def directory_label(directory)
18
- directory.to_label
14
+ path_to_album(directory).to_label
19
15
  end
20
16
 
21
17
  def directory_target_basename(directory)
22
- directory.id
18
+ path_to_album(directory).id
19
+ end
20
+
21
+ def path_to_album(path)
22
+ ::Ehbrs::Music::Album.new(path)
23
23
  end
24
24
  end
25
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.27.0'
5
+ VERSION = '0.28.0'
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/filesystem_cache'
3
+ require 'eac_fs/cache'
4
4
  require 'eac_ruby_utils/simple_cache'
5
5
 
6
6
  module Ehbrs
@@ -15,7 +15,7 @@ module Ehbrs
15
15
  private
16
16
 
17
17
  def user_home_dir_uncached
18
- ::EacRubyUtils::FilesystemCache.new(ENV['HOME'])
18
+ ::EacFs::Cache.new(ENV['HOME'])
19
19
  end
20
20
 
21
21
  def cache_uncached
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_fs/cache'
3
4
  require 'eac_ruby_utils/fs/temp'
4
5
  require 'ehbrs/tools/runner'
5
6
  require 'ehbrs/tools/runner/fs/used_space'
@@ -8,7 +9,7 @@ require 'ehbrs/observers/with_persistence'
8
9
  RSpec.describe ::Ehbrs::Tools::Runner::Fs::UsedSpace do
9
10
  let(:target) { ::EacRubyUtils::Fs::Temp.directory }
10
11
  let(:user_dir) { ::EacRubyUtils::Fs::Temp.directory }
11
- let(:cached_user_dir) { ::EacRubyUtils::FilesystemCache.new(user_dir) }
12
+ let(:cached_user_dir) { ::EacFs::Cache.new(user_dir) }
12
13
  let(:observers_user_dir) { cached_user_dir.child('observers') }
13
14
  let(:observer_path) do
14
15
  observers_user_dir.child(target.to_s.parameterize).content_path.to_pathname
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'eac_fs/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'eac_fs'
9
+ s.version = EacFs::VERSION
10
+ s.authors = ['Put here the authors']
11
+ s.summary = 'Put here de description.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+
15
+ s.add_dependency 'content-type'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.70'
17
+ s.add_dependency 'ruby-filemagic'
18
+
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3'
20
+ end
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module EacRubyUtils
4
- class FilesystemCache
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'fileutils'
5
+
6
+ module EacFs
7
+ class Cache
8
+ enable_context
9
+
5
10
  CONTENT_FILE_NAME = '__content__'
6
11
 
7
12
  attr_reader :path
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'content-type'
5
+ require 'filemagic'
6
+
7
+ module EacFs
8
+ class FileInfo
9
+ enable_simple_cache
10
+ attr_reader :magic_string
11
+
12
+ def initialize(path)
13
+ @magic_string = ::FileMagic.new(FileMagic::MAGIC_MIME).file(path.to_pathname.to_path)
14
+ end
15
+
16
+ delegate :charset, :mime_type, :subtype, :type, to: :content_type
17
+
18
+ private
19
+
20
+ def content_type_uncached
21
+ ::ContentType.parse(magic_string)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_fs/cache'
4
+
5
+ class Module
6
+ # @return [EacFs::Cache]
7
+ def fs_cache
8
+ ::EacFs::Cache.context.current.child('fs_cache', *name.split('::'))
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_fs/patches/module/fs_cache'
4
+
5
+ class Object
6
+ # @return [EacFs::Cache]
7
+ def fs_cache
8
+ self.class.fs_cache
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_fs/file_info'
4
+ require 'pathname'
5
+
6
+ class Pathname
7
+ # Shortcut for `EacFs::FileInfo.new(self)`.
8
+ # @return [EacFs::FileInfo]
9
+ def info
10
+ ::EacFs::FileInfo.new(self)
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacFs
4
+ VERSION = '0.3.0'
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacFs
6
+ require_sub __FILE__
7
+ end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/core_ext/object/blank'
4
- require 'eac_ruby_utils/filesystem_cache'
4
+ require 'eac_fs/cache'
5
5
 
6
- RSpec.describe ::EacRubyUtils::FilesystemCache do
6
+ RSpec.describe ::EacFs::Cache do
7
7
  let(:tmpdir) { ::Dir.mktmpdir }
8
8
  let(:instance) { described_class.new(tmpdir, 'instance') }
9
9
 
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -13,7 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
15
  s.add_dependency 'eac_cli', '~> 0.22', '>= 0.22.2'
16
- s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '~> 0.9.5'
16
+ s.add_dependency 'eac_fs', '~> 0.3'
17
+ s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '~> 0.9.6'
17
18
  s.add_dependency 'eac_ruby_utils', '~> 0.70'
18
19
 
19
20
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3'
@@ -3,10 +3,10 @@
3
3
  require 'eac_cli/config'
4
4
  require 'eac_config/envvars_node'
5
5
  require 'eac_config/yaml_file_node'
6
+ require 'eac_fs/cache'
6
7
  require 'eac_ruby_base0/application_xdg'
7
8
  require 'eac_ruby_gems_utils/gem'
8
9
  require 'eac_ruby_utils/core_ext'
9
- require 'eac_ruby_utils/filesystem_cache'
10
10
 
11
11
  module EacRubyBase0
12
12
  class Application
@@ -44,8 +44,8 @@ module EacRubyBase0
44
44
  end
45
45
 
46
46
  def fs_cache
47
- @fs_cache ||= ::EacRubyUtils::FilesystemCache.new(
48
- cache_dir.join(::EacRubyUtils::FilesystemCache.name.parameterize)
47
+ @fs_cache ||= ::EacFs::Cache.new(
48
+ cache_dir.join(::EacFs::Cache.name.parameterize)
49
49
  )
50
50
  end
51
51
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_cli/core_ext'
4
+ require 'eac_fs/patches'
4
5
  require 'eac_ruby_base0/patches'
@@ -3,6 +3,7 @@
3
3
  require 'eac_cli/core_ext'
4
4
  require 'eac_cli/speaker'
5
5
  require 'eac_config/node'
6
+ require 'eac_fs/cache'
6
7
  require 'eac_ruby_utils/speaker'
7
8
 
8
9
  module EacRubyBase0
@@ -23,13 +24,11 @@ module EacRubyBase0
23
24
  end
24
25
 
25
26
  def run
26
- ::EacRubyUtils::Speaker.context.on(build_speaker) do
27
- ::EacConfig::Node.context.on(runner_context.call(:application).build_config) do
28
- if parsed.version?
29
- show_version
30
- else
31
- run_with_subcommand
32
- end
27
+ on_context do
28
+ if parsed.version?
29
+ show_version
30
+ else
31
+ run_with_subcommand
33
32
  end
34
33
  end
35
34
  end
@@ -38,6 +37,16 @@ module EacRubyBase0
38
37
  runner_context.call(:application).version.to_s
39
38
  end
40
39
 
40
+ def on_context
41
+ ::EacRubyUtils::Speaker.context.on(build_speaker) do
42
+ ::EacConfig::Node.context.on(runner_context.call(:application).build_config) do
43
+ ::EacFs::Cache.context.on(application.fs_cache) do
44
+ yield
45
+ end
46
+ end
47
+ end
48
+ end
49
+
41
50
  def show_version
42
51
  out("#{application_version}\n")
43
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.10.1'
4
+ VERSION = '0.11.0'
5
5
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,16 @@
1
+ Copyright (c) 2020 Eduardo Henrique Bogoni
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
+ associated documentation files (the "Software"), to deal in the Software without restriction,
5
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
+ furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice (including the next paragraph) shall be
10
+ included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
16
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = E.A.C.'s Ruby Gems Utils.
2
+
3
+ Utilities for Ruby\'s gems development.
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ # Maintain your gem's version:
6
+ require 'eac_ruby_gems_utils/version'
7
+
8
+ # Describe your gem and declare its dependencies:
9
+ Gem::Specification.new do |s|
10
+ s.name = 'eac_ruby_gems_utils'
11
+ s.version = ::EacRubyGemsUtils::VERSION
12
+ s.authors = ['Esquilo Azul Company']
13
+ s.summary = 'Utilities for Ruby gems development.'
14
+ s.license = 'MIT'
15
+ s.homepage = 'https://github.com/esquilo-azul/eac_ruby_gems_utils'
16
+ s.metadata = { 'source_code_uri' => s.homepage }
17
+
18
+ s.extra_rdoc_files = ['README.rdoc']
19
+ s.rdoc_options = ['--charset=UTF-8']
20
+
21
+ s.require_paths = ['lib']
22
+ s.files = Dir['{lib}/**/*', 'Gemfile']
23
+ s.test_files = Dir['{spec}/**/*', '.rspec']
24
+
25
+ s.add_dependency 'bundler', '~> 2.2', '>= 2.2.17'
26
+ s.add_dependency 'eac_ruby_utils', '~> 0.70'
27
+
28
+ # Tests
29
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3'
30
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/ruby/command'
5
+ require 'delegate'
6
+
7
+ module EacRubyGemsUtils
8
+ class Gem
9
+ class Command < ::EacRubyUtils::Ruby::Command
10
+ attr_reader :gem
11
+
12
+ def initialize(gem, command_args, extra_options = {})
13
+ @gem = gem
14
+ super(command_args, extra_options.merge(host_env: gem.host_env))
15
+ end
16
+
17
+ # Changes current directory to the gem's directory.
18
+ def chdir_root
19
+ chdir(gem.root.to_path)
20
+ end
21
+
22
+ def envvar_gemfile
23
+ envvar('BUNDLE_GEMFILE', gem.gemfile_path.to_path)
24
+ end
25
+
26
+ protected
27
+
28
+ def duplicate(command, extra_options)
29
+ self.class.new(gem, command, extra_options)
30
+ end
31
+ end
32
+ end
33
+ end