Class: Dependabot::Bundler::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.updated_files_regexObject



16
17
18
19
20
21
22
23
24
# File 'lib/dependabot/bundler/file_updater.rb', line 16

def self.updated_files_regex
  [
    /^Gemfile$/,
    /^Gemfile\.lock$/,
    /^gems\.rb$/,
    /^gems\.locked$/,
    /^*\.gemspec$/
  ]
end

Instance Method Details

#updated_dependency_filesObject

rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/AbcSize



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
65
66
67
68
# File 'lib/dependabot/bundler/file_updater.rb', line 28

def updated_dependency_files
  updated_files = []

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

  if lockfile && dependencies.any?(&:appears_in_lockfile?)
    updated_files <<
      updated_file(file: 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 = updated_files.first.directory
  vendor_updater.
    updated_vendor_cache_files(base_directory: base_dir).
    each do |file|
    updated_files << file
  end

  updated_files
end