summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-07-02 17:53:13 -0700
committerCarlhuda <carlhuda@engineyard.com>2010-07-02 17:53:13 -0700
commit485ec3339d7c44bae222432bf4dab13ac2b0e66e (patch)
treeebd05c5956c0afde4f9eff057e974e517b9ffc9b
parent1c170188f86d18ba9cb6bc2ac015a280fe4e999e (diff)
downloadbundler-485ec3339d7c44bae222432bf4dab13ac2b0e66e.tar.gz
Hopefully this commit will actually make the bundle executable available when running bundle exec
-rw-r--r--lib/bundler/definition.rb3
-rw-r--r--lib/bundler/source.rb34
2 files changed, 20 insertions, 17 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 7170276273..8c4e82d06e 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -74,7 +74,8 @@ module Bundler
specs = resolve.materialize(requested_dependencies)
unless specs["bundler"].any?
- specs["bundler"] = index.search(Gem::Dependency.new('bundler', VERSION)).last
+ bundler = index.search(Gem::Dependency.new('bundler', VERSION)).last
+ specs["bundler"] = bundler if bundler
end
specs
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 3f4819aaf2..df2277cd00 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -146,27 +146,29 @@ module Bundler
def installed_specs
@installed_specs ||= begin
idx = Index.new
- Gem::SourceIndex.from_installed_gems.to_a.reverse.each do |name, spec|
- next if name == 'bundler'
+ have_bundler = false
+ Gem::SourceIndex.from_installed_gems.to_a.reverse.each do |dont_use_this_var, spec|
+ next if spec.name == 'bundler' && spec.version.to_s != VERSION
+ have_bundler = true if spec.name == 'bundler'
spec.source = self
idx << spec
end
+
# Always have bundler locally
- unless bundler = Gem.loaded_specs['bundler']
- # We're running bundler directly from the source
- # so, let's create a fake gemspec for it (it's a path)
- # gemspec
-
- bundler = Gem::Specification.new do |s|
- s.name = 'bundler'
- s.version = VERSION
- s.platform = Gem::Platform::RUBY
- s.source = self
- # TODO: Remove this
- s.loaded_from = 'w0t'
- end
+ unless have_bundler
+ # We're running bundler directly from the source
+ # so, let's create a fake gemspec for it (it's a path)
+ # gemspec
+ bundler = Gem::Specification.new do |s|
+ s.name = 'bundler'
+ s.version = VERSION
+ s.platform = Gem::Platform::RUBY
+ s.source = self
+ # TODO: Remove this
+ s.loaded_from = 'w0t'
+ end
+ idx << bundler
end
- idx << bundler
idx
end
end