Class: Vagrant::Action::Builtin::SyncedFolderCleanup

Inherits:
Object
  • Object
show all
Includes:
MixinSyncedFolders
Defined in:
lib/vagrant/action/builtin/synced_folder_cleanup.rb

Overview

This middleware will run cleanup tasks for synced folders using the appropriate synced folder plugin.

Instance Method Summary collapse

Methods included from MixinSyncedFolders

#default_synced_folder_type, #impl_opts, #plugins, #save_synced_folders, #synced_folders, #synced_folders_diff

Methods included from Util::ScopedHashOverride

#scoped_hash_override

Constructor Details

#initialize(app, env) ⇒ SyncedFolderCleanup

Returns a new instance of SyncedFolderCleanup.



16
17
18
19
# File 'lib/vagrant/action/builtin/synced_folder_cleanup.rb', line 16

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant::action::builtin::synced_folder_cleanup")
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant/action/builtin/synced_folder_cleanup.rb', line 21

def call(env)
  folders = synced_folders(env[:machine])

  # Go through each folder and do cleanup
  folders.each_key do |impl_name|
    @logger.info("Invoking synced folder cleanup for: #{impl_name}")
    plugins[impl_name.to_sym][0].new.cleanup(
      env[:machine], impl_opts(impl_name, env))
  end

  @app.call(env)
end