Class: Dependabot::Composer::FileUpdater::LockfileUpdater

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

Defined Under Namespace

Classes: MissingExtensions

Constant Summary collapse

MISSING_EXPLICIT_PLATFORM_REQ_REGEX =
%r{
  (?<=PHP\sextension\s)ext\-[^\s/]+\s.*?\s(?=is|but)|
  (?<=requires\s)php(?:\-[^\s/]+)?\s.*?\s(?=but)
}x.freeze
MISSING_IMPLICIT_PLATFORM_REQ_REGEX =
%r{
  (?<!with|for|by)\sext\-[^\s/]+\s.*?\s(?=->)|
  (?<=requires\s)php(?:\-[^\s/]+)?\s.*?\s(?=->)
}x.freeze
MISSING_ENV_VAR_REGEX =
/Environment variable '(?<env_var>.[^']+)' is not set/.freeze

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of LockfileUpdater.


41
42
43
44
45
46
# File 'lib/dependabot/composer/file_updater/lockfile_updater.rb', line 41

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

Instance Method Details

#updated_lockfile_contentObject


48
49
50
51
52
53
54
55
56
# File 'lib/dependabot/composer/file_updater/lockfile_updater.rb', line 48

def updated_lockfile_content
  @updated_lockfile_content ||= generate_updated_lockfile_content
rescue MissingExtensions => e
  previous_extensions = composer_platform_extensions.dup
  update_required_extensions(e.extensions)
  raise if previous_extensions == composer_platform_extensions

  retry
end