Class: Dependabot::Bundler::UpdateChecker::RequirementsUpdater
- Inherits:
-
Object
- Object
- Dependabot::Bundler::UpdateChecker::RequirementsUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/bundler/update_checker/requirements_updater.rb
Defined Under Namespace
Classes: UnfixableRequirement
Constant Summary collapse
- ALLOWED_UPDATE_STRATEGIES =
T.let( [ RequirementsUpdateStrategy::LockfileOnly, RequirementsUpdateStrategy::BumpVersions, RequirementsUpdateStrategy::BumpVersionsIfNecessary ].freeze, T::Array[Dependabot::RequirementsUpdateStrategy] )
Instance Method Summary collapse
-
#initialize(requirements:, update_strategy:, updated_source:, latest_version:, latest_resolvable_version:) ⇒ RequirementsUpdater
constructor
A new instance of RequirementsUpdater.
- #updated_requirements ⇒ Object
Constructor Details
#initialize(requirements:, update_strategy:, updated_source:, latest_version:, latest_resolvable_version:) ⇒ RequirementsUpdater
Returns a new instance of RequirementsUpdater.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dependabot/bundler/update_checker/requirements_updater.rb', line 26 def initialize(requirements:, update_strategy:, updated_source:, latest_version:, latest_resolvable_version:) @requirements = requirements @latest_version = Gem::Version.new(latest_version) if latest_version @updated_source = updated_source @update_strategy = update_strategy check_update_strategy return unless latest_resolvable_version @latest_resolvable_version = Gem::Version.new(latest_resolvable_version) end |
Instance Method Details
#updated_requirements ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dependabot/bundler/update_checker/requirements_updater.rb', line 41 def updated_requirements return requirements if update_strategy.lockfile_only? requirements.map do |req| if req[:file].include?(".gemspec") update_gemspec_requirement(req) else # If a requirement doesn't come from a gemspec, it must be from # a Gemfile. update_gemfile_requirement(req) end end end |