Class: Dependabot::Gradle::FileFetcher

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

Defined Under Namespace

Classes: SettingsFileParser

Constant Summary collapse

SUPPORTED_BUILD_FILE_NAMES =
T.let(%w(build.gradle build.gradle.kts).freeze, T::Array[String])
SUPPORTED_SETTINGS_FILE_NAMES =
T.let(%w(settings.gradle settings.gradle.kts).freeze, T::Array[String])
SUPPORTED_VERSION_CATALOG_FILE_PATH =

For now Gradle only supports library .toml files in the main gradle folder

T.let(%w(/gradle/libs.versions.toml).freeze, T::Array[String])

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, credentials:, repo_contents_path: nil, options: {}) ⇒ FileFetcher

Returns a new instance of FileFetcher.



38
39
40
41
42
# File 'lib/dependabot/gradle/file_fetcher.rb', line 38

def initialize(source:, credentials:, repo_contents_path: nil, options: {})
  super

  @buildfile_name = T.let(nil, T.nilable(String))
end

Class Method Details

.required_files_in?(filenames) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
49
# File 'lib/dependabot/gradle/file_fetcher.rb', line 45

def self.required_files_in?(filenames)
  filenames.any? do |filename|
    SUPPORTED_BUILD_FILE_NAMES.any? { |supported| filename.end_with?(supported) }
  end
end

.required_files_messageObject



52
53
54
# File 'lib/dependabot/gradle/file_fetcher.rb', line 52

def self.required_files_message
  "Repo must contain a build.gradle / build.gradle.kts file."
end

Instance Method Details

#fetch_filesObject



57
58
59
# File 'lib/dependabot/gradle/file_fetcher.rb', line 57

def fetch_files
  all_buildfiles_in_build(".")
end