Method: VagrantCloud::Box#add_version

Defined in:
lib/vagrant_cloud/box.rb

#add_version(version) ⇒ Version

Add a new version of this box

Parameters:

  • version (String)

    Version number

Returns:



55
56
57
58
59
60
61
62
63
# File 'lib/vagrant_cloud/box.rb', line 55

def add_version(version)
  if versions.any? { |v| v.version == version }
    raise Error::BoxError::VersionExistsError,
      "Version #{version} already exists for box #{tag}"
  end
  v = Version.new(box: self, version: version)
  clean(data: {versions: versions + [v]})
  v
end