Class: Dependabot::Swift::FileUpdater::LockfileUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/swift/file_updater/lockfile_updater.rb

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, manifest:, repo_contents_path:, credentials:, target_version: nil) ⇒ LockfileUpdater

Returns a new instance of LockfileUpdater.



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

def initialize(dependency:, manifest:, repo_contents_path:, credentials:, target_version: nil)
  @dependency = dependency
  @manifest = manifest
  @repo_contents_path = repo_contents_path
  @credentials = credentials
  @target_version = target_version
end

Instance Method Details

#updated_lockfile_contentObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/dependabot/swift/file_updater/lockfile_updater.rb', line 20

def updated_lockfile_content
  SharedHelpers.in_a_temporary_repo_directory(manifest.directory, repo_contents_path) do
    File.write(manifest.name, manifest.content)

    SharedHelpers.with_git_configured(credentials: credentials) do
      try_lockfile_update(dependency.[:identity])

      File.read("Package.resolved")
    end
  end
end