Class: NginxUtils::CLI

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

Instance Method Summary collapse

Instance Method Details

#create_vhostObject



55
56
57
58
# File 'lib/nginx_utils/cli.rb', line 55

def create_vhost
  vhost = NginxUtils::VirtualHost.new(options)
  puts vhost.config
end

#logrotateObject



32
33
34
# File 'lib/nginx_utils/cli.rb', line 32

def logrotate
  NginxUtils::Logrotate.new(options).execute
end

#status(host = "localhost") ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/nginx_utils/cli.rb', line 10

def status(host="localhost")
  result = NginxUtils::Status.get host: host
  if options[:only_value]
    puts result.values.join("\t")
  else
    puts "Active Connections: #{result[:active_connections]}"
    puts "Accepts: #{result[:accepts]} Handled: #{result[:handled]} Requests: #{result[:requests]}"
    puts "Reading: #{result[:reading]} Writing: #{result[:writing]} Waiting: #{result[:waiting]}"
  end
end