Class: Dependabot::Nix::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/nix/file_updater.rb

Constant Summary collapse

FLAKE_ID_REGEX =

Nix’s CLI restricts flake input attribute path elements to this regex. see ‘flakeIdRegex` in nix/src/libflake/include/nix/flake/flakeref.hh

/\A[a-zA-Z][a-zA-Z0-9_-]*\z/

Instance Method Summary collapse

Instance Method Details

#updated_dependency_filesObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dependabot/nix/file_updater.rb', line 22

def updated_dependency_files
  updated_files = []

  updated_flake_nix_content = update_flake_nix
  updated_files << updated_file(file: flake_nix, content: updated_flake_nix_content) if updated_flake_nix_content

  updated_lockfile_content = update_flake_lock(updated_flake_nix_content)

  if updated_lockfile_content == flake_lock.content
    raise Dependabot::DependencyFileContentNotChanged,
          "Expected flake.lock to change for #{dependency.name}, but it didn't"
  end

  updated_files << updated_file(file: flake_lock, content: updated_lockfile_content)
  updated_files
end