class Berkshelf::GemLocation

Berkshelf location plugin to install via Halite gems.

@since 1.0.0 @api private

Attributes

gem_name[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/berkshelf/locations/gem.rb, line 28
def initialize(*args)
  super
  @gem_name = options[:gem]
end

Public Instance Methods

==(other) click to toggle source
# File lib/berkshelf/locations/gem.rb, line 65
def ==(other)
  other.is_a?(GemLocation) && other.gem_name == gem_name
end
cache_path() click to toggle source

The path to the converted gem.

@return [Pathname]

# File lib/berkshelf/locations/gem.rb, line 80
def cache_path
  @cache_path ||= Pathname.new(Berkshelf.berkshelf_path).join('.cache', 'halite', dependency.name)
end
cached_cookbook() click to toggle source

@see BaseLocation#cached_cookbook

# File lib/berkshelf/locations/gem.rb, line 52
def cached_cookbook
  if cache_path.join('metadata.rb').exist?
    @cached_cookbook ||= CachedCookbook.from_path(cache_path)
  else
    nil
  end
end
inspect() click to toggle source
# File lib/berkshelf/locations/gem.rb, line 73
def inspect
  "#<Berkshelf::GemLocation gem: #{gem_name}>"
end
install() click to toggle source

Convert the gem.

@see BaseLocation#install

# File lib/berkshelf/locations/gem.rb, line 44
def install
  cache_path.rmtree if cache_path.exist?
  cache_path.mkpath
  Halite.convert(gem_name, cache_path)
  validate_cached!(cache_path)
end
installed?() click to toggle source

Always force the re-install.

@see BaseLocation#installed?

# File lib/berkshelf/locations/gem.rb, line 37
def installed?
  false
end
to_lock() click to toggle source

Lockfile rendering for Halite gem cookbooks.

# File lib/berkshelf/locations/gem.rb, line 61
def to_lock
  "    gem: #{gem_name}\n"
end
to_s() click to toggle source
# File lib/berkshelf/locations/gem.rb, line 69
def to_s
  "gem from #{gem_name}"
end