Class: Dependabot::Bundler::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/bundler/file_updater.rb,
lib/dependabot/bundler/file_updater/gemfile_updater.rb,
lib/dependabot/bundler/file_updater/gemspec_updater.rb,
lib/dependabot/bundler/file_updater/git_pin_replacer.rb,
lib/dependabot/bundler/file_updater/lockfile_updater.rb,
lib/dependabot/bundler/file_updater/gemspec_sanitizer.rb,
lib/dependabot/bundler/file_updater/git_source_remover.rb,
lib/dependabot/bundler/file_updater/requirement_replacer.rb,
lib/dependabot/bundler/file_updater/ruby_requirement_setter.rb,
lib/dependabot/bundler/file_updater/gemspec_dependency_name_finder.rb

Defined Under Namespace

Classes: GemfileUpdater, GemspecDependencyNameFinder, GemspecSanitizer, GemspecUpdater, GitPinReplacer, GitSourceRemover, LockfileUpdater, RequirementReplacer, RubyRequirementSetter

Instance Method Summary collapse

Instance Method Details

#updated_dependency_filesObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/dependabot/bundler/file_updater.rb', line 24

def updated_dependency_files
  updated_files = T.let([], T::Array[Dependabot::DependencyFile])

  if gemfile && file_changed?(T.must(gemfile))
    updated_files <<
      updated_file(
        file: T.must(gemfile),
        content: updated_gemfile_content(T.must(gemfile))
      )
  end

  if lockfile && dependencies.any?(&:appears_in_lockfile?)
    updated_files <<
      updated_file(file: T.must(lockfile), content: updated_lockfile_content)
  end

  top_level_gemspecs.each do |file|
    next unless file_changed?(file)

    updated_files <<
      updated_file(file: file, content: updated_gemspec_content(file))
  end

  evaled_gemfiles.each do |file|
    next unless file_changed?(file)

    updated_files <<
      updated_file(file: file, content: updated_gemfile_content(file))
  end

  check_updated_files(updated_files)

  base_dir = T.must(updated_files.first).directory
  vendor_updater
    .updated_files(base_directory: base_dir)
    .each do |file|
    updated_files << file
  end

  updated_files
end