class CookbookOmnifetch::PathLocation
Public Instance Methods
==(other)
click to toggle source
# File lib/cookbook-omnifetch/path.rb, line 66 def ==(other) other.is_a?(PathLocation) && other.metadata? == metadata? && other.relative_path == relative_path end
cached_cookbook()
click to toggle source
@see BaseLocation#cached_cookbook
# File lib/cookbook-omnifetch/path.rb, line 22 def cached_cookbook @cached_cookbook ||= CookbookOmnifetch.cached_cookbook_class.from_path(expanded_path) end
expanded_path()
click to toggle source
The fully expanded path of this cookbook on disk, relative to the Berksfile.
@return [Pathname]
# File lib/cookbook-omnifetch/path.rb, line 57 def expanded_path # TODO: this requires Berkshelf::Dependency to provide a delegate (ish) method that does # # def relative_paths_root # File.dirname(berksfile.filepath) # end @expanded_path ||= Pathname.new File.expand_path(options[:path], dependency.relative_paths_root) end
inspect()
click to toggle source
# File lib/cookbook-omnifetch/path.rb, line 89 def inspect "#<CookbookOmnifetch::PathLocation metadata: #{metadata?}, path: #{relative_path}>" end
install()
click to toggle source
The installation for a path location is actually just a noop
@see BaseLocation#install
# File lib/cookbook-omnifetch/path.rb, line 17 def install validate_cached!(expanded_path) end
install_path()
click to toggle source
# File lib/cookbook-omnifetch/path.rb, line 34 def install_path relative_path end
installed?()
click to toggle source
Technically path locations are always installed, but this method intentionally returns false
to force validation of the cookbook at the path.
# File lib/cookbook-omnifetch/path.rb, line 10 def installed? false end
lock_data()
click to toggle source
# File lib/cookbook-omnifetch/path.rb, line 72 def lock_data out = {} out["path"] = relative_path.to_s out["metadata"] = true if metadata? out end
metadata?()
click to toggle source
Returns true if the location is a metadata location. By default, no locations are the metadata location.
@return [Boolean]
# File lib/cookbook-omnifetch/path.rb, line 30 def metadata? !!options[:metadata] end
relative_path()
click to toggle source
Return this PathLocation’s path relative to the associated Berksfile. It is actually the path reative to the associated Berksfile’s parent directory.
@return [Pathname]
the relative path relative to the target
# File lib/cookbook-omnifetch/path.rb, line 44 def relative_path # TODO: this requires Berkshelf::Dependency to provide a delegate (ish) method that does # # def relative_paths_root # File.dirname(berksfile.filepath) # end @relative_path ||= expanded_path.relative_path_from(Pathname.new(dependency.relative_paths_root)) end
to_lock()
click to toggle source
# File lib/cookbook-omnifetch/path.rb, line 79 def to_lock out = " path: #{relative_path}\n" out << " metadata: true\n" if metadata? out end
to_s()
click to toggle source
# File lib/cookbook-omnifetch/path.rb, line 85 def to_s "source at #{relative_path}" end