Class: Avmtrf1::Tools::Runner::Red
- Inherits:
-
Object
- Object
- Avmtrf1::Tools::Runner::Red
- Defined in:
- lib/avmtrf1/tools/runner/red.rb
Constant Summary collapse
- RED_PROFILE_DEFAULT =
'development'
Instance Method Summary collapse
- #file ⇒ Object
- #file_put ⇒ Object
- #put? ⇒ Boolean
- #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
56 57 58 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 56 def file required_file(:put) end |
#file_put ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 40 def file_put result = red_profile.put_file(file) require 'pp' # rubocop:disable Lint/RedundantRequireStatement puts '>' * 20 puts result puts '<' * 20 end |
#put? ⇒ Boolean
21 22 23 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 21 def put? parsed.put.present? end |
#red_ini_path_uncached ⇒ Object
60 61 62 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 60 def red_ini_path_uncached required_file(:red_ini) end |
#red_ini_profile ⇒ Object
68 69 70 71 72 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 68 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
64 65 66 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 64 def red_ini_uncached ::Avmtrf1::Ini.new(red_ini_path) end |
#red_profile_name ⇒ Object
48 49 50 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 48 def red_profile_name parsed.red_profile.if_present(RED_PROFILE_DEFAULT) end |
#red_profile_uncached ⇒ Object
52 53 54 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 52 def red_profile_uncached ::Avmtrf1::Red::Profile.by_ini_profile(red_ini_profile) end |
#required_file(option_key) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 74 def required_file(option_key) path = parsed[option_key] return path if path fatal_error("Arquivo \"#{path}\" não existe (Informado na opção #{option_key})") end |
#run ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 25 def run if put? file_put else fatal_error('Subcomando não mapeado (Isto é um defeito do software)') end end |
#start_banner ⇒ Object
34 35 36 37 38 |
# File 'lib/avmtrf1/tools/runner/red.rb', line 34 def infov 'red.ini', parsed.red_ini infov 'Perfil de red.ini', red_profile_name infov 'Arquivo para upload', parsed.put end |