Sha256: 5f220ae09eba21cada8e5b856486c3f79fd72c29798bc0f09d0717f357a99996

Contents?: true

Size: 792 Bytes

Versions: 7

Compression:

Stored size: 792 Bytes

Contents

module Roro
  module Crypto
    class Obfuscator
      include FileReflection
      def initialize
        @writer = FileWriter.new
        @cipher = Cipher.new
        @mise   = Roro::CLI.mise
      end

      def obfuscate_file(file, key)
        encrypted_content = @cipher.encrypt(File.read(file), key)
        @writer.write_to_file(file + '.enc', encrypted_content)
      end

      def obfuscate(environments = [], directory = @mise, extension = '.env')
        environments = gather_environments(directory, extension) if environments.empty?
        environments.each do |environment|
          obfuscatable = source_files(directory, "#{environment}*#{extension}")
          obfuscatable.each { |file| obfuscate_file(file, get_key(environment))}
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
roro-0.3.33 lib/roro/crypto/obfuscator.rb
roro-0.3.30 lib/roro/crypto/obfuscator.rb
roro-0.3.28 lib/roro/crypto/obfuscator.rb
roro-0.3.27 lib/roro/crypto/obfuscator.rb
roro-0.3.25 lib/roro/crypto/obfuscator.rb
roro-0.3.24 lib/roro/crypto/obfuscator.rb
roro-0.3.23 lib/roro/crypto/obfuscator.rb