Sha256: b966b9d6e9a2d7aca9af927fc7886e66f8ea7ef0170ffaa47377d3e8386940ad

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

begin
  require 'vagrant'
rescue LoadError
  raise 'The Vagrant Berkshelf plugin must be run within Vagrant.'
end

require 'berkshelf'
require 'fileutils'
require 'json'
require 'tmpdir'

require_relative 'vagrant/errors'
require_relative 'vagrant/version'

module Berkshelf
  module Vagrant
    require_relative 'vagrant/action'
    require_relative 'vagrant/config'
    require_relative 'vagrant/env'
    require_relative 'vagrant/env_helpers'

    TESTED_REQUIREMENTS = [">= 1.1", "< 1.5.0"]

    class << self
      # The path to where shelfs are created on the host machine to be mounted in
      # Vagrant guests
      #
      # @return [String]
      def shelf_path
        File.join(Berkshelf.berkshelf_path, 'vagrant')
      end

      # Generate a new shelf to be mounted in a Vagrant guest
      #
      # @return [String]
      #   path to the generated shelf
      def mkshelf(machine_name = nil)

        unless File.exist?(shelf_path)
          FileUtils.mkdir_p(shelf_path)
        end

        if machine_name.nil?
          prefix_suffix = 'berkshelf-'
        else
          prefix_suffix = ['berkshelf-', "-#{machine_name}"]
        end

        Dir.mktmpdir(prefix_suffix, shelf_path)
      end
    end
  end
end

require_relative 'vagrant/plugin'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-berkshelf-2.0.1 lib/berkshelf/vagrant.rb
vagrant-berkshelf-2.0.0.rc4 lib/berkshelf/vagrant.rb
vagrant-berkshelf-2.0.0.rc3 lib/berkshelf/vagrant.rb