Permalink
Browse files

Add a temporary fix for Gem::Dependency#type mismatches when using de…

…velopment dependencies declared in gemspecs.
  • Loading branch information...
1 parent 604a01c commit c2719ab9db2505ec888e3d6dee3f02a18e06a568 @raggi raggi committed Jan 19, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/bundler/definition.rb
View
@@ -70,6 +70,22 @@ def initialize(lockfile, dependencies, sources, unlock)
converge_sources
converge_dependencies
+
+ fixup_dependency_types!
+ end
+
+ def fixup_dependency_types!
+ # XXX This is a temporary workaround for a bug when using rubygems 1.8.15
+ # where Gem::Dependency#== matches Gem::Dependency#type. As the lockfile
+ # doesn't carry a notion of the dependency type, if you use
+ # add_development_dependency in a gemspec that's loaded with the gemspec
+ # directive, the lockfile dependencies and resolved dependencies end up
+ # with a mismatch on #type.
+ @dependencies.each do |d|
+ if ld = @locked_deps.find { |l| l.name == d.name }
+ ld.instance_variable_set(:@type, d.type)
+ end
+ end
end
def resolve_with_cache!

0 comments on commit c2719ab

Please sign in to comment.