module ConfEncrypt

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/conf_encrypt.rb, line 5
def self.config
  @config ||= YAML.load_file('.conf_encrypt.yml') rescue {}
end
decrypt() click to toggle source
# File lib/conf_encrypt.rb, line 31
def self.decrypt
  system("openssl aes-256-cbc -d -salt -in #{file_name} -out #{tar_file_name} -k #{password}")
  system("tar -xvf #{tar_file_name}")
  system("rm #{tar_file_name}")
end
encrypt() click to toggle source
# File lib/conf_encrypt.rb, line 25
def self.encrypt
  system("tar cvf #{tar_file_name} #{path}")
  system("openssl aes-256-cbc -salt -in #{tar_file_name} -out #{file_name} -k #{password}")
  system("rm #{tar_file_name}")
end
file_name() click to toggle source
# File lib/conf_encrypt.rb, line 13
def self.file_name
  config[:file_name] || ENV['CONF_ENCRYPT_FILE_NAME']
end
password() click to toggle source
# File lib/conf_encrypt.rb, line 17
def self.password
  config[:password] || ENV['CONF_ENCRYPT_PASSWORD']
end
path() click to toggle source
# File lib/conf_encrypt.rb, line 9
def self.path
  config[:path] || ENV['CONF_ENCRYPT_PATH']
end
tar_file_name() click to toggle source
# File lib/conf_encrypt.rb, line 21
def self.tar_file_name
  'encrypt_tmp.tar'
end