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.

Direct Known Subclasses

Remote::SyncedFolder

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



106
107
108
109
110
111
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 106

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:



103
104
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 103

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.



92
93
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 92

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.



79
80
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 79

def enable(machine, folders, opts)
end

#prepare(machine, folders, opts) ⇒ Object

Deprecated.

DEPRECATED: This will be removed.



68
69
# File 'lib/vagrant/plugin/v2/synced_folder.rb', line 68

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)


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

def usable?(machine, raise_error=false)
end