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.



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

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>)


15
16
17
# File 'lib/vagrant/plugin/v2/components.rb', line 15

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:



22
23
24
# File 'lib/vagrant/plugin/v2/components.rb', line 22

def commands
  @commands
end

#configsHash<Symbol, Registry> (readonly)

This contains all the configuration plugins by scope.

Returns:



27
28
29
# File 'lib/vagrant/plugin/v2/components.rb', line 27

def configs
  @configs
end

#guest_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered guest capabilities.

Returns:



37
38
39
# File 'lib/vagrant/plugin/v2/components.rb', line 37

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>>)


32
33
34
# File 'lib/vagrant/plugin/v2/components.rb', line 32

def guests
  @guests
end

#host_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered host capabilities.

Returns:



47
48
49
# File 'lib/vagrant/plugin/v2/components.rb', line 47

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>>)


42
43
44
# File 'lib/vagrant/plugin/v2/components.rb', line 42

def hosts
  @hosts
end

#provider_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered provider capabilities.

Returns:



58
59
60
# File 'lib/vagrant/plugin/v2/components.rb', line 58

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:



53
54
55
# File 'lib/vagrant/plugin/v2/components.rb', line 53

def providers
  @providers
end

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

This contains all the push implementations by name.

Returns:

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


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

def pushes
  @pushes
end

#synced_folder_capabilitiesHash<Symbol, Registry> (readonly)

This contains all the registered synced folder capabilities.

Returns:



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

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>>)


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

def synced_folders
  @synced_folders
end