class Dependabot::Dep::FileUpdater

Public Class Methods

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

Public Instance Methods

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

  if manifest && file_changed?(manifest)
    updated_files <<
      updated_file(
        file: manifest,
        content: updated_manifest_content
      )
  end

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

  raise "No files changed!" if updated_files.none?

  updated_files
end

Private Instance Methods

check_required_files() click to toggle source
# File lib/dependabot/dep/file_updater.rb, line 43
def check_required_files
  return if get_original_file("Gopkg.toml")

  raise "No Gopkg.toml!"
end
lockfile() click to toggle source
# File lib/dependabot/dep/file_updater.rb, line 53
def lockfile
  @lockfile ||= get_original_file("Gopkg.lock")
end
manifest() click to toggle source
# File lib/dependabot/dep/file_updater.rb, line 49
def manifest
  @manifest ||= get_original_file("Gopkg.toml")
end
updated_lockfile_content() click to toggle source
# File lib/dependabot/dep/file_updater.rb, line 64
def updated_lockfile_content
  LockfileUpdater.new(
    dependencies: dependencies,
    dependency_files: dependency_files,
    credentials: credentials
  ).updated_lockfile_content
end
updated_manifest_content() click to toggle source
# File lib/dependabot/dep/file_updater.rb, line 57
def updated_manifest_content
  ManifestUpdater.new(
    dependencies: dependencies,
    manifest: manifest
  ).updated_manifest_content
end