class Droxy::Installer
Attributes
tld[R]
Public Class Methods
new(tld:, port: nil)
click to toggle source
# File lib/droxy/installer.rb, line 5 def initialize tld:, port: nil @tld, @port = tld, port end
Public Instance Methods
install()
click to toggle source
# File lib/droxy/installer.rb, line 13 def install ResolverFile.new(tld: tld).write port: port reload_network_configuration rescue Errno::EACCES raise SudoRequired end
port()
click to toggle source
# File lib/droxy/installer.rb, line 9 def port @port || raise("Port not specified") end
uninstall()
click to toggle source
# File lib/droxy/installer.rb, line 20 def uninstall ResolverFile.new(tld: tld).remove reload_network_configuration rescue Errno::EACCES raise SudoRequired end
Private Instance Methods
reload_network_configuration()
click to toggle source
# File lib/droxy/installer.rb, line 29 def reload_network_configuration location = `networksetup -getcurrentlocation` `networksetup -createlocation "droxy$$" >/dev/null 2>&1` `networksetup -switchtolocation "droxy$$" >/dev/null 2>&1` `networksetup -switchtolocation "#{location}" >/dev/null 2>&1` `networksetup -deletelocation "droxy$$" >/dev/null 2>&1` end