Class: Dependabot::Nix::Channel
- Inherits:
-
VersionedName
- Object
- VersionedName
- Dependabot::Nix::Channel
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nix/channel.rb
Overview
A NixOS channel: a VersionedName plus helpers for channel tarball URLs
(channels.nixos.org/
Constant Summary collapse
- CHANNEL_HOST =
"channels.nixos.org"- DEFAULT_EXTENSION =
"xz"- CHANNEL_URL_PATTERN =
e.g. https://channels.nixos.org/nixos-26.05/nixexprs.tar.xz The suffix is captured so a bump keeps the flake's existing format.
%r{ \Ahttps?://channels\.nixos\.org/ (?<channel>[a-zA-Z0-9][a-zA-Z0-9._-]*) /nixexprs\.tar\.(?<extension>xz|gz|bz2)\z }x
Constants inherited from VersionedName
VersionedName::VERSIONED_NAME_PATTERN
Instance Attribute Summary
Attributes inherited from VersionedName
Class Method Summary collapse
- .channel_name_from_url(url) ⇒ Object
- .channel_url?(url) ⇒ Boolean
- .extension_from_url(url) ⇒ Object
- .url_for(channel_name, extension: DEFAULT_EXTENSION) ⇒ Object
Methods inherited from VersionedName
#initialize, #newer_than?, #prefix, #same_family?, #suffix, #version, #version_string, #versioned?
Constructor Details
This class inherits a constructor from Dependabot::Nix::VersionedName
Class Method Details
.channel_name_from_url(url) ⇒ Object
34 35 36 37 38 |
# File 'lib/dependabot/nix/channel.rb', line 34 def self.channel_name_from_url(url) return unless url CHANNEL_URL_PATTERN.match(url)&.[](:channel) end |
.channel_url?(url) ⇒ Boolean
27 28 29 30 31 |
# File 'lib/dependabot/nix/channel.rb', line 27 def self.channel_url?(url) return false unless url CHANNEL_URL_PATTERN.match?(url) end |
.extension_from_url(url) ⇒ Object
42 43 44 45 46 |
# File 'lib/dependabot/nix/channel.rb', line 42 def self.extension_from_url(url) return unless url CHANNEL_URL_PATTERN.match(url)&.[](:extension) end |
.url_for(channel_name, extension: DEFAULT_EXTENSION) ⇒ Object
50 51 52 |
# File 'lib/dependabot/nix/channel.rb', line 50 def self.url_for(channel_name, extension: DEFAULT_EXTENSION) "https://#{CHANNEL_HOST}/#{channel_name}/nixexprs.tar.#{extension}" end |