Module: NmDatafile

Extended by:
Crypto, DataLoading, FileEncoding
Defined in:
lib/nm_datafile/schema.rb,
lib/nm_datafile.rb,
lib/nm_datafile/debug.rb,
lib/nm_datafile/crypto.rb,
lib/nm_datafile/version.rb,
lib/nm_datafile/blowfish.rb,
lib/nm_datafile/nm_datafile.rb,
lib/nm_datafile/data_loading.rb,
lib/nm_datafile/file_encoding.rb

Overview

A default schema is defined here… this needs to be converted into something more generic

Defined Under Namespace

Modules: Blowfish, Crypto, DataLoading, Debug, FileEncoding Classes: NmDatafile

Constant Summary collapse

SCHEMA =
{ schemas: 
  { :shippable_file => {
    data_collections: [:sales, :line_items, :discounts, :addresses, :ubws, :encryption_pairs], # name the data that is input into the NMDatafile as an array
    data_objects: [:ready_for_shipment_batch]
    },
  
  :address_completion_file => {
    data_collections: [:sales, :erroneous_sales],
    data_objects: [:ready_for_shipment_batch]
    }
  }
}
VERSION =
"0.1.0"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DataLoading

Load, determine_file_type, determine_password, extract_entities_from_binary_data, load_binary_data

Methods included from Crypto

clean_decrypt_string, clean_encrypt_string, convert_newline_chars_back_to_symbols, decode_password_protected_string, decode_protected_7z, decode_protected_zip_old_zip_based, decode_string_as_password_protected, decode_string_into_NMDatafile_stores, decrypt_encryptable_data!, encrypt_using_gpg, fast_decrypt_string_with_pass, fast_encrypt_string_with_pass, obfuscated_ending, obfuscated_ending_undo, rearrangement, rearrangement_undo, symbolize_keys, the_first_three_chars, the_last_three_chars, the_string_minus_the_first_three_chars, the_string_minus_the_last_three_chars

Methods included from FileEncoding

deobfuscate_file_format, encode_datafiles_as_zip, encode_string_as_password_protected, encode_string_as_password_protected_old_zip_based, obfuscate_file_format

Class Method Details

.new(config, *args) ⇒ Object

config = file_type, symmetric_key: symmetric_key



19
20
21
# File 'lib/nm_datafile.rb', line 19

def self.new(config, *args)
  NmDatafile.new(config, *args)
end

Instance Method Details

#passfunc(hook, uid_hint, passphrase_info, prev_was_bad, fd) ⇒ Object

This hack is for… some tricky bullshit, I forgot about



324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/nm_datafile/nm_datafile.rb', line 324

def passfunc(hook, uid_hint, passphrase_info, prev_was_bad, fd)
  $stderr.write("Passphrase for #{uid_hint}: ")
  $stderr.flush
  begin
    system('stty -echo')
    io = IO.for_fd(fd, 'w')
    io.puts(gets)
    io.flush
  ensure
    (0 ... $_.length).each do |i| $_[i] = ?0 end if $_
    system('stty echo')
  end
  $stderr.puts
end