Class: Dependabot::Composer::UpdateChecker::RequirementsUpdater
- Inherits:
-
Object
- Object
- Dependabot::Composer::UpdateChecker::RequirementsUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/composer/update_checker/requirements_updater.rb
Constant Summary collapse
- ALIAS_REGEX =
/[a-z0-9\-_\.]*\sas\s+/
- VERSION_REGEX =
/(?:#{ALIAS_REGEX})?[0-9]+(?:\.[a-zA-Z0-9*\-]+)*/
- AND_SEPARATOR =
/(?<=[a-zA-Z0-9*])(?<!\sas)[\s,]+(?![\s,]*[|-]|as)/
- OR_SEPARATOR =
/(?<=[a-zA-Z0-9*])[\s,]*\|\|?\s*/
- SEPARATOR =
/(?:#{AND_SEPARATOR})|(?:#{OR_SEPARATOR})/
- ALLOWED_UPDATE_STRATEGIES =
T.let( [ RequirementsUpdateStrategy::LockfileOnly, RequirementsUpdateStrategy::WidenRanges, RequirementsUpdateStrategy::BumpVersions, RequirementsUpdateStrategy::BumpVersionsIfNecessary ].freeze, T::Array[Dependabot::RequirementsUpdateStrategy] )
Instance Method Summary collapse
-
#initialize(requirements:, update_strategy:, latest_resolvable_version:) ⇒ RequirementsUpdater
constructor
A new instance of RequirementsUpdater.
- #updated_requirements ⇒ Object
Constructor Details
#initialize(requirements:, update_strategy:, latest_resolvable_version:) ⇒ RequirementsUpdater
Returns a new instance of RequirementsUpdater.
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dependabot/composer/update_checker/requirements_updater.rb', line 37 def initialize(requirements:, update_strategy:, latest_resolvable_version:) @requirements = requirements @update_strategy = update_strategy check_update_strategy return unless latest_resolvable_version @latest_resolvable_version = version_class.new(latest_resolvable_version) end |
Instance Method Details
#updated_requirements ⇒ Object
50 51 52 53 54 55 |
# File 'lib/dependabot/composer/update_checker/requirements_updater.rb', line 50 def updated_requirements return requirements if update_strategy.lockfile_only? return requirements unless latest_resolvable_version requirements.map { |req| updated_requirement(req) } end |