Class: Dependabot::FileUpdaters::Ruby::Bundler

Inherits:
Base
  • Object
show all
Defined in:
lib/dependabot/file_updaters/ruby/bundler.rb,
lib/dependabot/file_updaters/ruby/bundler/gemfile_updater.rb,
lib/dependabot/file_updaters/ruby/bundler/gemspec_updater.rb,
lib/dependabot/file_updaters/ruby/bundler/git_pin_replacer.rb,
lib/dependabot/file_updaters/ruby/bundler/lockfile_updater.rb,
lib/dependabot/file_updaters/ruby/bundler/gemspec_sanitizer.rb,
lib/dependabot/file_updaters/ruby/bundler/git_source_remover.rb,
lib/dependabot/file_updaters/ruby/bundler/requirement_replacer.rb,
lib/dependabot/file_updaters/ruby/bundler/gemspec_dependency_name_finder.rb

Defined Under Namespace

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

Instance Attribute Summary

Attributes inherited from Base

#credentials, #dependencies, #dependency_files

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dependabot::FileUpdaters::Base

Class Method Details

.updated_files_regexObject



13
14
15
16
17
18
19
20
21
# File 'lib/dependabot/file_updaters/ruby/bundler.rb', line 13

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

Instance Method Details

#updated_dependency_filesObject



23
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
# File 'lib/dependabot/file_updaters/ruby/bundler.rb', line 23

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

  updated_files
end