educatic-info/bin/educatic.rb

40 lines
998 B
Ruby

#!/usr/bin/env ruby
require "yaml"
require "colorize"
class Educatic
attr_reader :settings
def initialize(filename)
@settings = YAML.load(File.read(filename))
@services = settings["services"]
end
def check_services
@services.each_pair do |key, value|
# puts "==> #{key} [#{value['hetzner']}] #{value['desc']}".colorize(:white)
puts "==> #{key} [#{value['hetzner']}]".colorize(:white)
cmd = "host #{value['ip']}| grep #{value['hostname']}| wc -l"
counter = %x[#{cmd}].to_i
if counter.zero?
puts " Check this:"
puts " * hostname = #{value['hostname']}"
puts " * ip = #{value['ip']}"
end
unless value['todo'].nil?
puts " TODO:"
value['todo'].each_with_index do |line, index|
puts " #{index + 1}. #{line}"
end
end
end
end
def urls
@services.each_pair do |key, value|
puts "#{key.rjust(16)} : #{value['hostname']}"
end
end
end