Method: Bundler::SharedHelpers#ensure_same_dependencies

Defined in:
lib/bundler/shared_helpers.rb

#ensure_same_dependencies(spec, old_deps, new_deps) ⇒ Object

[View source]

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/bundler/shared_helpers.rb', line 158

def ensure_same_dependencies(spec, old_deps, new_deps)
  new_deps = new_deps.reject {|d| d.type == :development }
  old_deps = old_deps.reject {|d| d.type == :development }

  without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list.sort) }
  new_deps.map!(&without_type)
  old_deps.map!(&without_type)

  extra_deps = new_deps - old_deps
  return if extra_deps.empty?

  Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has corrupted API dependencies" \
    " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
  raise APIResponseMismatchError,
    "Downloading #{spec.full_name} revealed dependencies not in the API (#{extra_deps.join(", ")})." \
    "\nRunning `bundle update #{spec.name}` should fix the problem."
end