Sha256: aba498c95122468e1c18db554b02e6a7888c04e838b168926c28e3df94738fd8

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

module Berkshelf
  # @author Jamie Winsor <jamie@vialstudios.com>
  class PathLocation
    include Location

    location_key :path

    attr_accessor :path

    # @param [#to_s] name
    # @param [Solve::Constraint] version_constraint
    # @param [Hash] options
    #
    # @option options [String] :path
    #   a filepath to the cookbook on your local disk
    def initialize(name, version_constraint, options = {})
      @name = name
      @version_constraint = version_constraint
      @path = File.expand_path(options[:path])
      set_downloaded_status(true)
    end

    # @param [#to_s] destination
    #
    # @return [Berkshelf::CachedCookbook]
    def download(destination)
      cached = CachedCookbook.from_path(path)
      validate_cached(cached)

      set_downloaded_status(true)
      cached
    end

    def to_s
      "path: '#{path}'"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
berkshelf-0.4.0 lib/berkshelf/locations/path_location.rb