Class: ICSP::Commands::CreateSignature

Inherits:
BaseCommand show all
Defined in:
lib/commands/create_signature.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/create_signature.rb', line 6

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

#executeObject



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

def execute
  input_file = arguments.first
  thumbprint = selected_certificate

  result = ::ICSP::Shell.new("#{cryptcp} -signf -thumbprint '#{thumbprint}' #{input_file}",
                            convert_to_utf8: false, fork: false).execute
  exit(result.exit_code) unless result.ok

  puts result
end

#selected_certificateObject



21
22
23
# File 'lib/commands/create_signature.rb', line 21

def selected_certificate
  ::ICSP::Commands::Certificate::List.new(config: config, options: options, arguments: arguments).select
end