Class: Vagrant::Plugin::V2::SyncedFolder

Inherits:
Object
  • Object
show all
Includes:
CapabilityHost
Defined in:
lib/vagrant/plugin/v2/synced_folder.rb

Overview

This is the base class for a synced folder implementation.

Defined Under Namespace

Classes: Collection

Instance Method Summary collapse

Methods included from CapabilityHost

#capability, #capability?, #capability_host_chain, #initialize_capabilities!

Instance Method Details

#_initialize(machine, synced_folder_type) ⇒ Object


101
102
103
104
105
106
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 101

def _initialize(machine, synced_folder_type)
  plugins = Vagrant.plugin("2").manager.synced_folders
  capabilities = Vagrant.plugin("2").manager.synced_folder_capabilities
  initialize_capabilities!(synced_folder_type, plugins, capabilities, machine)
  self
end

#cleanup(machine, opts) ⇒ Object

This is called after destroying the machine during a vagrant destroy and also prior to syncing folders during a vagrant up.

No return value.

Parameters:


98
99
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 98

def cleanup(machine, opts)
end

#disable(machine, folders, opts) ⇒ Object

This is called to remove the synced folders from a running machine.

This is not guaranteed to be called, but this should be implemented by every synced folder implementation.

Parameters:

  • machine (Machine)

    The machine to modify.

  • folders (Hash)

    The folders to remove. This will not contain any folders that should remain.

  • opts (Hash)

    Any options for the synced folders.


87
88
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 87

def disable(machine, folders, opts)
end

#enable(machine, folders, opts) ⇒ Object

This is called after the machine is booted and after networks are setup.

This might be called with new folders while the machine is running. If so, then this should add only those folders without removing any existing ones.

No return value.


74
75
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 74

def enable(machine, folders, opts)
end

#prepare(machine, folders, opts) ⇒ Object

Deprecated.

DEPRECATED: This will be removed.


63
64
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 63

def prepare(machine, folders, opts)
end

#usable?(machine, raise_error = false) ⇒ Boolean

This is called early when the synced folder is set to determine if this implementation can be used for this machine. This should return true or false.

Parameters:

  • machine (Machine)
  • raise_error (Boolean) (defaults to: false)

    If true, should raise an exception if it isn't usable.

Returns:

  • (Boolean)

57
58
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 57

def usable?(machine, raise_error=false)
end