lib/berkshelf/locations/path_location.rb in berkshelf-0.4.0 vs lib/berkshelf/locations/path_location.rb in berkshelf-0.5.0.rc1
- old
+ new
@@ -1,24 +1,24 @@
module Berkshelf
# @author Jamie Winsor <jamie@vialstudios.com>
class PathLocation
include Location
- location_key :path
+ 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
+ @name = name
@version_constraint = version_constraint
- @path = File.expand_path(options[:path])
+ @path = File.expand_path(options[:path])
set_downloaded_status(true)
end
# @param [#to_s] destination
#
@@ -29,10 +29,14 @@
set_downloaded_status(true)
cached
end
+ def to_hash
+ super.merge(value: self.path)
+ end
+
def to_s
- "path: '#{path}'"
+ "#{self.class.location_key}: '#{path}'"
end
end
end