Class: Rultor::Encrypt
- Inherits:
-
Object
- Object
- Rultor::Encrypt
- Defined in:
- lib/rultor/encrypt.rb
Overview
Encrypting command
Instance Method Summary collapse
-
#initialize(name, file) ⇒ Encrypt
constructor
A new instance of Encrypt.
- #run ⇒ Object
Constructor Details
#initialize(name, file) ⇒ Encrypt
Returns a new instance of Encrypt.
41 42 43 44 45 |
# File 'lib/rultor/encrypt.rb', line 41 def initialize(name, file) @key = 'rultor-key:' + name @dir = File.dirname(file) @file = File.basename(file) end |
Instance Method Details
#run ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rultor/encrypt.rb', line 47 def run source = File.join(@dir, @file) target = File.join(@dir, @file + '.asc') if Gem.win_platform? windows(source, target) else unix(source, target) end fail 'PGP encryption failed' unless $CHILD_STATUS.exitstatus == 0 Rultor.log.info "#{@file} encrypted into #{target}" \ " (#{File.size(target)} bytes)" end |