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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of LockfileUpdater.



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

def initialize(dependencies:, dependency_files:,
               repo_contents_path: nil, credentials:)
  @dependencies = dependencies
  @dependency_files = dependency_files
  @repo_contents_path = repo_contents_path
  @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.



27
28
29
30
31
32
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 27

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

#updated_lockfile_contentObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 42

def updated_lockfile_content
  @updated_lockfile_content ||=
    begin
      updated_content = build_updated_lockfile

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

      updated_content
    end
end