Class: Chef::CookbookVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/busser/chef_ext.rb

Overview

Chef::CookbookVersion, monkey patched to use simpler file source paths (always uses local files instead of manifest records).

Implementation from the sandwich project at: github.com/sometimesfood/sandwich

Instance Method Summary collapse

Instance Method Details

#preferred_filename_on_disk_location(node, segment, source, target = nil) ⇒ String

Determines the absolute source filename on disk for various file resources from their relative path

Parameters:

  • node (Chef::Node)

    the node object, ignored

  • segment (Symbol)

    the segment of the current resource, ignored

  • source (String)

    the source file path

  • target (String) (defaults to: nil)

    the target file path, ignored

Returns:

  • (String)

    the preferred source filename



47
48
49
50
# File 'lib/busser/chef_ext.rb', line 47

def preferred_filename_on_disk_location(node, segment, source, target = nil)
  # keep absolute paths, convert relative paths into absolute paths
  source.start_with?('/') ? source : File.join(Dir.getwd, source)
end