Class: Dependabot::Composer::FileUpdater

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

Defined Under Namespace

Classes: LockfileUpdater, ManifestUpdater

Instance Method Summary collapse

Instance Method Details

#updated_dependency_filesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dependabot/composer/file_updater.rb', line 16

def updated_dependency_files
  updated_files = []

  if file_changed?(T.must(composer_json))
    updated_files <<
      updated_file(
        file: T.must(composer_json),
        content: updated_composer_json_content
      )
  end

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

  if updated_files.none? ||
     updated_files.sort_by(&:name) == dependency_files.sort_by(&:name)
    raise "No files have changed!"
  end

  updated_files
end