Class: VagrantDNS::Installers::Mac
- Inherits:
-
Object
- Object
- VagrantDNS::Installers::Mac
- Defined in:
- lib/vagrant-dns/installers/mac.rb
Instance Attribute Summary collapse
-
#install_path ⇒ Object
Returns the value of attribute install_path.
-
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
Instance Method Summary collapse
-
#initialize(tmp_path, install_path = "/etc/resolver") ⇒ Mac
constructor
A new instance of Mac.
- #install! ⇒ Object
- #registered_resolvers ⇒ Object
- #uninstall! ⇒ Object
Constructor Details
#initialize(tmp_path, install_path = "/etc/resolver") ⇒ Mac
Returns a new instance of Mac.
6 7 8 |
# File 'lib/vagrant-dns/installers/mac.rb', line 6 def initialize(tmp_path, install_path = "/etc/resolver") self.tmp_path, self.install_path = tmp_path, install_path end |
Instance Attribute Details
#install_path ⇒ Object
Returns the value of attribute install_path.
4 5 6 |
# File 'lib/vagrant-dns/installers/mac.rb', line 4 def install_path @install_path end |
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
4 5 6 |
# File 'lib/vagrant-dns/installers/mac.rb', line 4 def tmp_path @tmp_path end |
Instance Method Details
#install! ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/vagrant-dns/installers/mac.rb', line 10 def install! require 'fileutils' FileUtils.mkdir_p('/etc/resolver') FileUtils.ln_s(registered_resolvers, "/etc/resolver", :force => true) rescue Errno::EACCES => e warn "vagrant-dns needs superuser access to manipulate DNS settings" raise e end |
#registered_resolvers ⇒ Object
32 33 34 |
# File 'lib/vagrant-dns/installers/mac.rb', line 32 def registered_resolvers Dir[File.join(tmp_path, "resolver", "*")] end |
#uninstall! ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-dns/installers/mac.rb', line 20 def uninstall! require 'fileutils' registered_resolvers.each do |r| resolver = File.join("/etc/resolver", File.basename(r)) FileUtils.rm_f(resolver) end rescue Errno::EACCES => e warn "vagrant-dns needs superuser access to manipulate DNS settings" raise e end |