Class: Dependabot::UpdateCheckers::Ruby::Bundler::RequirementsUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/update_checkers/ruby/bundler/requirements_updater.rb

Defined Under Namespace

Classes: UnfixableRequirement

Instance Method Summary collapse

Constructor Details

#initialize(requirements:, library:, updated_source:, latest_version:, latest_resolvable_version:) ⇒ RequirementsUpdater



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dependabot/update_checkers/ruby/bundler/requirements_updater.rb', line 12

def initialize(requirements:, library:, updated_source:,
               latest_version:, latest_resolvable_version:)
  @requirements = requirements

  @library = library

  @latest_version = Gem::Version.new(latest_version) if latest_version
  @updated_source = updated_source

  return unless latest_resolvable_version

  @latest_resolvable_version =
    Gem::Version.new(latest_resolvable_version)
end

Instance Method Details

#updated_requirementsObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dependabot/update_checkers/ruby/bundler/requirements_updater.rb', line 27

def updated_requirements
  requirements.map do |req|
    if req[:file].match?(/\.gemspec/)
      updated_gemspec_requirement(req)
    else
      # If a requirement doesn't come from a gemspec, it must be from
      # a Gemfile.
      updated_gemfile_requirement(req)
    end
  end
end