Class: VagrantDNS::Middlewares::Restart

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-dns/middlewares/restart.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Restart

Returns a new instance of Restart.



4
5
6
7
# File 'lib/vagrant-dns/middlewares/restart.rb', line 4

def initialize(app, env)
  @app = app
  @env = env
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/vagrant-dns/middlewares/restart.rb', line 9

def call(env)
  @env = env
  vm = env[:machine]
  if VagrantDNS::Config.auto_run
    tmp_path = File.join(vm.env.tmp_path, "dns")
    VagrantDNS::Service.new(tmp_path).restart!
    env[:ui].info "Restarted DNS Service"
  end
  @app.call(env)
end