Class: Dependabot::NpmAndYarn::UpdateChecker::SubdependencyVersionResolver
- Inherits:
-
Object
- Object
- Dependabot::NpmAndYarn::UpdateChecker::SubdependencyVersionResolver
- Defined in:
- lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb
Instance Method Summary collapse
-
#initialize(dependency:, credentials:, dependency_files:, ignored_versions:, latest_allowable_version:, repo_contents_path:) ⇒ SubdependencyVersionResolver
constructor
A new instance of SubdependencyVersionResolver.
- #latest_resolvable_version ⇒ Object
Constructor Details
#initialize(dependency:, credentials:, dependency_files:, ignored_versions:, latest_allowable_version:, repo_contents_path:) ⇒ SubdependencyVersionResolver
Returns a new instance of SubdependencyVersionResolver.
20 21 22 23 24 25 26 27 28 |
# File 'lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb', line 20 def initialize(dependency:, credentials:, dependency_files:, ignored_versions:, latest_allowable_version:, repo_contents_path:) @dependency = dependency @credentials = credentials @dependency_files = dependency_files @ignored_versions = ignored_versions @latest_allowable_version = latest_allowable_version @repo_contents_path = repo_contents_path end |
Instance Method Details
#latest_resolvable_version ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb', line 30 def latest_resolvable_version raise "Not a subdependency!" if dependency.requirements.any? return if bundled_dependency? base_dir = dependency_files.first.directory SharedHelpers.in_a_temporary_repo_directory(base_dir, repo_contents_path) do dependency_files_builder.write_temporary_dependency_files updated_lockfiles = filtered_lockfiles.map do |lockfile| updated_content = update_subdependency_in_lockfile(lockfile) updated_lockfile = lockfile.dup updated_lockfile.content = updated_content updated_lockfile end version_from_updated_lockfiles(updated_lockfiles) end rescue SharedHelpers::HelperSubprocessFailed # TODO: Move error handling logic from the FileUpdater to this class # Return nil (no update possible) if an unknown error occurred nil end |