Sha256: 96cffb5f50360d59d6199708b3adadffde0cd3386848b761e0edaf755e0d2b8a
Contents?: true
Size: 583 Bytes
Versions: 9
Compression:
Stored size: 583 Bytes
Contents
require "micro/errors" module JDCMicro::Switcher class Darwin < Base def adminrun(command) JDCMicro.run_command("osascript", "-e 'do shell script \"#{command}\" with administrator privileges'") end def set_nameserver(domain, ip) File.open("/tmp/#{domain}", 'w') { |file| file.write("nameserver #{ip}") } adminrun("mkdir -p /etc/resolver;mv /tmp/#{domain} /etc/resolver/") end def unset_nameserver(domain, ip) raise JDCMicro::MCFError, "domain missing" unless domain adminrun("rm -f /etc/resolver/#{domain}") end end end
Version data entries
9 entries across 9 versions & 1 rubygems