Class: DoSnapshot::CLI
- Inherits:
-
Thor
- Object
- Thor
- DoSnapshot::CLI
- Includes:
- Helpers
- Defined in:
- lib/do_snapshot/cli.rb
Overview
CLI is here
Instance Method Summary collapse
-
#initialize(*args) ⇒ CLI
constructor
Overriding Thor method for custom initialization.
- #snap ⇒ Object
- #version ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(*args) ⇒ CLI
Overriding Thor method for custom initialization
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/do_snapshot/cli.rb', line 22 def initialize(*args) super setup_config set_logger set_mailer # Check for keys via options %w( digital_ocean_client_id digital_ocean_api_key digital_ocean_access_token ).each do |key| ENV[key.upcase] = [key] if .include? key end end |
Instance Method Details
#snap ⇒ Object
163 164 165 166 167 168 169 170 |
# File 'lib/do_snapshot/cli.rb', line 163 def snap command.snap rescue DoSnapshot::NoTokenError, DoSnapshot::NoKeysError => e error_simple(e) rescue => e command.fail_power_off(e) if [SnapshotCreateError, DropletShutdownError].include?(e.class) error_with_backtrace(e) end |
#version ⇒ Object
173 174 175 |
# File 'lib/do_snapshot/cli.rb', line 173 def version puts DoSnapshot::VERSION end |