Class: LetsencryptWebfaction::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/letsencrypt_webfaction/application.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Application

Returns a new instance of Application.



11
12
13
# File 'lib/letsencrypt_webfaction/application.rb', line 11

def initialize(args)
  @options = LetsencryptWebfaction::ArgsParser.new(args)
end

Instance Method Details

#run!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/letsencrypt_webfaction/application.rb', line 15

def run!
  # Validate that the correct options were passed.
  validate_options!

  # Check credentials
  unless api_credentials.valid?
    $stderr.puts 'WebFaction API username, password, and/or servername are incorrect. Login failed.'
    exit 1
  end

  # Register the private key.
  register_key!

  # Validate the domains.
  return unless validator.validate!

  # Write the obtained certificates.
  certificate_installer.install!
end