summaryrefslogtreecommitdiff
path: root/lib/bundler/runtime.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/runtime.rb')
-rw-r--r--lib/bundler/runtime.rb34
1 files changed, 20 insertions, 14 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index c7276b0e25..54aa30ce0b 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -28,11 +28,11 @@ module Bundler
spec.load_paths.reject {|path| $LOAD_PATH.include?(path) }
end.reverse.flatten
- Bundler.rubygems.add_to_load_path(load_paths)
+ Gem.add_to_load_path(*load_paths)
setup_manpath
- lock(:preserve_unknown_sections => true)
+ lock(preserve_unknown_sections: true)
self
end
@@ -41,12 +41,17 @@ module Bundler
groups.map!(&:to_sym)
groups = [:default] if groups.empty?
- @definition.dependencies.each do |dep|
- # Skip the dependency if it is not in any of the requested groups, or
- # not for the current platform, or doesn't match the gem constraints.
- next unless (dep.groups & groups).any? && dep.should_include?
+ dependencies = @definition.dependencies.select do |dep|
+ # Select the dependency if it is in any of the requested groups, and
+ # for the current platform, and matches the gem constraints.
+ (dep.groups & groups).any? && dep.should_include?
+ end
+
+ Plugin.hook(Plugin::Events::GEM_BEFORE_REQUIRE_ALL, dependencies)
+ dependencies.each do |dep|
required_file = nil
+ Plugin.hook(Plugin::Events::GEM_BEFORE_REQUIRE, dep)
begin
# Loop through all the specified autorequires for the
@@ -76,7 +81,13 @@ module Bundler
end
end
end
+
+ Plugin.hook(Plugin::Events::GEM_AFTER_REQUIRE, dep)
end
+
+ Plugin.hook(Plugin::Events::GEM_AFTER_REQUIRE_ALL, dependencies)
+
+ dependencies
end
def self.definition_method(meth)
@@ -94,8 +105,8 @@ module Bundler
definition_method :requires
def lock(opts = {})
- return if @definition.nothing_changed? && !@definition.unlocking?
- @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
+ return if @definition.no_resolve_needed?
+ @definition.lock(opts[:preserve_unknown_sections])
end
alias_method :gems, :specs
@@ -125,7 +136,6 @@ module Bundler
specs_to_cache.each do |spec|
next if spec.name == "bundler"
next if spec.source.is_a?(Source::Gemspec)
- spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true)
spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
end
@@ -301,11 +311,7 @@ module Bundler
e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \
"but your Gemfile requires #{spec.name} #{spec.version}. #{suggestion}"
e.name = spec.name
- if e.respond_to?(:requirement=)
- e.requirement = Gem::Requirement.new(spec.version.to_s)
- else
- e.version_requirement = Gem::Requirement.new(spec.version.to_s)
- end
+ e.requirement = Gem::Requirement.new(spec.version.to_s)
raise e
end
end