Class: Dependabot::Pub::FileFetcher

Inherits:
FileFetchers::Base
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/dependabot/pub/file_fetcher.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.required_files_in?(filenames) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dependabot/pub/file_fetcher.rb', line 17

def self.required_files_in?(filenames)
  filenames.include?("pubspec.yaml")
end

.required_files_messageObject



22
23
24
# File 'lib/dependabot/pub/file_fetcher.rb', line 22

def self.required_files_message
  "Repo must contain a pubspec.yaml."
end

Instance Method Details

#fetch_filesObject



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

def fetch_files
  fetched_files = []
  fetched_files << pubspec_yaml
  fetched_files << pubspec_lock if pubspec_lock
  # Fetch any additional pubspec.yamls in the same git repo for resolving
  # local path-dependencies and workspace packages.
  extra_pubspecs = Dir.glob("**/pubspec.yaml", base: clone_repo_contents)
  fetched_files += extra_pubspecs.map do |pubspec|
    relative_name = Pathname.new("/#{pubspec}").relative_path_from(directory)
    fetch_file_from_host(relative_name)
  end
  fetched_files.uniq
end