Sha256: b3666d4a48732f59f6ff69a29685b828c68f652f788c68d3fe175441fea377e4
Contents?: true
Size: 607 Bytes
Versions: 1
Compression:
Stored size: 607 Bytes
Contents
require 'ghost' require 'sys/host' module LocalDomains CONFIGURATION_FILE = "#{ENV["HOME"]}/.local-domains" def self.setup(ip_address) unless File.readable?(CONFIGURATION_FILE) puts "File not found: #{CONFIGURATION_FILE}" exit 1 end @ip_address = ip_address || Sys::Host.ip_addr.first File.readlines(CONFIGURATION_FILE).each do |domain| add_domain(domain.gsub(/[ \n\t]/, "")) end end private def self.add_domain(domain) host = Ghost::Host.new(domain, @ip_address) puts "adding '#{domain}' to '#{@ip_address}'" Ghost.store.set(host) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
local-domains-0.1.0 | lib/local-domains.rb |