ehbrs-tools 0.23.0 → 0.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.avm.yml +4 -0
- data/.rspec +1 -0
- data/.rubocop.yml +39 -0
- data/Gemfile.lock +269 -0
- data/exe/ehbrs +2 -2
- data/lib/ehbrs/tools/runner/cooking_book/build.rb +52 -0
- data/lib/ehbrs/tools/runner/cooking_book.rb +32 -0
- data/lib/ehbrs/tools/runner/finances/bb_browser.rb +66 -0
- data/lib/ehbrs/{runner/videos/series.rb → tools/runner/finances.rb} +4 -4
- data/lib/ehbrs/tools/runner/fs/selected.rb +81 -0
- data/lib/ehbrs/tools/runner/fs/used_space.rb +161 -0
- data/lib/ehbrs/tools/runner/fs.rb +18 -0
- data/lib/ehbrs/tools/runner/google/translate.rb +89 -0
- data/lib/ehbrs/tools/runner/google.rb +18 -0
- data/lib/ehbrs/tools/runner/music/selected.rb +28 -0
- data/lib/ehbrs/tools/runner/music.rb +18 -0
- data/lib/ehbrs/tools/runner/self/test.rb +27 -0
- data/lib/ehbrs/tools/runner/self.rb +18 -0
- data/lib/ehbrs/tools/runner/telegram/send_message.rb +31 -0
- data/lib/ehbrs/tools/runner/telegram.rb +28 -0
- data/lib/ehbrs/tools/runner/vg/ips.rb +134 -0
- data/lib/ehbrs/tools/runner/vg/wii.rb +74 -0
- data/lib/ehbrs/tools/runner/vg.rb +18 -0
- data/lib/ehbrs/tools/runner/videos/extract.rb +70 -0
- data/lib/ehbrs/tools/runner/videos/probe.rb +34 -0
- data/lib/ehbrs/tools/runner/videos/series/rename.rb +74 -0
- data/lib/ehbrs/tools/runner/videos/series.rb +20 -0
- data/lib/ehbrs/tools/runner/videos/unsupported.rb +61 -0
- data/lib/ehbrs/{runner/web_utils → tools/runner}/videos.rb +3 -3
- data/lib/ehbrs/tools/runner/web_utils/videos/download.rb +75 -0
- data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +77 -0
- data/lib/ehbrs/tools/runner/web_utils/videos.rb +20 -0
- data/lib/ehbrs/tools/runner/web_utils.rb +26 -0
- data/lib/ehbrs/tools/runner.rb +21 -0
- data/lib/ehbrs/tools/version.rb +1 -1
- data/spec/code/rubocop_spec.rb +3 -0
- data/spec/lib/ehbrs/cooking_book/recipe/measure_spec.rb +21 -0
- data/spec/lib/ehbrs/observers/base_spec.rb +93 -0
- data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +61 -0
- data/spec/lib/ehbrs/tools/runner/vg/ips_spec.rb +31 -0
- data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom +0 -0
- data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips +0 -0
- data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips +0 -0
- data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom +0 -0
- data/spec/lib/ehbrs/tools/runner/videos/probe_spec.rb +19 -0
- data/spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml +105 -0
- data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb +75 -0
- data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml +90 -0
- data/spec/lib/ehbrs/tools/runner_spec.rb +16 -0
- data/spec/lib/ehbrs/vg/wii/game_file_spec.rb +21 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec.rb +11 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.source.witdump +27 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.target.yaml +22 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.source.witdump +28 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.target.yaml +21 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.source.witdump +16 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.target.yaml +19 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.source.witdump +28 -0
- data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.target.yaml +23 -0
- data/spec/lib/ehbrs/vg/wii/wit/path_spec.rb +33 -0
- data/spec/spec_helper/videos.rb +30 -0
- data/spec/spec_helper/videos_files/stub_source.mp4 +0 -0
- data/spec/spec_helper.rb +7 -0
- data/vendor/aranha-parsers/aranha-parsers.gemspec +2 -2
- data/vendor/aranha-parsers/lib/aranha/parsers/rspec/setup.rb +15 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/{spec → rspec}/source_target_fixtures_example.rb +0 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/rspec.rb +11 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/source_address.rb +10 -8
- data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
- data/vendor/aranha-parsers/spec/lib/rubocop_check_spec.rb +1 -1
- data/vendor/aranha-parsers/spec/spec_helper.rb +2 -9
- data/vendor/aranha-selenium/aranha-selenium.gemspec +2 -2
- data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +1 -1
- data/vendor/aranha-selenium/spec/rubocop_check_spec.rb +1 -5
- data/vendor/aranha-selenium/spec/spec_helper.rb +2 -98
- data/vendor/eac_cli/eac_cli.gemspec +3 -3
- data/vendor/eac_cli/lib/eac_cli/config/entry.rb +0 -2
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/rubocop_spec.rb +1 -1
- data/vendor/eac_cli/spec/spec_helper.rb +2 -101
- data/vendor/eac_config/eac_config.gemspec +2 -2
- data/vendor/eac_config/lib/eac_config/version.rb +1 -1
- data/vendor/eac_config/spec/rubocop_spec.rb +1 -1
- data/vendor/eac_config/spec/spec_helper.rb +2 -15
- data/vendor/eac_docker/eac_docker.gemspec +2 -2
- data/vendor/eac_docker/lib/eac_docker/container.rb +7 -3
- data/vendor/eac_docker/lib/eac_docker/debug.rb +15 -0
- data/vendor/eac_docker/lib/eac_docker/images/coded.rb +4 -0
- data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +16 -2
- data/vendor/eac_docker/lib/eac_docker/rspec/setup.rb +17 -0
- data/vendor/eac_docker/lib/eac_docker/rspec.rb +2 -10
- data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
- data/vendor/eac_docker/spec/rubocop_spec.rb +1 -1
- data/vendor/eac_docker/spec/spec_helper.rb +2 -104
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -1
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +2 -101
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +15 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +75 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +35 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/recursive_builder.rb +51 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/default_setup.rb +20 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup/conditionals.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb +12 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup_manager.rb +49 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/recursive_builder_spec.rb +65 -0
- data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/spec_helper.rb +6 -6
- data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +6 -3
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/finances/bb_browser/docker_image.rb +18 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object/template.rb +6 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +11 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/file/rename.rb +28 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/file.rb +11 -8
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb +13 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.source.yaml +28 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.target.yaml +7 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.source.yaml +49 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml +7 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.source.yaml +43 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.target.yaml +7 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.source.yaml +59 -0
- data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml +7 -0
- data/vendor/ehbrs_ruby_utils/spec/rubocop_check_spec.rb +1 -5
- data/vendor/ehbrs_ruby_utils/spec/spec_helper.rb +2 -98
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Dockerfile +44 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Makefile +35 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/README.md +16 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/firefox.service +8 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/startbrowser.sh +9 -0
- metadata +149 -40
- data/lib/ehbrs/runner/cooking_book/build.rb +0 -50
- data/lib/ehbrs/runner/cooking_book.rb +0 -30
- data/lib/ehbrs/runner/finances/bb_browser.rb +0 -35
- data/lib/ehbrs/runner/finances.rb +0 -16
- data/lib/ehbrs/runner/fs/selected.rb +0 -79
- data/lib/ehbrs/runner/fs/used_space.rb +0 -159
- data/lib/ehbrs/runner/fs.rb +0 -16
- data/lib/ehbrs/runner/google/translate.rb +0 -87
- data/lib/ehbrs/runner/google.rb +0 -16
- data/lib/ehbrs/runner/music/selected.rb +0 -26
- data/lib/ehbrs/runner/music.rb +0 -16
- data/lib/ehbrs/runner/self/test.rb +0 -25
- data/lib/ehbrs/runner/self.rb +0 -16
- data/lib/ehbrs/runner/telegram/send_message.rb +0 -29
- data/lib/ehbrs/runner/telegram.rb +0 -26
- data/lib/ehbrs/runner/vg/ips.rb +0 -132
- data/lib/ehbrs/runner/vg/wii.rb +0 -72
- data/lib/ehbrs/runner/vg.rb +0 -16
- data/lib/ehbrs/runner/videos/extract.rb +0 -68
- data/lib/ehbrs/runner/videos/probe.rb +0 -32
- data/lib/ehbrs/runner/videos/series/rename.rb +0 -72
- data/lib/ehbrs/runner/videos/unsupported.rb +0 -59
- data/lib/ehbrs/runner/videos.rb +0 -16
- data/lib/ehbrs/runner/web_utils/videos/download.rb +0 -63
- data/lib/ehbrs/runner/web_utils/videos/upload.rb +0 -75
- data/lib/ehbrs/runner/web_utils.rb +0 -24
- data/lib/ehbrs/runner.rb +0 -19
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb +0 -35
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/stubbed_ssh.rb +0 -44
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/core_ext'
|
4
|
-
require 'ehbrs/cooking_book/build'
|
5
|
-
require 'os'
|
6
|
-
|
7
|
-
module Ehbrs
|
8
|
-
class Runner
|
9
|
-
class CookingBook
|
10
|
-
class Build
|
11
|
-
runner_with :help, :subcommands do
|
12
|
-
desc 'Operações para livros de receitas.'
|
13
|
-
arg_opt '-d', '--target-dir', 'Caminho para o diretório destino da construção.'
|
14
|
-
bool_opt '--open', 'Show the result.'
|
15
|
-
end
|
16
|
-
|
17
|
-
def run
|
18
|
-
start_banner
|
19
|
-
build.run
|
20
|
-
open
|
21
|
-
success 'Done'
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def build_uncached
|
27
|
-
::Ehbrs::CookingBook::Build.new(
|
28
|
-
runner_context.call(:project), target_dir: parsed.target_dir
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
def open
|
33
|
-
return unless parsed.open?
|
34
|
-
|
35
|
-
infom "Opening \"#{open_path}\"..."
|
36
|
-
::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
|
37
|
-
end
|
38
|
-
|
39
|
-
def open_path
|
40
|
-
build.index_page.target_path
|
41
|
-
end
|
42
|
-
|
43
|
-
def start_banner
|
44
|
-
infov 'Project', build.project
|
45
|
-
infov 'Target directory', build.target_dir
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/core_ext'
|
4
|
-
require 'ehbrs/cooking_book/project'
|
5
|
-
|
6
|
-
module Ehbrs
|
7
|
-
class Runner
|
8
|
-
class CookingBook
|
9
|
-
require_sub __FILE__
|
10
|
-
|
11
|
-
DEFAULT_SOURCE_DIR = '.'
|
12
|
-
|
13
|
-
runner_with :help, :subcommands do
|
14
|
-
desc 'Operações para livros de receitas.'
|
15
|
-
arg_opt '-C', '--source-dir', 'Caminho para o diretório do código-fonte.'
|
16
|
-
subcommands
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def source_dir_uncached
|
22
|
-
(parsed.source_dir || DEFAULT_SOURCE_DIR).to_pathname.expand_path
|
23
|
-
end
|
24
|
-
|
25
|
-
def project_uncached
|
26
|
-
::Ehbrs::CookingBook::Project.new(source_dir)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/core_ext'
|
4
|
-
require 'ehbrs/videos/extract/package'
|
5
|
-
require 'eac_docker/images/named'
|
6
|
-
|
7
|
-
module Ehbrs
|
8
|
-
class Runner
|
9
|
-
class Finances
|
10
|
-
class BbBrowser
|
11
|
-
runner_with :help do
|
12
|
-
desc 'Bankline para Banco do Brasil com módulo de segurança.'
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
infov 'Docker run arguments', docker_container.run_command_args
|
17
|
-
infov 'System result', docker_container.run_command.system
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def docker_image_uncached
|
23
|
-
::EacDocker::Images::Named.new('lichti/warsaw-browser')
|
24
|
-
end
|
25
|
-
|
26
|
-
def docker_container_uncached
|
27
|
-
docker_image.container.env('DISPLAY', "unix#{ENV.fetch('DISPLAY')}")
|
28
|
-
.volume(::File.join(ENV['HOME'], 'Downloads'), '/home/bank/Downloads')
|
29
|
-
.volume('/tmp/.X11-unix', '/tmp/.X11-unix').command_arg('bb')
|
30
|
-
.temporary(true).interactive(true).tty(true)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/core_ext'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
class Runner
|
7
|
-
class Finances
|
8
|
-
require_sub __FILE__
|
9
|
-
|
10
|
-
runner_with :help, :subcommands do
|
11
|
-
desc 'Utilidades financeiras.'
|
12
|
-
subcommands
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/envs'
|
4
|
-
require 'eac_ruby_utils/fs/clearable_directory'
|
5
|
-
require 'ehbrs/core_ext'
|
6
|
-
|
7
|
-
module Ehbrs
|
8
|
-
class Runner
|
9
|
-
class Fs
|
10
|
-
class Selected
|
11
|
-
DEFAULT_TRAVERSER_RECURSIVE = true
|
12
|
-
|
13
|
-
enable_jobs_runner
|
14
|
-
runner_with :confirmation, :help, :filesystem_traverser do
|
15
|
-
desc 'Seleciona diretórios.'
|
16
|
-
arg_opt '-b', '--build-dir', 'Constrói diretório alvo.'
|
17
|
-
end
|
18
|
-
|
19
|
-
def run
|
20
|
-
infov 'Recursive', traverser_recursive
|
21
|
-
run_jobs :show, :build
|
22
|
-
end
|
23
|
-
|
24
|
-
protected
|
25
|
-
|
26
|
-
def build_selected_directory(path)
|
27
|
-
path
|
28
|
-
end
|
29
|
-
|
30
|
-
def directory_label(directory)
|
31
|
-
directory.to_s
|
32
|
-
end
|
33
|
-
|
34
|
-
def directory_target_basename(directory)
|
35
|
-
directory.basename.to_path
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def build
|
41
|
-
infom "Building directory \"#{build_dir}\" with selected..."
|
42
|
-
build_dir.clear
|
43
|
-
selected_directories.each do |directory|
|
44
|
-
::EacRubyUtils::Envs.local.command(
|
45
|
-
'ln', '-s', directory.to_path,
|
46
|
-
build_dir.join(directory_target_basename(directory))
|
47
|
-
).system!
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def build_dir_uncached
|
52
|
-
parsed.build_dir.if_present { |v| ::EacRubyUtils::Fs::ClearableDirectory.new(v) }
|
53
|
-
end
|
54
|
-
|
55
|
-
def run_build?
|
56
|
-
build_dir.present? && confirm?('Build?')
|
57
|
-
end
|
58
|
-
|
59
|
-
def selected_directories_uncached
|
60
|
-
infom 'Searching selected directories...'
|
61
|
-
@selected = []
|
62
|
-
run_filesystem_traverser
|
63
|
-
@selected.sort
|
64
|
-
end
|
65
|
-
|
66
|
-
def show
|
67
|
-
infov 'Directories found', selected_directories.count
|
68
|
-
selected_directories.each do |directory|
|
69
|
-
puts directory_label(directory)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def traverser_check_directory(path)
|
74
|
-
@selected << build_selected_directory(path) if path.join('.selected').exist?
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,159 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/core_ext'
|
4
|
-
require 'ehbrs/self/observers/used_space'
|
5
|
-
require 'filesize'
|
6
|
-
|
7
|
-
module Ehbrs
|
8
|
-
class Runner
|
9
|
-
class Fs
|
10
|
-
class UsedSpace
|
11
|
-
runner_with :help do
|
12
|
-
desc 'Verifica e anota alterações de espaço usado de um objeto de sistema de arquivos.'
|
13
|
-
bool_opt '-c', '--check', 'Anota o espaço em disco.'
|
14
|
-
bool_opt '-v', '--verbose', 'Verbose.'
|
15
|
-
pos_arg :paths, repeat: true
|
16
|
-
end
|
17
|
-
|
18
|
-
def run
|
19
|
-
root_banner
|
20
|
-
paths.each(&:run)
|
21
|
-
end
|
22
|
-
|
23
|
-
def check?
|
24
|
-
parsed.check
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def root_banner
|
30
|
-
return unless verbose?
|
31
|
-
|
32
|
-
infov 'Paths', paths.count
|
33
|
-
infov 'Check?', check?
|
34
|
-
infov 'Verbose?', verbose?
|
35
|
-
end
|
36
|
-
|
37
|
-
def path_class
|
38
|
-
verbose? ? PathVerbose : PathUnverbose
|
39
|
-
end
|
40
|
-
|
41
|
-
def paths_uncached
|
42
|
-
parsed.paths.map { |path| path_class.new(self, path) }
|
43
|
-
end
|
44
|
-
|
45
|
-
def verbose?
|
46
|
-
parsed.verbose
|
47
|
-
end
|
48
|
-
|
49
|
-
class PathBase
|
50
|
-
enable_simple_cache
|
51
|
-
enable_speaker
|
52
|
-
common_constructor :runner, :path do
|
53
|
-
self.path = path.to_pathname
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def last_change_time
|
59
|
-
time_label(observer.observer.last_change_time)
|
60
|
-
end
|
61
|
-
|
62
|
-
def last_check
|
63
|
-
time_label(observer.observer.last_check_time)
|
64
|
-
end
|
65
|
-
|
66
|
-
def last_value
|
67
|
-
bytes_label(observer.observer.last_value)
|
68
|
-
end
|
69
|
-
|
70
|
-
def current_value
|
71
|
-
bytes_label(observer.current_value).colorize(
|
72
|
-
observer.changing_value? ? :green : :light_black
|
73
|
-
)
|
74
|
-
end
|
75
|
-
|
76
|
-
def changing_value?
|
77
|
-
changing_label(observer.changing_value?)
|
78
|
-
end
|
79
|
-
|
80
|
-
def observer_uncached
|
81
|
-
::Ehbrs::Self::Observers::UsedSpace.new(path)
|
82
|
-
end
|
83
|
-
|
84
|
-
def changing_label(bool)
|
85
|
-
bool.to_s.colorize(bool ? :green : :light_black)
|
86
|
-
end
|
87
|
-
|
88
|
-
def time_label(time)
|
89
|
-
time.if_present('-', &:to_s)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
class PathVerbose < PathBase
|
94
|
-
def run
|
95
|
-
infom path.to_s
|
96
|
-
::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new(err_line_prefix: ' ')) do
|
97
|
-
banner
|
98
|
-
check
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
private
|
103
|
-
|
104
|
-
def banner
|
105
|
-
{ 'Path' => observer.path,
|
106
|
-
'Persistence path' => observer.persistence_path,
|
107
|
-
'Last check' => last_check,
|
108
|
-
'Last change' => last_change_time,
|
109
|
-
'Last value' => last_value,
|
110
|
-
'Current value' => current_value,
|
111
|
-
'Changing?' => changing_value? }.each do |k, v|
|
112
|
-
infov k, v
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def check
|
117
|
-
return unless runner.check?
|
118
|
-
|
119
|
-
infom 'Checking...'
|
120
|
-
if observer.check_current_value
|
121
|
-
success 'A new value was recorded'
|
122
|
-
else
|
123
|
-
info 'No new value was recorded'
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def bytes_label(number)
|
128
|
-
number.if_present('-') { |v| "#{v} (#{::Filesize.from("#{v} B").pretty})" }
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
class PathUnverbose < PathBase
|
133
|
-
def run
|
134
|
-
self.puts output_line
|
135
|
-
end
|
136
|
-
|
137
|
-
def output_line
|
138
|
-
[path.to_s.cyan, last_change_time, last_value, current_value, check_result]
|
139
|
-
.reject(&:blank?).join('|')
|
140
|
-
end
|
141
|
-
|
142
|
-
def check_result
|
143
|
-
return nil unless runner.check?
|
144
|
-
|
145
|
-
observer.check_current_value ? 'Recorded'.green : 'Unchanged'.light_black
|
146
|
-
end
|
147
|
-
|
148
|
-
def bytes_label(number)
|
149
|
-
number.if_present('-') { |v| ::Filesize.from("#{v} B").pretty }
|
150
|
-
end
|
151
|
-
|
152
|
-
def time_label(time)
|
153
|
-
time.if_present('-') { |t| t.strftime('%d/%m/%y %H:%M') }
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
data/lib/ehbrs/runner/fs.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/core_ext'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
class Runner
|
7
|
-
class Fs
|
8
|
-
require_sub __FILE__
|
9
|
-
|
10
|
-
runner_with :help, :subcommands do
|
11
|
-
desc 'Ferramentas para o sistema de arquivos.'
|
12
|
-
subcommands
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/default_runner'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
require 'ehbrs/google/translate/session'
|
6
|
-
|
7
|
-
module Ehbrs
|
8
|
-
class Runner
|
9
|
-
class Google
|
10
|
-
class Translate
|
11
|
-
runner_with :help do
|
12
|
-
desc 'Traduz um documento com Google Translate.'
|
13
|
-
arg_opt '-o', '--output-file', 'Salva saída em <output-file>.'
|
14
|
-
bool_opt '-w', '--overwrite', 'Permite sobreescrever arquivo de saída.'
|
15
|
-
pos_arg 'source-file'
|
16
|
-
end
|
17
|
-
|
18
|
-
def run
|
19
|
-
start_banner
|
20
|
-
validate
|
21
|
-
if output_to_stdout?
|
22
|
-
out(translated_content)
|
23
|
-
else
|
24
|
-
::File.write(output_file, translated_content)
|
25
|
-
end
|
26
|
-
success 'Concluído'
|
27
|
-
end
|
28
|
-
|
29
|
-
def start_banner
|
30
|
-
infov 'Source file', source_file
|
31
|
-
infov 'Target file', output_file
|
32
|
-
end
|
33
|
-
|
34
|
-
def translated_content_uncached
|
35
|
-
session.translate(source_file)
|
36
|
-
end
|
37
|
-
|
38
|
-
delegate :source_file, to: :parsed
|
39
|
-
|
40
|
-
def output_file
|
41
|
-
parsed.output_file || default_output_file
|
42
|
-
end
|
43
|
-
|
44
|
-
def default_output_file
|
45
|
-
::File.join(
|
46
|
-
::File.dirname(source_file),
|
47
|
-
::File.basename(source_file, '.*') + '_translated.html'
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
def session_uncached
|
52
|
-
::Ehbrs::Google::Translate::Session.new
|
53
|
-
end
|
54
|
-
|
55
|
-
def validate
|
56
|
-
validate_source_file
|
57
|
-
validate_output_file
|
58
|
-
validate_output_content
|
59
|
-
end
|
60
|
-
|
61
|
-
def validate_source_file
|
62
|
-
return if ::File.exist?(source_file)
|
63
|
-
|
64
|
-
fatal_error "Source file \"#{source_file}\" does not exist"
|
65
|
-
end
|
66
|
-
|
67
|
-
def validate_output_file
|
68
|
-
return if output_to_stdout?
|
69
|
-
return unless ::File.exist?(output_file)
|
70
|
-
return if parsed.overwrite?
|
71
|
-
|
72
|
-
fatal_error "Output file \"#{output_file}\" already exists"
|
73
|
-
end
|
74
|
-
|
75
|
-
def validate_output_content
|
76
|
-
return if translated_content.present?
|
77
|
-
|
78
|
-
fatal_error 'Output content is empty'
|
79
|
-
end
|
80
|
-
|
81
|
-
def output_to_stdout?
|
82
|
-
output_file == '-'
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|