Class: Berkshelf::PathLocation
- Inherits:
-
BaseLocation
- Object
- BaseLocation
- Berkshelf::PathLocation
- Defined in:
- lib/berkshelf/locations/path.rb
Instance Attribute Summary
Attributes inherited from BaseLocation
Instance Method Summary collapse
- #==(other) ⇒ Object
- #cached_cookbook ⇒ Object
-
#expanded_path ⇒ Pathname
The fully expanded path of this cookbook on disk, relative to the Berksfile.
- #inspect ⇒ Object
-
#install ⇒ Object
The installation for a path location is actually just a noop.
-
#installed? ⇒ Boolean
Technically path locations are always installed, but this method intentionally returns
false
to force validation of the cookbook at the path. -
#metadata? ⇒ Boolean
Returns true if the location is a metadata location.
-
#relative_path ⇒ Pathname
Return this PathLocation’s path relative to the associated Berksfile.
- #to_lock ⇒ Object
- #to_s ⇒ Object
Methods inherited from BaseLocation
#initialize, #validate_cached!
Constructor Details
This class inherits a constructor from Berkshelf::BaseLocation
Instance Method Details
#==(other) ⇒ Object
50 51 52 53 54 |
# File 'lib/berkshelf/locations/path.rb', line 50 def ==(other) other.is_a?(PathLocation) && other. == && other.relative_path == relative_path end |
#cached_cookbook ⇒ Object
20 21 22 |
# File 'lib/berkshelf/locations/path.rb', line 20 def cached_cookbook @cached_cookbook ||= CachedCookbook.from_path() end |
#expanded_path ⇒ Pathname
The fully expanded path of this cookbook on disk, relative to the Berksfile.
46 47 48 |
# File 'lib/berkshelf/locations/path.rb', line 46 def @expanded_path ||= Pathname.new File.([:path], File.dirname(dependency.berksfile.filepath)) end |
#inspect ⇒ Object
66 67 68 |
# File 'lib/berkshelf/locations/path.rb', line 66 def inspect "#<Berkshelf::PathLocation metadata: #{}, path: #{relative_path}>" end |
#install ⇒ Object
The installation for a path location is actually just a noop
15 16 17 |
# File 'lib/berkshelf/locations/path.rb', line 15 def install validate_cached!() end |
#installed? ⇒ Boolean
Technically path locations are always installed, but this method intentionally returns false
to force validation of the cookbook at the path.
8 9 10 |
# File 'lib/berkshelf/locations/path.rb', line 8 def installed? false end |
#metadata? ⇒ Boolean
Returns true if the location is a metadata location. By default, no locations are the metadata location.
28 29 30 |
# File 'lib/berkshelf/locations/path.rb', line 28 def !![:metadata] end |
#relative_path ⇒ Pathname
Return this PathLocation’s path relative to the associated Berksfile. It is actually the path reative to the associated Berksfile’s parent directory.
38 39 40 |
# File 'lib/berkshelf/locations/path.rb', line 38 def relative_path @relative_path ||= .relative_path_from(Pathname.new(File.dirname(dependency.berksfile.filepath))) end |
#to_lock ⇒ Object
56 57 58 59 60 |
# File 'lib/berkshelf/locations/path.rb', line 56 def to_lock out = " path: #{relative_path}\n" out << " metadata: true\n" if out end |
#to_s ⇒ Object
62 63 64 |
# File 'lib/berkshelf/locations/path.rb', line 62 def to_s "source at #{relative_path}" end |