diff options
Diffstat (limited to 'lib/bundler/installer.rb')
-rw-r--r-- | lib/bundler/installer.rb | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 22db01b44e..9ee104d234 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -2,8 +2,8 @@ require 'rubygems/dependency_installer' module Bundler class Installer - def self.install(root, definition) - new(root, definition).run + def self.install(root, definition, options) + new(root, definition).run(options) end attr_reader :root @@ -13,14 +13,17 @@ module Bundler @definition = definition end - def run + def run(options) if dependencies.empty? Bundler.ui.warn "The Gemfile specifies no dependencies" return end + without = options[:without] ? options[:without].map {|w| w.to_sym } : [] + specs.each do |spec| next unless spec.source.respond_to?(:install) + next if (spec.groups & without).any? spec.source.install(spec) end @@ -32,7 +35,7 @@ module Bundler end def specs - @specs ||= resolve_locally || resolve_remotely + @specs ||= group_specs(resolve_locally || resolve_remotely) end private @@ -62,8 +65,25 @@ module Bundler specs end + def group_specs(specs) + dependencies.each do |d| + spec = specs.find { |s| s.name == d.name } + group_spec(specs, spec, d.group) + end + specs + end + + def group_spec(specs, spec, group) + spec.groups << group + spec.groups.uniq! + spec.dependencies.each do |d| + spec = specs.find { |s| s.name == d.name } + group_spec(specs, spec, group) + end + end + def unambiguous?(dep) - dep.version_requirements.requirements.all? { |op,_| op == '=' } + dep.version_requirements.requirements.all? { |op,_| op == '=' } end def index |