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
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/do_snapshot/cli.rb', line 23 def initialize(*args) super setup_config set_logger set_mailer # Check for keys via options %w( digital_ocean_access_token ).each do |key| ENV[key.upcase] = [key] if .include? key end end |
Instance Method Details
#snap ⇒ Object
160 161 162 163 164 165 166 167 |
# File 'lib/do_snapshot/cli.rb', line 160 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
170 171 172 |
# File 'lib/do_snapshot/cli.rb', line 170 def version puts DoSnapshot::VERSION end |