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.77 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.76 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.75 vmc/lib/vmc/micro/switcher/darwin.rb
af-0.3.18.10 lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.74 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.73 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.3.23 lib/vmc/micro/switcher/darwin.rb
vmc-0.3.22 lib/vmc/micro/switcher/darwin.rb
af-0.3.18.8 lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.72 vmc/lib/vmc/micro/switcher/darwin.rb
tac-0.6.1 lib/vmc/micro/switcher/darwin.rb
tac-0.6.0 lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.71 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.70 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.69 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.68 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.67 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.66 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-0.4.0.beta.65 vmc/lib/vmc/micro/switcher/darwin.rb
vmc-IronFoundry-0.3.24 lib/vmc/micro/switcher/darwin.rb