Class: VagrantPlugins::DNS::Action::CreateDaemonsDir
- Inherits:
-
Object
- Object
- VagrantPlugins::DNS::Action::CreateDaemonsDir
- Defined in:
- lib/vagrant-dns/action/create_daemons_dir.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ CreateDaemonsDir
constructor
A new instance of CreateDaemonsDir.
Constructor Details
#initialize(app, env) ⇒ CreateDaemonsDir
Returns a new instance of CreateDaemonsDir.
5 6 7 |
# File 'lib/vagrant-dns/action/create_daemons_dir.rb', line 5 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vagrant-dns/action/create_daemons_dir.rb', line 9 def call(env) unless env[:machine].config.dns.enabled return @app.call(env) end daemon_path = env[:dns].daemon_path if File.directory?(daemon_path) env[:dns].ui.info "Existed daemons dir #{daemon_path}" else env[:dns].ui.info "Creating daemons dir #{daemon_path}" FileUtils.mkdir_p(daemon_path) end @app.call(env) end |