Method: Pod::Lockfile.from_file

Defined in:
lib/cocoapods-core/lockfile.rb

.from_file(path) ⇒ Lockfile

Note:

This method returns nil if the given path doesn’t exists.

Loads a lockfile form the given path.

Parameters:

  • path (Pathname)

    the path where the lockfile is serialized.

Returns:

Raises:

  • If there is a syntax error loading the YAML data.

[View source]

38
39
40
41
42
43
44
45
46
47
# File 'lib/cocoapods-core/lockfile.rb', line 38

def self.from_file(path)
  return nil unless path.exist?
  hash = YAMLHelper.load_file(path)
  unless hash && hash.is_a?(Hash)
    raise Informative, "Invalid Lockfile in `#{path}`"
  end
  lockfile = Lockfile.new(hash)
  lockfile.defined_in_file = path
  lockfile
end