Sha256: 53edb5e32da19d9f0d7423a2cf34c6ae402ed6799d3cda38c53257eb5b4fe4d6

Contents?: true

Size: 990 Bytes

Versions: 25

Compression:

Stored size: 990 Bytes

Contents

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

    set_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_hash
      super.merge(value: self.path)
    end

    def to_s
      "#{self.class.location_key}: '#{path}'"
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
berkshelf-1.1.6 lib/berkshelf/locations/path_location.rb
berkshelf-1.1.5 lib/berkshelf/locations/path_location.rb
berkshelf-1.1.4 lib/berkshelf/locations/path_location.rb
berkshelf-1.1.3 lib/berkshelf/locations/path_location.rb
berkshelf-1.1.2 lib/berkshelf/locations/path_location.rb
berkshelf-1.1.1 lib/berkshelf/locations/path_location.rb
berkshelf-1.1.0 lib/berkshelf/locations/path_location.rb
berkshelf-1.1.0.rc1 lib/berkshelf/locations/path_location.rb
berkshelf-1.0.4 lib/berkshelf/locations/path_location.rb
berkshelf-1.0.3 lib/berkshelf/locations/path_location.rb
berkshelf-1.0.2 lib/berkshelf/locations/path_location.rb
berkshelf-1.0.0 lib/berkshelf/locations/path_location.rb
berkshelf-1.0.0.rc3 lib/berkshelf/locations/path_location.rb
berkshelf-1.0.0.rc2 lib/berkshelf/locations/path_location.rb
berkshelf-1.0.0.rc1 lib/berkshelf/locations/path_location.rb
berkshelf-0.6.0.beta4 lib/berkshelf/locations/path_location.rb
berkshelf-0.6.0.beta3 lib/berkshelf/locations/path_location.rb
berkshelf-0.6.0.beta2 lib/berkshelf/locations/path_location.rb
berkshelf-0.5.1 lib/berkshelf/locations/path_location.rb
berkshelf-0.6.0.beta1 lib/berkshelf/locations/path_location.rb