Class: Dependabot::NpmAndYarn::FileFetcher::PathDependencyBuilder

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

Instance Method Summary collapse

Constructor Details

#initialize(dependency_name:, path:, directory:, package_lock:, yarn_lock:) ⇒ PathDependencyBuilder

Returns a new instance of PathDependencyBuilder.



26
27
28
29
30
31
32
33
# File 'lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb', line 26

def initialize(dependency_name:, path:, directory:, package_lock:,
               yarn_lock:)
  @dependency_name = dependency_name
  @path = path
  @directory = directory
  @package_lock = package_lock
  @yarn_lock = yarn_lock
end

Instance Method Details

#dependency_fileObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb', line 36

def dependency_file
  filename = File.join(path, "package.json")

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