123456789_123456789_123456789_123456789_123456789_

Exception: Bundler::IncorrectLockfileDependencies

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, BundlerError, StandardError
Instance Chain:
self, BundlerError, StandardError
Inherits: Bundler::BundlerError
Defined in: lib/bundler/errors.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(spec, actual_dependencies = nil, lockfile_dependencies = nil) ⇒ IncorrectLockfileDependencies

[ GitHub ]

  
# File 'lib/bundler/errors.rb', line 270

def initialize(spec, actual_dependencies = nil, lockfile_dependencies = nil)
  @spec = spec
  @actual_dependencies = actual_dependencies
  @lockfile_dependencies = lockfile_dependencies
end

Instance Attribute Details

#actual_dependencies (readonly)

[ GitHub ]

  
# File 'lib/bundler/errors.rb', line 268

attr_reader :spec, :actual_dependencies, :lockfile_dependencies

#lockfile_dependencies (readonly)

[ GitHub ]

  
# File 'lib/bundler/errors.rb', line 268

attr_reader :spec, :actual_dependencies, :lockfile_dependencies

#spec (readonly)

[ GitHub ]

  
# File 'lib/bundler/errors.rb', line 268

attr_reader :spec, :actual_dependencies, :lockfile_dependencies

Instance Method Details

#message

[ GitHub ]

  
# File 'lib/bundler/errors.rb', line 276

def message
  lines = ["Bundler found incorrect dependencies in the lockfile for #{spec.full_name}", ""]

  if @actual_dependencies && @lockfile_dependencies
    actual_by_name = @actual_dependencies.each_with_object({}) {|d, h| h[d.name] = d }
    lockfile_by_name = @lockfile_dependencies.each_with_object({}) {|d, h| h[d.name] = d }

    (actual_by_name.keys | lockfile_by_name.keys).sort.each do |name|
      actual = actual_by_name[name]
      lockfile = lockfile_by_name[name]
      next if actual && lockfile && actual.requirement == lockfile.requirement

      if actual && lockfile
        lines << "  #{name}: gemspec specifies #{actual.requirement}, lockfile has #{lockfile.requirement}"
      elsif actual
        lines << "  #{name}: gemspec specifies #{actual.requirement}, not in lockfile"
      else
        lines << "  #{name}: not in gemspec, lockfile has #{lockfile.requirement}"
      end
    end

    lines << ""
  end

  lines << "Please run `bundle install` to regenerate the lockfile."
  lines.join("\n")
end