Class: Dependabot::Swift::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Defined in:
lib/dependabot/swift/file_updater.rb,
lib/dependabot/swift/file_updater/lockfile_updater.rb,
lib/dependabot/swift/file_updater/manifest_updater.rb,
lib/dependabot/swift/file_updater/requirement_replacer.rb

Defined Under Namespace

Classes: LockfileUpdater, ManifestUpdater, RequirementReplacer

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.updated_files_regexObject



12
13
14
15
16
17
# File 'lib/dependabot/swift/file_updater.rb', line 12

def self.updated_files_regex
  [
    /Package(@swift-\d(\.\d){0,2})?\.swift/,
    /^Package\.resolved$/
  ]
end

Instance Method Details

#updated_dependency_filesObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dependabot/swift/file_updater.rb', line 19

def updated_dependency_files
  updated_files = []

  SharedHelpers.in_a_temporary_repo_directory(manifest.directory, repo_contents_path) do
    updated_manifest = nil

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

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

  updated_files
end