Class: Sped2DB::CLI

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/sped2db/cli.rb

Constant Summary collapse

DEFAULT_CONFIG_FILE =
'sped2db.yml'.freeze
CONFIG_NOT_PROVIDED =
'Arquivo de configuração não encontrado
e opção -c não especificada'.freeze
CONFIG_INVALID =
'Arquivo de configuração ou URI inválido(a)'.freeze
SPED_PATH_INVALID =
'Caminho de arquivo(s) SPED inválido'.freeze
SPED_FILES_NOT_FOUND =
'O caminho especificado não é ou não contém arquivo(s) SPED'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#count_lines, #date_string?, #get_first_line, #get_first_line_fields, #get_layout, #sped_file?

Constructor Details

#initialize(io = $stdout, extractor = nil, db_tools = nil) ⇒ CLI

Returns a new instance of CLI.



14
15
16
17
18
19
# File 'lib/sped2db/cli.rb', line 14

def initialize(io = $stdout, extractor = nil, db_tools = nil)
  @io = io
  @extractor = extractor
  @db_tools = db_tools
  @exe = 'sped2db'
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



12
13
14
# File 'lib/sped2db/cli.rb', line 12

def opts
  @opts
end

Instance Method Details

#run(args) ⇒ Object



21
22
23
24
25
26
# File 'lib/sped2db/cli.rb', line 21

def run(args)
  @args = args
  @opts = parse_args(args)

  process_opts
end