Method: Vagrant::Box#initialize

Defined in:
lib/vagrant/box.rb

#initialize(name, provider, directory) ⇒ Box

This is used to initialize a box.

Parameters:

  • name (String)

    Logical name of the box.

  • provider (Symbol)

    The provider that this box implements.

  • directory (Pathname)

    The directory where this box exists on disk.

Raises:



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vagrant/box.rb', line 42

def initialize(name, provider, directory)
  @name      = name
  @provider  = provider
  @directory = directory

   = directory.join("metadata.json")
  raise Errors::BoxMetadataFileNotFound, :name => @name if !.file?
  @metadata = JSON.parse(directory.join("metadata.json").read)

  @logger = Log4r::Logger.new("vagrant::box")
end