Class: ZabbixVhost::CLI

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

Instance Method Summary collapse

Instance Method Details

#autodiscover(path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/zabbix_vhost/cli.rb', line 10

def autodiscover(path)


  configurations = ZabbixVhost::Config.dir_reader(path)


  data = configurations.collect do |c|
    {
      "{#DOMAIN}" => c.server_name,
      "{#CONFIG_FILE}" => c.file_path
    }
  end

  print JSON.generate({data: data})


end

#get_domain_data(config_file, function) ⇒ Object



31
32
33
34
35
36
# File 'lib/zabbix_vhost/cli.rb', line 31

def get_domain_data(config_file, function)

  c = ZabbixVhost::Config.new(config_file)

  print c.send(function)
end

#versionObject



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

def version
  puts ZabbixVhost::VERSION
end