summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-04-05 17:44:17 -0700
committerAndre Arko <andre@arko.net>2010-04-05 17:44:17 -0700
commit69acfd88a919de8bac222fc37a1e79d5c6dfdf6c (patch)
tree70c333fd9bf6e8a8039fde40cf8c65b7010b0216
parent6be2abff23b6ac9299ee2573334209ae4540d1d3 (diff)
downloadbundler-69acfd88a919de8bac222fc37a1e79d5c6dfdf6c.tar.gz
Call Bundler.setup from Bundler.require, only set up each group once
-rw-r--r--lib/bundler.rb2
-rw-r--r--lib/bundler/runtime.rb8
-rw-r--r--lib/bundler/templates/environment.erb5
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 68000b49eb..f9021667f0 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -70,7 +70,7 @@ module Bundler
end
def require(*groups)
- load.require(*groups)
+ setup(*groups).require(*groups)
end
def load
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 055477a7d4..494b60b375 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -15,7 +15,9 @@ module Bundler
# Has to happen first
clean_load_path
- specs = groups.any? ? specs_for(groups) : requested_specs
+ unloaded = groups - (@loaded_groups || [])
+ @loaded_groups = groups | (@loaded_groups || [])
+ specs = unloaded.any? ? specs_for(unloaded) : requested_specs
cripple_rubygems(specs)
@@ -26,7 +28,9 @@ module Bundler
end
Gem.loaded_specs[spec.name] = spec
- $LOAD_PATH.unshift(*spec.load_paths)
+ spec.load_paths.each do |path|
+ $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
+ end
end
self
end
diff --git a/lib/bundler/templates/environment.erb b/lib/bundler/templates/environment.erb
index 669634b69f..2fca6bbf20 100644
--- a/lib/bundler/templates/environment.erb
+++ b/lib/bundler/templates/environment.erb
@@ -50,8 +50,11 @@ module Bundler
configure_gem_path_and_home(SPECS)
SPECS.each do |spec|
Gem.loaded_specs[spec.name] = spec
- $LOAD_PATH.unshift(*spec.require_paths)
+ spec.require_paths.each do |path|
+ $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
+ end
end
+ self
end
def self.require(*groups)