Class: Dependabot::Bundler::FileUpdater::LockfileUpdater

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

Constant Summary collapse

LOCKFILE_ENDING =
/(?<ending>\s*(?:RUBY VERSION|BUNDLED WITH).*)/m.freeze
GIT_DEPENDENCIES_SECTION =
/GIT\n.*?\n\n(?!GIT)/m.freeze
GIT_DEPENDENCY_DETAILS =
/GIT\n.*?\n\n/m.freeze
GEM_NOT_FOUND_ERROR_REGEX =
/
  locked\sto\s(?<name>[^\s]+)\s\(|
  not\sfind\s(?<name>[^\s]+)-\d|
  has\s(?<name>[^\s]+)\slocked\sat
/x.freeze
RETRYABLE_ERRORS =
[::Bundler::HTTPError].freeze

Instance Method Summary collapse

Constructor Details

#initialize(dependencies:, dependency_files:, credentials:) ⇒ LockfileUpdater

Returns a new instance of LockfileUpdater.



46
47
48
49
50
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 46

def initialize(dependencies:, dependency_files:, credentials:)
  @dependencies = dependencies
  @dependency_files = dependency_files
  @credentials = credentials
end

Instance Method Details

#gemspec_sourcesObject

Can’t be a constant because some of these don’t exist in bundler 1.15, which Heroku uses, which causes an exception on boot.



39
40
41
42
43
44
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 39

def gemspec_sources
  [
    ::Bundler::Source::Path,
    ::Bundler::Source::Gemspec
  ]
end

#updated_lockfile_contentObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 52

def updated_lockfile_content
  @updated_lockfile_content ||=
    begin
      updated_content = build_updated_lockfile

      if lockfile.content == updated_content
        raise "Expected content to change!"
      end

      updated_content
    end
end