Sha256: 35a41415b83d7d25052a51ecfb46fff80fa3152f656d110f9189194939958126

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 KB

Contents

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

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

require 'berkshelf'
require 'berkshelf/vagrant/version'
require 'berkshelf/vagrant/errors'

module Berkshelf
  # @author Jamie Winsor <jamie@vialstudios.com>
  module Vagrant
    autoload :Action, 'berkshelf/vagrant/action'
    autoload :Config, 'berkshelf/vagrant/config'
    autoload :Env, 'berkshelf/vagrant/env'
    autoload :EnvHelpers, 'berkshelf/vagrant/env_helpers'

    TESTED_CONSTRAINT = "~> 1.2.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 'berkshelf/vagrant/plugin'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-berkshelf-1.3.7 lib/berkshelf/vagrant.rb
vagrant-berkshelf-1.3.6 lib/berkshelf/vagrant.rb
vagrant-berkshelf-1.3.5 lib/berkshelf/vagrant.rb
vagrant-berkshelf-1.3.4 lib/berkshelf/vagrant.rb
vagrant-berkshelf-1.3.3 lib/berkshelf/vagrant.rb