Class: Sparoid::CLI

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

Overview

CLI

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/sparoid/cli.rb', line 40

def self.exit_on_failure?
  true
end

Instance Method Details

#auth(host, port = 8484) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/sparoid/cli.rb', line 13

def auth(host, port = 8484)
  send_auth(host, port, options[:config])
rescue Errno::ENOENT
  abort "Sparoid: Config not found"
rescue StandardError => e
  abort "Sparoid: #{e.message} (#{host})"
end

#connect(host, port, spa_port = 8484) ⇒ Object



23
24
25
26
27
28
# File 'lib/sparoid/cli.rb', line 23

def connect(host, port, spa_port = 8484)
  ips = send_auth(host, spa_port, options[:config])
  Sparoid.fdpass(ips, port)
rescue StandardError => e
  abort "Sparoid: #{e.message} (#{host})"
end

#keygenObject



31
32
33
# File 'lib/sparoid/cli.rb', line 31

def keygen
  Sparoid.keygen
end

#versionObject



36
37
38
# File 'lib/sparoid/cli.rb', line 36

def version
  puts "#{Sparoid::VERSION} (ruby)"
end