Class: EasyCaddy::Commands::Retrust

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_caddy/commands/retrust.rb

Instance Method Summary collapse

Instance Method Details

#callObject

Raises:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/easy_caddy/commands/retrust.rb', line 9

def call
  raise Error, 'Caddy is not running. Start it with: brew services start caddy' unless Caddy.running?

  puts '  Removing local CA from trust store...'
  puts '    (you may be prompted for your password)'
  output, success = Caddy.untrust_with_output
  raise Error, "caddy untrust failed:\n#{output}" unless success

  puts '  Re-trusting local CA...'
  puts '    (you may be prompted for your password)'
  output, success = Caddy.trust_with_output
  raise Error, "caddy trust failed:\n#{output}" unless success

  puts '  Done. Reload your browser — the certificate is now trusted.'
end