ehbrs-tools 0.25.1 → 0.28.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +60 -22
- data/lib/ehbrs/{core_ext.rb → tools/core_ext.rb} +0 -0
- data/lib/ehbrs/tools/runner/finances/bb_browser.rb +1 -1
- data/lib/ehbrs/tools/runner/fs/selected.rb +19 -26
- data/lib/ehbrs/tools/runner/music/lyrics.rb +68 -0
- data/lib/ehbrs/tools/runner/music/lyrics_book.rb +41 -0
- data/lib/ehbrs/tools/runner/music/selected.rb +6 -6
- data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +1 -1
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/user_dirs.rb +2 -2
- data/lib/ehbrs/videos/extract/package.rb +2 -2
- data/lib/ehbrs/videos/extract/package_file.rb +0 -1
- data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +2 -1
- data/vendor/aranha-parsers/aranha-parsers.gemspec +1 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/rspec/setup.rb +1 -1
- data/vendor/aranha-parsers/lib/aranha/parsers/rspec/{source_target_fixtures_example.rb → shared_examples/source_target_fixtures.rb} +0 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/source_address/fetch_content_error.rb +10 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/source_address/http_get.rb +15 -2
- data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +9 -1
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +6 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +3 -3
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +6 -5
- data/vendor/eac_fs/Gemfile +5 -0
- data/vendor/eac_fs/eac_fs.gemspec +20 -0
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb → eac_fs/lib/eac_fs/cache.rb} +7 -2
- data/vendor/eac_fs/lib/eac_fs/file_info.rb +24 -0
- data/vendor/eac_fs/lib/eac_fs/patches/module/fs_cache.rb +10 -0
- data/vendor/eac_fs/lib/eac_fs/patches/module.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +10 -0
- data/vendor/eac_fs/lib/eac_fs/patches/object.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/patches/pathname/info.rb +12 -0
- data/vendor/eac_fs/lib/eac_fs/patches/pathname.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/patches.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/version.rb +5 -0
- data/vendor/eac_fs/lib/eac_fs.rb +7 -0
- 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
- data/vendor/eac_fs/spec/rubocop_spec.rb +3 -0
- data/vendor/eac_fs/spec/spec_helper.rb +4 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +2 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +3 -3
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +1 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +16 -7
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/Gemfile +5 -0
- data/vendor/eac_ruby_gems_utils/LICENCE +16 -0
- data/vendor/eac_ruby_gems_utils/README.rdoc +3 -0
- data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +30 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +33 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +41 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +97 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +58 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/minitest.rb +25 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +48 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +84 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb +21 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests.rb +9 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +5 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils.rb +7 -0
- data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +3 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb +20 -0
- data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +4 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock +19 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/Rakefile +14 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/exe/myrunner +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem/version.rb +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem.rb +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/mygem.gemspec +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/compact.rb +22 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/compact.rb +20 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/delimited.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/string_delimited.rb +70 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/compact_spec.rb +20 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb +20 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/string/delimited_spec.rb +34 -0
- data/vendor/eac_templates/Gemfile +5 -0
- data/vendor/eac_templates/eac_templates.gemspec +19 -0
- data/vendor/eac_templates/lib/eac_templates/directory.rb +108 -0
- data/vendor/eac_templates/lib/eac_templates/file.rb +48 -0
- data/vendor/eac_templates/lib/eac_templates/patches/module/erb_template.rb +9 -0
- data/vendor/eac_templates/lib/eac_templates/patches/module/template.rb +10 -0
- data/vendor/eac_templates/lib/eac_templates/patches/module.rb +4 -0
- data/vendor/eac_templates/lib/eac_templates/patches/object/erb_template.rb +9 -0
- data/vendor/eac_templates/lib/eac_templates/patches/object/template.rb +9 -0
- data/vendor/eac_templates/lib/eac_templates/patches/object.rb +4 -0
- data/vendor/eac_templates/lib/eac_templates/patches.rb +4 -0
- data/vendor/eac_templates/lib/eac_templates/searcher.rb +53 -0
- data/vendor/eac_templates/lib/eac_templates/variable_not_found_error.rb +5 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/base.rb +21 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/config_reader.rb +27 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/entries_reader.rb +23 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/generic.rb +23 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/hash.rb +27 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers.rb +23 -0
- data/vendor/eac_templates/lib/eac_templates/version.rb +5 -0
- data/vendor/eac_templates/lib/eac_templates.rb +7 -0
- data/vendor/eac_templates/spec/lib/eac_templates/file_spec.rb +35 -0
- data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/expected_content +2 -0
- data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/source.template +2 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec.rb +30 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file1.template +1 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file2 +1 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path2/subdir1/file3.template +1 -0
- data/vendor/eac_templates/spec/lib/object/template_spec.rb +23 -0
- data/vendor/eac_templates/spec/lib/object/template_spec_files/path/my_stub_with_template +1 -0
- data/vendor/eac_templates/spec/rubocop_spec.rb +3 -0
- data/vendor/eac_templates/spec/spec_helper.rb +4 -0
- data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +4 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/core_ext.rb +5 -0
- data/{lib/ehbrs → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils}/fs/compressed_package.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build.rb +41 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build_file.rb +27 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected.rb +35 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs.rb +10 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb +42 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb +64 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/song.rb +68 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book.rb +65 -0
- data/{lib/ehbrs/fs.rb → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music.rb} +2 -2
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object.rb +4 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches.rb +4 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +31 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +1 -1
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/album/inner.html.erb +3 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/custom_style.css +15 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/index.html.erb +14 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/main.html.erb +24 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/resource/main.html.erb +8 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/song/inner.html.erb +9 -0
- data/vendor/ultimate_lyrics/Gemfile +5 -0
- data/vendor/ultimate_lyrics/bin/download_parser_spec_files.rb +94 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/field.rb +83 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/lyrics.rb +13 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/parser.rb +28 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/exclude_item.rb +17 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/extract_item.rb +21 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/item.rb +48 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/replace_fields.rb +13 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/rule.rb +52 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb +21 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider.rb +96 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider_search.rb +43 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/providers_data.xml +356 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata/field.rb +24 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata.rb +28 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/version.rb +5 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics.rb +7 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec.rb +20 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.source.html +8 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.source.html +8 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.source.html +193 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.source.html +193 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.source.html +87 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.target.yaml +36 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.source.html +4 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.source.html +2 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.source.html +2 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.source.html +101 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.source.html +29 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.source.html +29 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.source.html +1301 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/provider_search_spec.rb +72 -0
- data/vendor/ultimate_lyrics/spec/rubocop_spec.rb +3 -0
- data/vendor/ultimate_lyrics/spec/spec_helper.rb +4 -0
- data/vendor/ultimate_lyrics/ultimate_lyrics.gemspec +21 -0
- metadata +170 -13
- data/lib/ehbrs/patches/module/erb_template.rb +0 -11
- data/lib/ehbrs/patches/object/erb_template.rb +0 -9
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +0 -12
@@ -13,6 +13,7 @@ RSpec.describe ::EacCli::Runner do
|
|
13
13
|
bool_opt '-p', '--opt2', 'A boolean option'
|
14
14
|
arg_opt '-q', '--opt4', 'A repeatable argument option.', repeat: true
|
15
15
|
bool_opt '-r', '--opt5', 'A repeatable boolean option', repeat: true
|
16
|
+
arg_opt '-s', '--opt6', 'A argument option with default value', default: 'DEFAULT'
|
16
17
|
pos_arg :pos1
|
17
18
|
pos_arg :pos2, repeat: true, optional: true
|
18
19
|
alt do
|
@@ -28,9 +29,9 @@ RSpec.describe ::EacCli::Runner do
|
|
28
29
|
let(:parsed_actual) { instance.parsed.to_h.symbolize_keys }
|
29
30
|
|
30
31
|
context 'when all args are supplied' do
|
31
|
-
let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd] }
|
32
|
+
let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd --opt6 6] }
|
32
33
|
let(:parsed_expected) do
|
33
|
-
{ opt1: 'aaa', opt2: true, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
34
|
+
{ opt1: 'aaa', opt2: true, opt3: false, opt4: [], opt5: 0, opt6: '6', pos1: 'bbb',
|
34
35
|
pos2: %w[ccc ddd] }
|
35
36
|
end
|
36
37
|
|
@@ -65,7 +66,7 @@ RSpec.describe ::EacCli::Runner do
|
|
65
66
|
context 'when only required args are supplied' do
|
66
67
|
let(:argv) { %w[bbb] }
|
67
68
|
let(:parsed_expected) do
|
68
|
-
{ opt1: nil, opt2: false, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
69
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: [], opt5: 0, opt6: 'DEFAULT', pos1: 'bbb',
|
69
70
|
pos2: [] }
|
70
71
|
end
|
71
72
|
|
@@ -87,7 +88,7 @@ RSpec.describe ::EacCli::Runner do
|
|
87
88
|
context 'when alternative args are supplied' do
|
88
89
|
let(:argv) { %w[--opt3] }
|
89
90
|
let(:parsed_expected) do
|
90
|
-
{ opt1: nil, opt2: false, opt3: true, opt4: [], opt5: 0, pos1: nil,
|
91
|
+
{ opt1: nil, opt2: false, opt3: true, opt4: [], opt5: 0, opt6: 'DEFAULT', pos1: nil,
|
91
92
|
pos2: [] }
|
92
93
|
end
|
93
94
|
|
@@ -98,7 +99,7 @@ RSpec.describe ::EacCli::Runner do
|
|
98
99
|
context 'when repeated options are supplied' do
|
99
100
|
let(:argv) { %w[--opt5 -rrr --opt4=A -q B --opt4 C AAA] }
|
100
101
|
let(:parsed_expected) do
|
101
|
-
{ opt1: nil, opt2: false, opt3: false, opt4: %w[A B C], opt5: 4, pos1: 'AAA',
|
102
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: %w[A B C], opt5: 4, opt6: 'DEFAULT', pos1: 'AAA',
|
102
103
|
pos2: [] }
|
103
104
|
end
|
104
105
|
|
@@ -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
|
@@ -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
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/core_ext/object/blank'
|
4
|
-
require '
|
4
|
+
require 'eac_fs/cache'
|
5
5
|
|
6
|
-
RSpec.describe ::
|
6
|
+
RSpec.describe ::EacFs::Cache do
|
7
7
|
let(:tmpdir) { ::Dir.mktmpdir }
|
8
8
|
let(:instance) { described_class.new(tmpdir, 'instance') }
|
9
9
|
|
@@ -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 '
|
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 ||= ::
|
48
|
-
cache_dir.join(::
|
47
|
+
@fs_cache ||= ::EacFs::Cache.new(
|
48
|
+
cache_dir.join(::EacFs::Cache.name.parameterize)
|
49
49
|
)
|
50
50
|
end
|
51
51
|
|
@@ -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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
@@ -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,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
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRubyGemsUtils
|
6
|
+
class Gem
|
7
|
+
class VersionFile
|
8
|
+
common_constructor :path
|
9
|
+
|
10
|
+
VERSION_LINE_PATTERN = /\A(\s*)VERSION\s*=\s*[\'\"]([^\'\"]+)[\'\"](\s*)\z/.freeze
|
11
|
+
|
12
|
+
def value
|
13
|
+
path.read.each_line.lazy.map { |line| line_value(line) }.find { |v| v }
|
14
|
+
end
|
15
|
+
|
16
|
+
def value=(new_value)
|
17
|
+
path.write(new_value_content(new_value))
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# @return Version found in line, nil otherwise.
|
23
|
+
def line_value(line)
|
24
|
+
VERSION_LINE_PATTERN.if_match(line.rstrip, false) { |m| ::Gem::Version.new(m[2]) }
|
25
|
+
end
|
26
|
+
|
27
|
+
def new_value_content(new_value)
|
28
|
+
path.read.each_line
|
29
|
+
.map { |line| new_value_line(line, new_value) }
|
30
|
+
.join
|
31
|
+
end
|
32
|
+
|
33
|
+
def new_value_line(line, new_value)
|
34
|
+
m = VERSION_LINE_PATTERN.match(line)
|
35
|
+
return line unless m
|
36
|
+
|
37
|
+
"#{m[1]}VERSION = '#{new_value}'#{m[3]}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/envs'
|
5
|
+
require 'rubygems'
|
6
|
+
|
7
|
+
module EacRubyGemsUtils
|
8
|
+
class Gem
|
9
|
+
require_sub __FILE__
|
10
|
+
enable_simple_cache
|
11
|
+
|
12
|
+
GEMSPEC_EXTNAME = '.gemspec'
|
13
|
+
|
14
|
+
common_constructor :root, :host_env, default: [nil] do
|
15
|
+
@root = ::Pathname.new(root).expand_path
|
16
|
+
self.host_env ||= ::EacRubyUtils::Envs.local
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
name
|
21
|
+
end
|
22
|
+
|
23
|
+
def bundle(*args)
|
24
|
+
::EacRubyGemsUtils::Gem::Command.new(self, %w[bundle] + args).envvar_gemfile
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return A [Pathname] array with relative paths from root listed in gemspec's .file directive.
|
28
|
+
def files
|
29
|
+
gemspec.files.map(&:to_pathname)
|
30
|
+
end
|
31
|
+
|
32
|
+
def gemfile_lock_gem_version(gem_name)
|
33
|
+
gemfile_lock_content.specs.find { |gem| gem.name == gem_name }.if_present(&:version)
|
34
|
+
end
|
35
|
+
|
36
|
+
def gemfile_lock_content
|
37
|
+
::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path))
|
38
|
+
end
|
39
|
+
|
40
|
+
def name
|
41
|
+
name_by_gemspec || name_by_path
|
42
|
+
end
|
43
|
+
|
44
|
+
def name_by_gemspec
|
45
|
+
gemspec_path.if_present { |v| v.basename(GEMSPEC_EXTNAME).to_path }
|
46
|
+
end
|
47
|
+
|
48
|
+
def name_by_path
|
49
|
+
fullname = root.basename.to_s
|
50
|
+
/\A(.+)(?:-\d+(?:\.\d+)*)\z/.if_match(fullname, false) { |m| m[1] }.if_present(fullname)
|
51
|
+
end
|
52
|
+
|
53
|
+
def namespace_parts
|
54
|
+
name.split('-')
|
55
|
+
end
|
56
|
+
|
57
|
+
def rake(*args)
|
58
|
+
raise "File \"#{rakefile_path}\" does not exist" unless rakefile_path.exist?
|
59
|
+
|
60
|
+
bundle('exec', 'rake', '--rakefile', rakefile_path, *args)
|
61
|
+
end
|
62
|
+
|
63
|
+
def version
|
64
|
+
version_file.value
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def gemfile_path_uncached
|
70
|
+
root.join('Gemfile')
|
71
|
+
end
|
72
|
+
|
73
|
+
def gemfile_lock_path_uncached
|
74
|
+
gemfile_path.basename_sub { |b| "#{b}.lock" }
|
75
|
+
end
|
76
|
+
|
77
|
+
def gemspec_uncached
|
78
|
+
::Gem::Specification.load(gemspec_path.to_path)
|
79
|
+
end
|
80
|
+
|
81
|
+
def gemspec_path_uncached
|
82
|
+
::Pathname.glob("#{root.to_path}/*#{GEMSPEC_EXTNAME}").first
|
83
|
+
end
|
84
|
+
|
85
|
+
def rakefile_path_uncached
|
86
|
+
root.join('Rakefile')
|
87
|
+
end
|
88
|
+
|
89
|
+
def version_file_uncached
|
90
|
+
::EacRubyGemsUtils::Gem::VersionFile.new(version_file_path)
|
91
|
+
end
|
92
|
+
|
93
|
+
def version_file_path_uncached
|
94
|
+
root.join('lib', *namespace_parts, 'version.rb')
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/fs/logs'
|
5
|
+
require 'eac_ruby_utils/listable'
|
6
|
+
require 'eac_ruby_utils/on_clean_ruby_environment'
|
7
|
+
|
8
|
+
module EacRubyGemsUtils
|
9
|
+
module Tests
|
10
|
+
class Base
|
11
|
+
include ::EacRubyUtils::Listable
|
12
|
+
|
13
|
+
enable_simple_cache
|
14
|
+
lists.add_string :result, :failed, :nonexistent, :successful
|
15
|
+
|
16
|
+
common_constructor :gem
|
17
|
+
|
18
|
+
def elegible?
|
19
|
+
dependency_present? && gem.root.join(test_directory).exist?
|
20
|
+
end
|
21
|
+
|
22
|
+
def dependency_present?
|
23
|
+
gem.gemfile_path.exist? && gem.gemfile_lock_gem_version(dependency_gem).present?
|
24
|
+
end
|
25
|
+
|
26
|
+
def name
|
27
|
+
self.class.name.demodulize.gsub(/Test\z/, '')
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_s
|
31
|
+
"#{gem}[#{name}]"
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def logs_uncached
|
37
|
+
::EacRubyUtils::Fs::Logs.new.add(:stdout).add(:stderr)
|
38
|
+
end
|
39
|
+
|
40
|
+
def result_uncached
|
41
|
+
return RESULT_NONEXISTENT unless elegible?
|
42
|
+
|
43
|
+
exec_run_with_log ? RESULT_SUCCESSFUL : RESULT_FAILED
|
44
|
+
end
|
45
|
+
|
46
|
+
def exec_run
|
47
|
+
gem.bundle('exec', *bundle_exec_args).chdir_root.execute
|
48
|
+
end
|
49
|
+
|
50
|
+
def exec_run_with_log
|
51
|
+
r = exec_run
|
52
|
+
logs[:stdout].write(r[:stdout])
|
53
|
+
logs[:stderr].write(r[:stderr])
|
54
|
+
r[:exit_code].zero?
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_gems_utils/tests/base'
|
4
|
+
|
5
|
+
module EacRubyGemsUtils
|
6
|
+
module Tests
|
7
|
+
class Minitest < ::EacRubyGemsUtils::Tests::Base
|
8
|
+
def bundle_exec_args
|
9
|
+
%w[rake test]
|
10
|
+
end
|
11
|
+
|
12
|
+
def dependency_gem
|
13
|
+
'minitest'
|
14
|
+
end
|
15
|
+
|
16
|
+
def elegible?
|
17
|
+
super && gem.rakefile_path.exist?
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_directory
|
21
|
+
'test'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|