Class: SafeCredentialsCLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/safe_credentials/cli.rb

Instance Method Summary collapse

Instance Method Details

#decryptObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/safe_credentials/cli.rb', line 31

def decrypt
  puts  ""
  puts  "  Decrypting file #{options[:from]}"
  print "  Enter your password: "
  password = STDIN.noecho(&:gets)
  puts ''

  config = SafeCredentials::Config.load_encrypted(password, options[:from])

  config.decrypt!(options[:vars])
  config.save(options[:to])

  puts "  Result stored in #{options[:to]}"
  add_to_gitignore(options[:to])
   puts  ""
end

#encryptObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/safe_credentials/cli.rb', line 10

def encrypt

  puts  "  Encrypting file #{options[:from]}"
  print "  Enter your password: "
  password = STDIN.noecho(&:gets)
  puts ''

  config = SafeCredentials::Config.new(options[:from], password)

  config.encrypt!(options[:vars])
  config.save(options[:to])

  puts "  Result stored in #{options[:to]}"
  add_to_gitignore(options[:from])
  puts  ""
end