module Balmora::Extension::FileSecret

Public Instance Methods

_copy_file() click to toggle source
# File lib/balmora/extension/file_secret.rb, line 7
def _copy_file()
  if @action == 'pull'
    @shell.run!(_source_contents() + [_expr('|'), *@shell.sudo(), 'tee',
      _target_path()], change: true)
  else
    @shell.run!(['cat', _source_path(), _expr('|'), *_encrypt(), _expr('|'),
      *@shell.sudo(), 'tee', _target_path()], change: true)
  end
end
_decrypt() click to toggle source
# File lib/balmora/extension/file_secret.rb, line 37
def _decrypt()
  return ['openssl', 'enc', '-aes-256-cbc', '-d', '-pass', option(:password)]
end
_encrypt() click to toggle source
# File lib/balmora/extension/file_secret.rb, line 41
def _encrypt()
  return ['openssl', 'enc', '-aes-256-cbc', '-e', '-pass', option(:password)]
end
_source_contents() click to toggle source
Calls superclass method
# File lib/balmora/extension/file_secret.rb, line 17
def _source_contents()
  command = super()

  if @action == 'pull'
    command += [_expr('|')] + _decrypt()
  end

  return command
end
_target_contents() click to toggle source
Calls superclass method
# File lib/balmora/extension/file_secret.rb, line 27
def _target_contents()
  command = super()

  if @action == 'push'
    command += [_expr('|')] + _decrypt()
  end

  return command
end
options() click to toggle source
Calls superclass method
# File lib/balmora/extension/file_secret.rb, line 3
def options()
  return super() + [:password]
end