class Dependabot::Hex::FileUpdater

Public Class Methods

updated_files_regex() click to toggle source
# File lib/dependabot/hex/file_updater.rb, line 13
def self.updated_files_regex
  [
    /^mix\.exs$/,
    /^mix\.lock$/
  ]
end

Public Instance Methods

updated_dependency_files() click to toggle source
# File lib/dependabot/hex/file_updater.rb, line 20
def updated_dependency_files
  updated_files = []

  mixfiles.each do |file|
    if file_changed?(file)
      updated_files <<
        updated_file(file: file, content: updated_mixfile_content(file))
    end
  end

  if lockfile
    updated_files <<
      updated_file(file: lockfile, content: updated_lockfile_content)
  end

  updated_files
end

Private Instance Methods

check_required_files() click to toggle source
# File lib/dependabot/hex/file_updater.rb, line 40
def check_required_files
  raise "No mix.exs!" unless get_original_file("mix.exs")
end
lockfile() click to toggle source
# File lib/dependabot/hex/file_updater.rb, line 64
def lockfile
  @lockfile ||= get_original_file("mix.lock")
end
mixfiles() click to toggle source
# File lib/dependabot/hex/file_updater.rb, line 60
def mixfiles
  dependency_files.select { |f| f.name.end_with?("mix.exs") }
end
updated_lockfile_content() click to toggle source
# File lib/dependabot/hex/file_updater.rb, line 51
def updated_lockfile_content
  @updated_lockfile_content ||=
    LockfileUpdater.new(
      dependencies: dependencies,
      dependency_files: dependency_files,
      credentials: credentials
    ).updated_lockfile_content
end
updated_mixfile_content(file) click to toggle source
# File lib/dependabot/hex/file_updater.rb, line 44
def updated_mixfile_content(file)
  MixfileUpdater.new(
    dependencies: dependencies,
    mixfile: file
  ).updated_mixfile_content
end