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

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

Constant Summary collapse

LOCKFILE_ENDING =
/(?<ending>\s*(?:RUBY VERSION|BUNDLED WITH).*)/m
GIT_DEPENDENCIES_SECTION =
/GIT\n.*?\n\n(?!GIT)/m
GIT_DEPENDENCY_DETAILS =
/GIT\n.*?\n\n/m

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of LockfileUpdater.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 39

def initialize(
  dependencies:,
  dependency_files:,
  credentials:,
  options:,
  repo_contents_path: nil
)
  @dependencies = T.let(dependencies, T::Array[Dependabot::Dependency])
  @dependency_files = T.let(dependency_files, T::Array[Dependabot::DependencyFile])
  @repo_contents_path = T.let(repo_contents_path, T.nilable(String))
  @credentials = T.let(credentials, T::Array[Dependabot::Credential])
  @options = T.let(options, T::Hash[Symbol, T.untyped])
  @updated_lockfile_content = T.let(nil, T.nilable(String))
  @gemfile = T.let(nil, T.nilable(Dependabot::DependencyFile))
  @lockfile = T.let(nil, T.nilable(Dependabot::DependencyFile))
  @evaled_gemfiles = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
  @bundler_version = T.let(nil, T.nilable(String))
end

Instance Method Details

#gemspec_sourcesObject



61
62
63
64
65
66
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 61

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

#updated_lockfile_contentObject



69
70
71
72
73
74
75
76
77
78
# File 'lib/dependabot/bundler/file_updater/lockfile_updater.rb', line 69

def updated_lockfile_content
  @updated_lockfile_content ||=
    begin
      updated_content = build_updated_lockfile

      raise "Expected content to change!" if T.must(lockfile).content == updated_content

      updated_content
    end
end