Class: Dependabot::Composer::FileFetcher::PathDependencyBuilder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/composer/file_fetcher/path_dependency_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(path:, directory:, lockfile:) ⇒ PathDependencyBuilder

Returns a new instance of PathDependencyBuilder.



18
19
20
21
22
23
# File 'lib/dependabot/composer/file_fetcher/path_dependency_builder.rb', line 18

def initialize(path:, directory:, lockfile:)
  @path = T.let(path, String)
  @directory = T.let(directory, String)
  @lockfile = T.let(lockfile, T.untyped)
  @parsed_lockfile = T.let(nil, T.nilable(T::Hash[String, T.untyped]))
end

Instance Method Details

#dependency_fileObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dependabot/composer/file_fetcher/path_dependency_builder.rb', line 26

def dependency_file
  filename = File.join(path, PackageManager::MANIFEST_FILENAME)

  # Current we just return `nil` if a path dependency can't be built.
  # In future we may wish to change that to a raise. (We'll get errors
  # in the UpdateChecker or FileUpdater if we fail to build files.)
  built_content = build_path_dep_content
  return unless built_content

  DependencyFile.new(
    name: Pathname.new(filename).cleanpath.to_path,
    content: built_content,
    directory: directory,
    support_file: true
  )
end