Class: ICSP::Commands::EncryptFile

Inherits:
BaseCommand show all
Defined in:
lib/commands/encrypt_file.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#arguments, #config, #options, #prompt

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from ICSP::Commands::BaseCommand

Instance Method Details

#cryptcpObject



6
7
8
# File 'lib/commands/encrypt_file.rb', line 6

def cryptcp
  @cryptcp ||= @config.cryptcp
end

#executeObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/commands/encrypt_file.rb', line 10

def execute
  input_file = arguments.first
  output_file = arguments.last
  result = ::ICSP::Shell.new(
    "#{cryptcp} -encr -thumbprint '#{options[:certificate_file]}' #{input_file} #{output_file}", convert_to_utf8: false
  ).execute
  exit(result.exit_code) unless result.ok

  puts result
end