lib/splash/cli/daemon.rb in prometheus-splash-0.5.3 vs lib/splash/cli/daemon.rb in prometheus-splash-0.6.0
- old
+ new
@@ -1,15 +1,19 @@
# coding: utf-8
+
+# module for all Thor subcommands
module CLISplash
+ # Thor inherited class for splashd daemon management
class CLIController < Thor
include Splash::Daemon::Controller
include Splash::Transports
include Splash::Exiter
include Splash::Loggers
+ # Thor method : starting Splashd
option :foreground, :type => :boolean, :aliases => "-F"
option :purge, :type => :boolean, default: true
option :scheduling, :type => :boolean, default: true
long_desc <<-LONGDESC
Starting Splash Daemon\n
@@ -21,11 +25,11 @@
def start
acase = run_as_root :startdaemon, options
splash_exit acase
end
-
+ # Thor method : purge transport input queue of Splashd daemon
desc "purge", "Purge Transport Input queue of Daemon"
def purge
log = get_logger
log.level = :fatal if options[:quiet]
transport = get_default_client
@@ -37,21 +41,24 @@
log.ok "Queue : #{queue} purged"
splash_exit case: :quiet_exit
end
end
+ # Thor method : stopping Splashd
desc "stop", "Stopping Splash Daemon"
def stop
acase = run_as_root :stopdaemon
splash_exit acase
end
+ # Thor method : getting execution status of Splashd
desc "status", "Splash Daemon status"
def status
acase = run_as_root :statusdaemon
splash_exit acase
end
+ # Thor method : sending ping verb over transport in the input queue of Splashd
desc "ping HOSTNAME", "send a ping to HOSTNAME daemon over transport (need an active tranport), Typicallly RabbitMQ"
def ping(hostname=Socket.gethostname)
log = get_logger
log.info "ctrl+c for interrupt"
begin