ehbrs-tools 0.9.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ehbrs/gems.rb +37 -0
- data/lib/ehbrs/google.rb +9 -0
- data/lib/ehbrs/google/translate.rb +11 -0
- data/lib/ehbrs/google/translate/session.rb +61 -0
- data/lib/ehbrs/runner.rb +9 -13
- data/lib/ehbrs/runner/finances.rb +19 -0
- data/lib/ehbrs/runner/finances/bb_browser.rb +40 -0
- data/lib/ehbrs/runner/fs/used_space.rb +4 -4
- data/lib/ehbrs/runner/google.rb +19 -0
- data/lib/ehbrs/runner/google/translate.rb +92 -0
- data/lib/ehbrs/runner/self.rb +19 -0
- data/lib/ehbrs/runner/self/test.rb +30 -0
- data/lib/ehbrs/runner/videos/series.rb +21 -0
- data/lib/ehbrs/runner/videos/series/rename.rb +75 -0
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/videos/series.rb +11 -0
- data/lib/ehbrs/videos/series/rename.rb +13 -0
- data/lib/ehbrs/videos/series/rename/directory_group.rb +28 -0
- data/lib/ehbrs/videos/series/rename/file.rb +114 -0
- data/lib/ehbrs/videos/series/rename/file/basename_parser.rb +44 -0
- data/lib/ehbrs/videos/series/rename/file/options.rb +30 -0
- data/lib/ehbrs/videos/series/rename/line_result.rb +26 -0
- data/lib/ehbrs/videos/series/rename/line_result_group.rb +39 -0
- data/lib/ehbrs/videos/series/rename/results_builder.rb +32 -0
- data/lib/ehbrs/videos/series/rename/season_group.rb +39 -0
- data/vendor/aranha-selenium/Gemfile +5 -0
- data/vendor/aranha-selenium/aranha-selenium.gemspec +19 -0
- data/vendor/aranha-selenium/lib/aranha/selenium.rb +8 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory.rb +47 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/base.rb +76 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/chrome.rb +28 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/firefox.rb +54 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/firefox_auto_download_mime_types +685 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/session.rb +78 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +7 -0
- data/vendor/aranha-selenium/spec/rubocop_check_spec.rb +7 -0
- data/vendor/aranha-selenium/spec/spec_helper.rb +100 -0
- data/vendor/eac_cli/eac_cli.gemspec +3 -3
- data/vendor/eac_cli/lib/eac_cli/definition.rb +72 -0
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/{runner → definition}/base_option.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/{runner → definition}/positional_argument.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/{runner/docopt_doc.rb → docopt/doc_builder.rb} +15 -8
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +51 -0
- data/vendor/eac_cli/lib/eac_cli/parser.rb +14 -0
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +56 -0
- data/vendor/eac_cli/lib/eac_cli/parser/error.rb +15 -0
- data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +105 -0
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +21 -0
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +49 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +25 -5
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +18 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +70 -0
- data/vendor/eac_docker/Gemfile +5 -0
- data/vendor/eac_docker/eac_docker.gemspec +18 -0
- data/vendor/eac_docker/lib/eac_docker.rb +7 -0
- data/vendor/eac_docker/lib/eac_docker/container.rb +50 -0
- data/vendor/eac_docker/lib/eac_docker/executables.rb +18 -0
- data/vendor/eac_docker/lib/eac_docker/images.rb +9 -0
- data/vendor/eac_docker/lib/eac_docker/images/base.rb +14 -0
- data/vendor/eac_docker/lib/eac_docker/images/named.rb +30 -0
- data/vendor/eac_docker/lib/eac_docker/rspec.rb +17 -0
- data/vendor/eac_docker/lib/eac_docker/version.rb +5 -0
- data/vendor/eac_docker/spec/lib/eac_docker/executables_spec.rb +9 -0
- data/vendor/eac_docker/spec/rubocop_spec.rb +7 -0
- data/vendor/eac_docker/spec/spec_helper.rb +103 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb +31 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +68 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs.rb +4 -12
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +6 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +3 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +8 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +1 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +8 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env.rb +12 -9
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/dasho_options.rb +53 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/identity_file.rb +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/quiet.rb +24 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb +34 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/extname.rb +30 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +1 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable.rb +15 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/array_accessor.rb +32 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/base_accessor.rb +23 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/boolean_accessor.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/class_methods.rb +20 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/common_accessor.rb +30 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/hash_accessor.rb +46 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/instance_methods.rb +21 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +18 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/lists.rb +10 -12
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/symbol_list.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb +2 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_present.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_respond.rb +22 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +1 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +72 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +47 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/directory.rb +7 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/file.rb +8 -59
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_not_found_error.rb +7 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers.rb +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/base.rb +23 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/entries_reader.rb +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/generic.rb +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/hash.rb +29 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +85 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +42 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +1 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/docopt_runner_spec.rb +5 -5
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/speaker_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb +4 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/extname_spec.rb +18 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp/temp_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +15 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +32 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/sym_keys_hash_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_sub_spec.rb +4 -4
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec.rb +19 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec/stubbed_module_a.rb +6 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec/stubbed_not_module.rb +6 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby_spec.rb +22 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +46 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec.rb +1 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/yaml_spec.rb +75 -0
- data/vendor/eac_ruby_utils/spec/locales/pt-BR.yml +17 -0
- metadata +103 -10
- data/vendor/eac_cli/lib/eac_cli/runner/argument_option.rb +0 -13
- data/vendor/eac_cli/lib/eac_cli/runner/boolean_option.rb +0 -13
- data/vendor/eac_cli/lib/eac_cli/runner/definition.rb +0 -64
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9692fcad0f7b1e05f59f98e17e1d1e5042efa22f1bd1e8ada8a2b5b2d4909e66
|
|
4
|
+
data.tar.gz: 606f3be03e5b0f54564aaa78b466e89ed498cf4a7d316e187cb6432b34cd46f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fc3d4a8dc042274ca49de459c5a18d8179cd0b2f1846016c9fcff06d909b5583aa282e645205bc502698b447ae2a8aab3bf53bfc9646e71eea23a9949c5b272
|
|
7
|
+
data.tar.gz: 48d655fe4a28192181f2e40d3f2f9041d7c3f4a41a80168446ee15ec176d54c2f5c0c4428d41fc0a5c3248f5dc3471b408c8f8d58b7ffecd5131d9040e7ef0ce
|
data/lib/ehbrs/gems.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_ruby_gems_utils/gem'
|
|
4
|
+
|
|
5
|
+
module Ehbrs
|
|
6
|
+
module Gems
|
|
7
|
+
class << self
|
|
8
|
+
enable_simple_cache
|
|
9
|
+
|
|
10
|
+
def app_path
|
|
11
|
+
::Pathname.new('../..').expand_path(__dir__)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def vendor_gems_root
|
|
15
|
+
app_path.join('vendor')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def app_uncached
|
|
21
|
+
::EacRubyGemsUtils::Gem.new(app_path)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def all_uncached
|
|
25
|
+
vendor_gems + [app]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def vendor_gems_uncached
|
|
29
|
+
r = []
|
|
30
|
+
vendor_gems_root.each_child.each do |child|
|
|
31
|
+
r << ::EacRubyGemsUtils::Gem.new(child) if child.directory?
|
|
32
|
+
end
|
|
33
|
+
r
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/ehbrs/google.rb
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'aranha/selenium/session'
|
|
4
|
+
|
|
5
|
+
module Ehbrs
|
|
6
|
+
module Google
|
|
7
|
+
module Translate
|
|
8
|
+
class Session
|
|
9
|
+
START_URL = 'https://translate.google.com.br/#view=home&op=docs&sl=en&tl=pt'
|
|
10
|
+
CLOSE_POPUP_CSS = '.dismiss-button'
|
|
11
|
+
FILE_INPUT_XPATH = '//*[@id = "tlid-file-input"]'
|
|
12
|
+
SUBMIT_XPATH = '//form[@action="//translate.googleusercontent.com/translate_f"]' \
|
|
13
|
+
'//input[@type="submit"]'
|
|
14
|
+
RESULT_XPATHS = [
|
|
15
|
+
'//script[contains(@src, "https://translate.google.com/translate_a")]',
|
|
16
|
+
'/html/body/pre'
|
|
17
|
+
].freeze
|
|
18
|
+
|
|
19
|
+
attr_reader :sub
|
|
20
|
+
|
|
21
|
+
def initialize
|
|
22
|
+
@sub = ::Aranha::Selenium::Session.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def translate(source_document_path)
|
|
26
|
+
go_to_upload_form
|
|
27
|
+
input_file(source_document_path)
|
|
28
|
+
close_changes_alert_popup
|
|
29
|
+
click_on_translate_button
|
|
30
|
+
wait_for_load_translation
|
|
31
|
+
sub.current_source
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def go_to_upload_form
|
|
37
|
+
sub.navigate.to START_URL
|
|
38
|
+
sub.wait_for_element(xpath: FILE_INPUT_XPATH)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def input_file(source_document_path)
|
|
42
|
+
sub.find_element(xpath: FILE_INPUT_XPATH).send_keys(source_document_path)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def click_on_translate_button
|
|
46
|
+
sub.wait_for_click(xpath: SUBMIT_XPATH)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def close_changes_alert_popup
|
|
50
|
+
sub.wait_for_click(css: CLOSE_POPUP_CSS)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def wait_for_load_translation
|
|
54
|
+
sub.wait.until do
|
|
55
|
+
RESULT_XPATHS.any? { |xpath| sub.find_elements(xpath: xpath).size.positive? }
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/ehbrs/runner.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
|
4
5
|
require 'eac_ruby_utils/console/docopt_runner'
|
|
5
6
|
require 'ehbrs/tools/version'
|
|
@@ -7,20 +8,15 @@ require 'ehbrs/tools/version'
|
|
|
7
8
|
module Ehbrs
|
|
8
9
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
9
10
|
require_sub __FILE__
|
|
10
|
-
|
|
11
|
+
include ::EacCli::DefaultRunner
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
Tools for EHB/RS.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Options:
|
|
21
|
-
-h --help Show this screen.
|
|
22
|
-
-V --version Show version.
|
|
23
|
-
DOCOPT
|
|
13
|
+
runner_definition do
|
|
14
|
+
desc 'Tools for EHB/RS.'
|
|
15
|
+
subcommands
|
|
16
|
+
alt do
|
|
17
|
+
bool_opt '-V', '--version', 'Show version.'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
24
20
|
|
|
25
21
|
def run
|
|
26
22
|
if options.fetch('--version')
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
6
|
+
|
|
7
|
+
module Ehbrs
|
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
9
|
+
class Finances < ::EacRubyUtils::Console::DocoptRunner
|
|
10
|
+
include ::EacCli::DefaultRunner
|
|
11
|
+
require_sub __FILE__
|
|
12
|
+
|
|
13
|
+
runner_definition do
|
|
14
|
+
desc 'Utilidades financeiras.'
|
|
15
|
+
subcommands
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
6
|
+
require 'ehbrs/videos/extract/package'
|
|
7
|
+
require 'eac_docker/images/named'
|
|
8
|
+
|
|
9
|
+
module Ehbrs
|
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
11
|
+
class Finances < ::EacRubyUtils::Console::DocoptRunner
|
|
12
|
+
class BbBrowser < ::EacRubyUtils::Console::DocoptRunner
|
|
13
|
+
include ::EacCli::DefaultRunner
|
|
14
|
+
require_sub __FILE__
|
|
15
|
+
|
|
16
|
+
runner_definition do
|
|
17
|
+
desc 'Bankline para Banco do Brasil com módulo de segurança.'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def run
|
|
21
|
+
infov 'Docker run arguments', docker_container.run_command_args
|
|
22
|
+
infov 'System result', docker_container.run_command.system
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def docker_image_uncached
|
|
28
|
+
::EacDocker::Images::Named.new('lichti/warsaw-browser')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def docker_container_uncached
|
|
32
|
+
docker_image.container.env('DISPLAY', "unix#{ENV.fetch('DISPLAY')}")
|
|
33
|
+
.volume(::File.join(ENV['HOME'], 'Downloads'), '/home/bank/Downloads')
|
|
34
|
+
.volume('/tmp/.X11-unix', '/tmp/.X11-unix').command_arg('bb')
|
|
35
|
+
.temporary(true).interactive(true).tty(true)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -6,7 +6,7 @@ require 'filesize'
|
|
|
6
6
|
module Ehbrs
|
|
7
7
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
8
8
|
class Fs < ::EacRubyUtils::Console::DocoptRunner
|
|
9
|
-
class UsedSpace
|
|
9
|
+
class UsedSpace
|
|
10
10
|
include ::EacCli::DefaultRunner
|
|
11
11
|
|
|
12
12
|
runner_definition do
|
|
@@ -22,7 +22,7 @@ module Ehbrs
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def check?
|
|
25
|
-
|
|
25
|
+
parsed.check
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
private
|
|
@@ -40,11 +40,11 @@ module Ehbrs
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def paths_uncached
|
|
43
|
-
|
|
43
|
+
parsed.paths.map { |path| path_class.new(self, path) }
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def verbose?
|
|
47
|
-
|
|
47
|
+
parsed.verbose
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
class PathBase
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
6
|
+
|
|
7
|
+
module Ehbrs
|
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
9
|
+
class Google < ::EacRubyUtils::Console::DocoptRunner
|
|
10
|
+
require_sub __FILE__
|
|
11
|
+
include ::EacCli::DefaultRunner
|
|
12
|
+
|
|
13
|
+
runner_definition do
|
|
14
|
+
desc 'Utilidades Google.'
|
|
15
|
+
subcommands
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
6
|
+
require 'ehbrs/google/translate/session'
|
|
7
|
+
|
|
8
|
+
module Ehbrs
|
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
10
|
+
class Google < ::EacRubyUtils::Console::DocoptRunner
|
|
11
|
+
class Translate < ::EacRubyUtils::Console::DocoptRunner
|
|
12
|
+
include ::EacCli::DefaultRunner
|
|
13
|
+
|
|
14
|
+
runner_definition do
|
|
15
|
+
desc 'Traduz um documento com Google Translate.'
|
|
16
|
+
arg_opt '-o', '--output-file', 'Salva saída em <output-file>.'
|
|
17
|
+
bool_opt '-w', '--overwrite', 'Permite sobreescrever arquivo de saída.'
|
|
18
|
+
pos_arg 'source-file'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
start_banner
|
|
23
|
+
validate
|
|
24
|
+
if output_to_stdout?
|
|
25
|
+
out(translated_content)
|
|
26
|
+
else
|
|
27
|
+
::File.write(output_file, translated_content)
|
|
28
|
+
end
|
|
29
|
+
success 'Concluído'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def start_banner
|
|
33
|
+
infov 'Source file', source_file
|
|
34
|
+
infov 'Target file', output_file
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def translated_content_uncached
|
|
38
|
+
session.translate(source_file)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def source_file
|
|
42
|
+
options.fetch('<source-file>')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def output_file
|
|
46
|
+
options.fetch('--output-file') || default_output_file
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def default_output_file
|
|
50
|
+
::File.join(
|
|
51
|
+
::File.dirname(source_file),
|
|
52
|
+
::File.basename(source_file, '.*') + '_translated.html'
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def session_uncached
|
|
57
|
+
::Ehbrs::Google::Translate::Session.new
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def validate
|
|
61
|
+
validate_source_file
|
|
62
|
+
validate_output_file
|
|
63
|
+
validate_output_content
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def validate_source_file
|
|
67
|
+
return if ::File.exist?(source_file)
|
|
68
|
+
|
|
69
|
+
fatal_error "Source file \"#{source_file}\" does not exist"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def validate_output_file
|
|
73
|
+
return if output_to_stdout?
|
|
74
|
+
return unless ::File.exist?(output_file)
|
|
75
|
+
return if options.fetch('--overwrite')
|
|
76
|
+
|
|
77
|
+
fatal_error "Output file \"#{output_file}\" already exists"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def validate_output_content
|
|
81
|
+
return if translated_content.present?
|
|
82
|
+
|
|
83
|
+
fatal_error 'Output content is empty'
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def output_to_stdout?
|
|
87
|
+
output_file == '-'
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
6
|
+
|
|
7
|
+
module Ehbrs
|
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
9
|
+
class Self < ::EacRubyUtils::Console::DocoptRunner
|
|
10
|
+
require_sub __FILE__
|
|
11
|
+
include ::EacCli::DefaultRunner
|
|
12
|
+
|
|
13
|
+
runner_definition do
|
|
14
|
+
desc 'Self utilities'
|
|
15
|
+
subcommands
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
4
|
+
require 'ehbrs/gems'
|
|
5
|
+
require 'eac_ruby_gems_utils/tests/multiple'
|
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
|
7
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
8
|
+
|
|
9
|
+
module Ehbrs
|
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
11
|
+
class Self < ::EacRubyUtils::Console::DocoptRunner
|
|
12
|
+
class Test < ::EacRubyUtils::Console::DocoptRunner
|
|
13
|
+
require_sub __FILE__
|
|
14
|
+
include ::EacCli::DefaultRunner
|
|
15
|
+
|
|
16
|
+
runner_definition do
|
|
17
|
+
desc 'Test core and local gems.'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def run
|
|
21
|
+
fatal_error 'Some test did not pass' unless tests.ok?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def tests_uncached
|
|
25
|
+
::EacRubyGemsUtils::Tests::Multiple.new(::Ehbrs::Gems.all)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/default_runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
6
|
+
|
|
7
|
+
module Ehbrs
|
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
9
|
+
class Videos < ::EacRubyUtils::Console::DocoptRunner
|
|
10
|
+
class Series < ::EacRubyUtils::Console::DocoptRunner
|
|
11
|
+
include ::EacCli::DefaultRunner
|
|
12
|
+
require_sub __FILE__
|
|
13
|
+
|
|
14
|
+
runner_definition do
|
|
15
|
+
desc 'Ferramentas para seriados.'
|
|
16
|
+
subcommands
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|