Class: Avmtrf1::Tools::Runner::Red
- Inherits:
-
EacRubyUtils::Console::DocoptRunner
- Object
- EacRubyUtils::Console::DocoptRunner
- Avmtrf1::Tools::Runner::Red
- Includes:
- EacRubyUtils::Console::Speaker, EacRubyUtils::SimpleCache
- Defined in:
- lib/avmtrf1/tools/runner/red.rb
Constant Summary collapse
- DOC =
<<~DOCOPT Utilidades para RED. Usage: __PROGRAM__ [options] [-i <red-ini-path>] file put <file> __PROGRAM__ -h | --help Options: -h --help Mostra esta ajuda. -i --red-ini=<red-ini-path> Arquivo red.ini com parâmetros de conexão e upload. -p --red-profile=<red-profile> Perfil/seção do red.ini [default: development]. DOCOPT
Instance Method Summary collapse
- #file ⇒ Object
- #file_put ⇒ Object
- #red_ini_path_uncached ⇒ Object
- #red_ini_profile ⇒ Object
- #red_ini_uncached ⇒ Object
- #red_profile_name ⇒ Object
- #red_profile_uncached ⇒ Object
- #required_file(option_key) ⇒ Object
- #run ⇒ Object
- #start_banner ⇒ Object
Instance Method Details
#file ⇒ Object
60 61 62 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 60 def file required_file('<file>') end |
#file_put ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 44 def file_put result = red_profile.put_file(file) require 'pp' puts '>' * 20 puts result puts '<' * 20 end |
#red_ini_path_uncached ⇒ Object
64 65 66 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 64 def red_ini_path_uncached required_file('--red-ini') end |
#red_ini_profile ⇒ Object
72 73 74 75 76 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 72 def red_ini_profile return red_ini.profiles[red_profile_name] if red_ini.profiles.key?(red_profile_name) fatal_error "Perfil/seção \"#{red_profile_name}\" não encontrada em \"#{red_ini_path}\"" end |
#red_ini_uncached ⇒ Object
68 69 70 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 68 def red_ini_uncached ::Avmtrf1::Ini.new(red_ini_path) end |
#red_profile_name ⇒ Object
52 53 54 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 52 def red_profile_name .fetch('--red-profile') end |
#red_profile_uncached ⇒ Object
56 57 58 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 56 def red_profile_uncached ::Avmtrf1::Red::Profile.by_ini_profile(red_ini_profile) end |
#required_file(option_key) ⇒ Object
78 79 80 81 82 83 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 78 def required_file(option_key) path = .fetch(option_key) return path if path fatal_error("Arquivo \"#{path}\" não existe (Informado na opção #{option_key})") end |
#run ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 29 def run if .fetch('file') && .fetch('put') file_put else fatal_error('Subcomando não mapeado (Isto é um defeito do software)') end end |
#start_banner ⇒ Object
38 39 40 41 42 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 38 def infov 'red.ini', .fetch('--red-ini') infov 'Perfil de red.ini', red_profile_name infov 'Arquivo para upload', .fetch('<file>') end |