Class: Dependabot::Conda::FileFetcher
- Inherits:
-
FileFetchers::Base
- Object
- FileFetchers::Base
- Dependabot::Conda::FileFetcher
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/conda/file_fetcher.rb
Constant Summary collapse
- ENVIRONMENT_FILE_NAMES =
%w( environment.yml environment.yaml ).freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.required_files_in?(filenames) ⇒ Boolean
20 21 22 |
# File 'lib/dependabot/conda/file_fetcher.rb', line 20 def self.required_files_in?(filenames) filenames.intersect?(ENVIRONMENT_FILE_NAMES) end |
.required_files_message ⇒ Object
25 26 27 |
# File 'lib/dependabot/conda/file_fetcher.rb', line 25 def self. "Repo must contain an environment.yml or environment.yaml file." end |
Instance Method Details
#fetch_files ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/dependabot/conda/file_fetcher.rb', line 30 def fetch_files fetched_files = [] # Try to fetch environment.yml first, then environment.yaml environment_file = fetch_file_if_present("environment.yml") || fetch_file_if_present("environment.yaml") if environment_file # Validate it's a proper conda environment file validation = validate_conda_environment(environment_file) unless validation[:valid] raise( Dependabot::DependencyFileNotFound.new( File.join(directory, environment_file.name), (T.cast(validation[:reason], T.nilable(Symbol))) ) ) end fetched_files << environment_file end return fetched_files if fetched_files.any? raise( Dependabot::DependencyFileNotFound, File.join(directory, "environment.yml") ) end |