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
27
28
29
# File 'lib/zabbix_vhost/cli.rb', line 10

def autodiscover(path)


  configurations = ZabbixVhost::Config.dir_reader(path)


  data = configurations.collect do |c|

    unless c.server_name.nil?
      {
        "{#DOMAIN}" => c.server_name,
        "{#CONFIG_FILE}" => c.file_path
      }
    end
  end.compact

  print JSON.generate({data: data})


end

#get_domain_data(config_file, function) ⇒ Object



34
35
36
37
38
39
# File 'lib/zabbix_vhost/cli.rb', line 34

def get_domain_data(config_file, function)

  c = ZabbixVhost::Config.new(config_file)

  print c.send(function)
end

#versionObject



43
44
45
# File 'lib/zabbix_vhost/cli.rb', line 43

def version
  puts ZabbixVhost::VERSION
end