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
af-0.3.22 lib/vmc/micro/switcher/darwin.rb
af-0.3.20 lib/vmc/micro/switcher/darwin.rb
af-0.3.19 lib/vmc/micro/switcher/darwin.rb
udn-0.3.23.5 lib/vmc/micro/switcher/darwin.rb
udn-0.3.23.4 lib/vmc/micro/switcher/darwin.rb
udn-0.3.23.3 lib/vmc/micro/switcher/darwin.rb
af-0.3.19.beta.1 lib/vmc/micro/switcher/darwin.rb
udn-0.3.23.2 lib/vmc/micro/switcher/darwin.rb
udn-0.3.23.1 lib/vmc/micro/switcher/darwin.rb
udn-0.3.23.0.pre lib/vmc/micro/switcher/darwin.rb
af-0.3.18.12 lib/vmc/micro/switcher/darwin.rb
olympe-0.4 lib/vmc/micro/switcher/darwin.rb
sys-0.3 lib/vmc/micro/switcher/darwin.rb
olympe-0.3 lib/vmc/micro/switcher/darwin.rb
olympe-0.2 lib/vmc/micro/switcher/darwin.rb
olympe-0.1 lib/vmc/micro/switcher/darwin.rb
sys-0.2 lib/vmc/micro/switcher/darwin.rb
sys-0.1 lib/vmc/micro/switcher/darwin.rb
as-1.0 lib/vmc/micro/switcher/darwin.rb
as-0.3.18.11 lib/vmc/micro/switcher/darwin.rb