Module: ICSP

Defined in:
lib/csp.rb,
lib/shell.rb,
lib/csp/version.rb,
lib/shell_result.rb,
lib/csp_option_parser.rb,
lib/commands/create_hash.rb,
lib/commands/license/set.rb,
lib/commands/verify_hash.rb,
lib/commands/base_command.rb,
lib/commands/decrypt_file.rb,
lib/commands/encrypt_file.rb,
lib/commands/license/view.rb,
lib/commands/hardware/list.rb,
lib/commands/container/copy.rb,
lib/commands/container/list.rb,
lib/commands/container/view.rb,
lib/commands/container/check.rb,
lib/commands/certificate/list.rb,
lib/commands/certificate/view.rb,
lib/commands/container/delete.rb,
lib/commands/create_signature.rb,
lib/commands/verify_signature.rb,
lib/commands/certificate/delete.rb,
lib/commands/certificate/install.rb,
lib/commands/container/change_pin_code.rb,
lib/commands/container/forget_all_pin_codes.rb

Overview

CryptoPro CSP

Defined Under Namespace

Modules: Commands, Services Classes: Shell, ShellResult

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.runObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/csp.rb', line 41

def self.run
  parsed = ::ICSP::Services::OptionParserService.new.parse
  command_parts = %w[::ICSP Commands]
  command_parts << to_camel_case(parsed.command) if parsed.command
  command_parts << to_camel_case(parsed.subcommand) if parsed.subcommand
  command = Object.const_get(command_parts.join('::'))
                  .new(config: config, options: parsed.options, arguments: parsed.arguments)
  command.respond_to?(:print) ? command.print : command.execute
rescue StandardError => e
  puts 'Application aborted with error:'
  raise e
end

.to_camel_case(string) ⇒ Object



37
38
39
# File 'lib/csp.rb', line 37

def self.to_camel_case(string)
  string.to_s.split('_').map(&:capitalize).join
end