Method: Pod::Podfile.from_file

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

.from_file(path) ⇒ Podfile

Initializes a Podfile from the file with the given path.

Parameters:

  • path (Pathname)

    the path from where the Podfile should be loaded.

Returns:

  • (Podfile)

    the generated Podfile.



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/cocoapods-core/podfile.rb', line 285

def self.from_file(path)
  path = Pathname.new(path)
  unless path.exist?
    raise Informative, "No Podfile exists at path `#{path}`."
  end

  case path.extname
  when '', '.podfile', '.rb'
    Podfile.from_ruby(path)
  when '.yaml'
    Podfile.from_yaml(path)
  else
    raise Informative, "Unsupported Podfile format `#{path}`."
  end
end