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:, options:) ⇒ LockfileUpdater

Returns a new instance of LockfileUpdater.


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

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


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

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

#updated_lockfile_contentObject


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

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