Class: Dependabot::Nix::UpdateChecker::ChannelVersionFinder
- Inherits:
-
Object
- Object
- Dependabot::Nix::UpdateChecker::ChannelVersionFinder
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nix/update_checker/channel_version_finder.rb
Overview
Finds the latest NixOS channel and its revision: channels come from the channels.nixos.org S3 listing, revisions from each channel's git-revision marker.
Constant Summary collapse
- CHANNELS_BASE_URL =
"https://channels.nixos.org"- CHANNEL_KEY_PATTERN =
%r{<Key>([^<]+)</Key>}- SHA_PATTERN =
/\A[0-9a-f]{40}\z/
Instance Method Summary collapse
- #current_channel_revision ⇒ Object
-
#initialize(current_channel:, credentials:, ignored_versions: [], extension: Channel::DEFAULT_EXTENSION) ⇒ ChannelVersionFinder
constructor
A new instance of ChannelVersionFinder.
- #latest_channel ⇒ Object
Constructor Details
#initialize(current_channel:, credentials:, ignored_versions: [], extension: Channel::DEFAULT_EXTENSION) ⇒ ChannelVersionFinder
Returns a new instance of ChannelVersionFinder.
31 32 33 34 35 36 37 38 |
# File 'lib/dependabot/nix/update_checker/channel_version_finder.rb', line 31 def initialize(current_channel:, credentials:, ignored_versions: [], extension: Channel::DEFAULT_EXTENSION) @current_channel = T.let(Channel.new(current_channel), Channel) @credentials = credentials @ignored_versions = ignored_versions @extension = extension @available_channels = T.let(nil, T.nilable(T::Array[String])) @ignore_filter = T.let(nil, T.nilable(IgnoreFilter)) end |
Instance Method Details
#current_channel_revision ⇒ Object
57 58 59 |
# File 'lib/dependabot/nix/update_checker/channel_version_finder.rb', line 57 def current_channel_revision resolve_revision(current_channel.name) end |
#latest_channel ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dependabot/nix/update_checker/channel_version_finder.rb', line 43 def latest_channel return unless current_channel.versioned? candidate = newest_candidate return unless candidate rev = resolve_revision(candidate.name) return unless rev { channel: candidate.name, url: Channel.url_for(candidate.name, extension: extension), commit_sha: rev } end |