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

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/file_updaters/ruby/bundler/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 to (?<name>[^\s]+) \(|not find (?<name>[^\s]+)-\d/.freeze
RETRYABLE_ERRORS =
[::Bundler::HTTPError].freeze

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of LockfileUpdater.



42
43
44
45
46
# File 'lib/dependabot/file_updaters/ruby/bundler/lockfile_updater.rb', line 42

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.



35
36
37
38
39
40
# File 'lib/dependabot/file_updaters/ruby/bundler/lockfile_updater.rb', line 35

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

#updated_lockfile_contentObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/dependabot/file_updaters/ruby/bundler/lockfile_updater.rb', line 48

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