Module: NmDatafile

Extended by:
Crypto, DataLoading
Defined in:
lib/nm_datafile/schema.rb,
lib/nm_datafile.rb,
lib/nm_datafile/b_f.rb,
lib/nm_datafile/debug.rb,
lib/nm_datafile/crypto.rb,
lib/nm_datafile/version.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: Crypto, DataLoading, Debug, FileEncoding Classes: BF, NmDatafile

Constant Summary collapse

FRONT_DOOR_KEY =

Write to NmDatafile::FRONT_DOOR_KEY to set a symetric key

"$FrontDoorKey"
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.0.2"
@@symmetric_key =
"$FrontDoorKey"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DataLoading

Load, LoadBinaryData, determine_file_type, determine_password, extract_entities_from_binary_data

Methods included from Crypto

clean_decrypt_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

Class Method Details

.new(file_type, *args) ⇒ Object



25
26
27
# File 'lib/nm_datafile.rb', line 25

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

.set_symmetric_key(val) ⇒ Object



29
30
31
# File 'lib/nm_datafile.rb', line 29

def self.set_symmetric_key(val)
  
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



319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/nm_datafile/nm_datafile.rb', line 319

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