Sha256: ced898b64d6ff8c34cdcf53df420a3d89cc7a0f70c9f4533af9fb6765ac4f1ac

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

module Berkshelf
  class CookbookSource
    # @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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkshelf-0.4.0.rc4 lib/berkshelf/cookbook_source/path_location.rb
berkshelf-0.4.0.rc3 lib/berkshelf/cookbook_source/path_location.rb
berkshelf-0.4.0.rc2 lib/berkshelf/cookbook_source/path_location.rb
berkshelf-0.4.0.rc1 lib/berkshelf/cookbook_source/path_location.rb