Class: Dependabot::Nix::UpdateChecker::VersionedBranchFinder
- Inherits:
-
Object
- Object
- Dependabot::Nix::UpdateChecker::VersionedBranchFinder
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nix/update_checker/versioned_branch_finder.rb
Overview
Detects versioned branch naming patterns (e.g. nixos-24.11, release-24.11) and finds the latest branch matching the same prefix.
Instance Method Summary collapse
-
#initialize(current_ref:, dependency:, credentials:, ignored_versions: []) ⇒ VersionedBranchFinder
constructor
A new instance of VersionedBranchFinder.
- #latest_versioned_branch ⇒ Object
- #versioned_branch? ⇒ Boolean
Constructor Details
#initialize(current_ref:, dependency:, credentials:, ignored_versions: []) ⇒ VersionedBranchFinder
Returns a new instance of VersionedBranchFinder.
35 36 37 38 39 40 |
# File 'lib/dependabot/nix/update_checker/versioned_branch_finder.rb', line 35 def initialize(current_ref:, dependency:, credentials:, ignored_versions: []) @current_ref = current_ref @dependency = dependency @credentials = credentials @ignored_versions = ignored_versions end |
Instance Method Details
#latest_versioned_branch ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/dependabot/nix/update_checker/versioned_branch_finder.rb', line 51 def latest_versioned_branch match = branch_version_match return unless match prefix = match[1] current_version = parse_version(T.must(match[2])) return unless current_version suffix = match[3] # nil if no suffix, e.g. "-small" if present find_latest_branch(T.must(prefix), current_version, suffix) end |
#versioned_branch? ⇒ Boolean
44 45 46 |
# File 'lib/dependabot/nix/update_checker/versioned_branch_finder.rb', line 44 def versioned_branch? !branch_version_match.nil? end |