Class: DS::CLI

Inherits:
Thor
  • Object
show all
Includes:
ActiveSupport::NumberHelper, Recon
Defined in:
lib/ds/cli.rb

Constant Summary

Constants included from Recon

Recon::ERROR_BLANK_SUBFIELDS, Recon::ERROR_CSV_FILE_NOT_FOUND, Recon::ERROR_MISSING_REQUIRED_COLUMNS, Recon::ERROR_UNBALANCED_SUBFIELDS, Recon::RECON_SETS, Recon::RECON_TYPES, Recon::RECON_TYPES_MAP, Recon::RECON_VALIDATION_SETS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Recon

add_alt_keys, build_alt_key, build_key, csv_files, find_recon_type, find_set, find_set_config, git_repo, load_set, lookup_single, read_csv, validate, validate!, validate_row

Class Method Details

.exit_on_failure? ⇒ Boolean

Needed to return a non-zero exit code on failure. See:

https://github.com/rails/thor/wiki/Making-An-Executable

Returns:

  • (Boolean)


45
46
47
# File 'lib/ds/cli.rb', line 45

def self.exit_on_failure?
  true
end

Instance Method Details

#recon_update(*args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ds/cli.rb', line 27

def recon_update(*args)
  # allow any args so this command can be invoked by any other
  if skip_git? options
    print_message(options, verbose_only: true) { <<~EOF.squish }
      WARNING: SKIP_RECON_UPDATE or 
      --skip-recon-update set; skipping git pull
    EOF
    return
  end
  STDOUT.print "Updating Recon CSVs from #{Settings.recon.git_repo}..."
  Recon::ReconData.update!
  STDOUT.puts "done."
end