Class: Dependabot::Helm::FileFetcher
- Inherits:
-
Shared::SharedFileFetcher
- Object
- Shared::SharedFileFetcher
- Dependabot::Helm::FileFetcher
- Defined in:
- lib/dependabot/helm/file_fetcher.rb
Constant Summary collapse
- FILENAME_REGEX =
/.*\.ya?ml$/i- CHART_LOCK_REGEXP =
/Chart\.lock/i
Class Method Summary collapse
Instance Method Summary collapse
- #chart_locks ⇒ Object
- #correctly_encoded_helm_files ⇒ Object
- #fetch_files ⇒ Object
- #helm_files ⇒ Object
- #incorrectly_encoded_helm_files_files ⇒ Object
Class Method Details
.filename_regex ⇒ Object
24 25 26 |
# File 'lib/dependabot/helm/file_fetcher.rb', line 24 def self.filename_regex FILENAME_REGEX end |
.required_files_message ⇒ Object
61 62 63 |
# File 'lib/dependabot/helm/file_fetcher.rb', line 61 def self. "Repo must contain a Helm charts file." end |
Instance Method Details
#chart_locks ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/dependabot/helm/file_fetcher.rb', line 40 def chart_locks @chart_locks ||= T.let( repo_contents(raise_errors: false) .select { |f| f.type == "file" && f.name.match?(CHART_LOCK_REGEXP) } .map { |f| fetch_file_from_host(f.name) }, T.nilable(T::Array[DependencyFile]) ) end |
#correctly_encoded_helm_files ⇒ Object
51 52 53 |
# File 'lib/dependabot/helm/file_fetcher.rb', line 51 def correctly_encoded_helm_files helm_files.select { |f| T.must(f.content).valid_encoding? } end |
#fetch_files ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/dependabot/helm/file_fetcher.rb', line 13 def fetch_files fetched_files = [] fetched_files += correctly_encoded_helm_files fetched_files += chart_locks return fetched_files if fetched_files.any? raise_appropriate_error end |
#helm_files ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/dependabot/helm/file_fetcher.rb', line 29 def helm_files @helm_files ||= T.let( repo_contents(raise_errors: false) .select { |f| f.type == "file" && f.name.match?(FILENAME_REGEX) } .map { |f| fetch_file_from_host(f.name) }, T.nilable(T::Array[DependencyFile]) ) end |
#incorrectly_encoded_helm_files_files ⇒ Object
56 57 58 |
# File 'lib/dependabot/helm/file_fetcher.rb', line 56 def incorrectly_encoded_helm_files_files helm_files.reject { |f| T.must(f.content).valid_encoding? } end |