Class: Vagrant::Plugin::V2::Components

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/plugin/v2/components.rb

Overview

This is the container class for the components of a single plugin. This allows us to separate the plugin class which defines the components, and the actual container of those components. This removes a bit of state overhead from the plugin class itself.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeComponents

Returns a new instance of Components.


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/vagrant/plugin/v2/components.rb', line 72

def initialize
  # The action hooks hash defaults to []
  @action_hooks = Hash.new { |h, k| h[k] = [] }

  @commands = Registry.new
  @configs = Hash.new { |h, k| h[k] = Registry.new }
  @guests  = Registry.new
  @guest_capabilities = Hash.new { |h, k| h[k] = Registry.new }
  @hosts   = Registry.new
  @host_capabilities = Hash.new { |h, k| h[k] = Registry.new }
  @providers = Registry.new
  @provider_capabilities = Hash.new { |h, k| h[k] = Registry.new }
  @pushes = Registry.new
  @synced_folders = Registry.new
  @synced_folder_capabilities = Hash.new { |h, k| h[k] = Registry.new }
end

Instance Attribute Details

#action_hooksHash<Symbol, Array> (readonly)

This contains all the action hooks.

Returns:

  • (Hash<Symbol, Array>)

12
13
14
# File 'lib/vagrant/plugin/v2/components.rb', line 12

def action_hooks
  @action_hooks
end

#commandsRegistry<Symbol, Array<Proc, Hash>> (readonly)

This contains all the command plugins by name, and returns the command class and options. The command class is wrapped in a Proc so that it can be lazy loaded.

Returns:


19
20
21
# File 'lib/vagrant/plugin/v2/components.rb', line 19

def commands
  @commands
end

#configsHash<Symbol, Registry> (readonly)

This contains all the configuration plugins by scope.

Returns:


24
25
26
# File 'lib/vagrant/plugin/v2/components.rb', line 24

def configs
  @configs
end

#guest_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered guest capabilities.

Returns:


34
35
36
# File 'lib/vagrant/plugin/v2/components.rb', line 34

def guest_capabilities
  @guest_capabilities
end

#guestsRegistry<Symbol, Array<Class, Symbol>> (readonly)

This contains all the guests and their parents.

Returns:

  • (Registry<Symbol, Array<Class, Symbol>>)

29
30
31
# File 'lib/vagrant/plugin/v2/components.rb', line 29

def guests
  @guests
end

#host_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered host capabilities.

Returns:


44
45
46
# File 'lib/vagrant/plugin/v2/components.rb', line 44

def host_capabilities
  @host_capabilities
end

#hostsRegistry<Symbol, Array<Class, Symbol>> (readonly)

This contains all the hosts and their parents.

Returns:

  • (Registry<Symbol, Array<Class, Symbol>>)

39
40
41
# File 'lib/vagrant/plugin/v2/components.rb', line 39

def hosts
  @hosts
end

#provider_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered provider capabilities.

Returns:


55
56
57
# File 'lib/vagrant/plugin/v2/components.rb', line 55

def provider_capabilities
  @provider_capabilities
end

#providersHash<Symbol, Registry> (readonly)

This contains all the provider plugins by name, and returns the provider class and options.

Returns:


50
51
52
# File 'lib/vagrant/plugin/v2/components.rb', line 50

def providers
  @providers
end

#pushesRegistry<Symbol, Array<Class, Hash>> (readonly)

This contains all the push implementations by name.

Returns:

  • (Registry<Symbol, Array<Class, Hash>>)

60
61
62
# File 'lib/vagrant/plugin/v2/components.rb', line 60

def pushes
  @pushes
end

#synced_folder_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered synced folder capabilities.

Returns:


70
71
72
# File 'lib/vagrant/plugin/v2/components.rb', line 70

def synced_folder_capabilities
  @synced_folder_capabilities
end

#synced_foldersRegistry<Symbol, Array<Class, Integer>> (readonly)

This contains all the synced folder implementations by name.

Returns:

  • (Registry<Symbol, Array<Class, Integer>>)

65
66
67
# File 'lib/vagrant/plugin/v2/components.rb', line 65

def synced_folders
  @synced_folders
end