Class: Dependabot::Gradle::FileFetcher
- Inherits:
-
FileFetchers::Base
- Object
- FileFetchers::Base
- Dependabot::Gradle::FileFetcher
- 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_LOCK_FILE_NAMES =
T.let(%w(gradle.lockfile).freeze, T::Array[String])
- 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_WRAPPER_FILES_PATH =
%w( gradlew gradlew.bat gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties ).freeze
- 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
- #fetch_files ⇒ Object
-
#initialize(source:, credentials:, repo_contents_path: nil, options: {}, update_config: nil) ⇒ FileFetcher
constructor
A new instance of FileFetcher.
Constructor Details
#initialize(source:, credentials:, repo_contents_path: nil, options: {}, update_config: nil) ⇒ FileFetcher
Returns a new instance of FileFetcher.
49 50 51 52 53 54 |
# File 'lib/dependabot/gradle/file_fetcher.rb', line 49 def initialize(source:, credentials:, repo_contents_path: nil, options: {}, update_config: nil) super @lockfile_name = T.let(T.must(SUPPORTED_LOCK_FILE_NAMES.first), String) @buildfile_name = T.let(nil, T.nilable(String)) end |
Class Method Details
.required_files_in?(filenames) ⇒ Boolean
57 58 59 60 61 |
# File 'lib/dependabot/gradle/file_fetcher.rb', line 57 def self.required_files_in?(filenames) filenames.any? do |filename| SUPPORTED_BUILD_FILE_NAMES.any? { |supported| filename.end_with?(supported) } end end |
.required_files_message ⇒ Object
64 65 66 |
# File 'lib/dependabot/gradle/file_fetcher.rb', line 64 def self. "Repo must contain a build.gradle / build.gradle.kts file." end |
Instance Method Details
#fetch_files ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/dependabot/gradle/file_fetcher.rb', line 69 def fetch_files fetched_files = all_buildfiles_in_build(".") # Filter excluded files from final collection filtered_files = fetched_files.reject do |file| Dependabot::FileFiltering.should_exclude_path?(file.name, "file from final collection", @exclude_paths) end filtered_files end |