Sha256: 1b0985024a9126c682bc455d09238f2072bdae4e1debf6013658b9ebdc142f16

Contents?: true

Size: 541 Bytes

Versions: 151

Compression:

Stored size: 541 Bytes

Contents

module VMC::Micro::Switcher

  class Darwin < Base
    def adminrun(command)
      VMC::Micro.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)
      err "domain missing" unless domain
      adminrun("rm -f /etc/resolver/#{domain}")
    end
  end

end

Version data entries

151 entries across 151 versions & 9 rubygems

Version Path
vmc-0.4.0.beta.97 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.96 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.94 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.93 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.92 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.91 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.90 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.89 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.88 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.87 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.86 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.85 vmc/lib/vmc/micro/switcher/darwin.rb
af-0.3.18.11 lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.84 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.83 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.82 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.81 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.80 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.79 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.78 vmc/lib/vmc/micro/switcher/darwin.rb