summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-06-22 14:46:00 -0700
committerCarl Lerche <carllerche@mac.com>2010-06-22 16:11:50 -0700
commit1e1bf7ce98b24e24ee05313c31fd38370bc3b9f7 (patch)
tree50eff91cb3178ecc795853a525ae656c4f944eea
parent48a2236cdf7bbcb62f2da49c624f172f479490cc (diff)
downloadbundler-1e1bf7ce98b24e24ee05313c31fd38370bc3b9f7.tar.gz
Git it all working
-rw-r--r--lib/bundler/definition.rb12
-rw-r--r--lib/bundler/spec_set.rb4
-rw-r--r--spec/runtime/platform_spec.rb26
-rw-r--r--spec/support/builders.rb5
-rw-r--r--spec/support/helpers.rb3
5 files changed, 42 insertions, 8 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index f483157284..eb2c59e4bc 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -32,6 +32,7 @@ module Bundler
def initialize(lockfile, dependencies, sources, unlock)
@dependencies, @sources, @unlock = dependencies, sources, unlock
+ @remote = false
@specs = nil
@unlock[:gems] ||= []
@unlock[:sources] ||= []
@@ -57,6 +58,7 @@ module Bundler
def resolve_remotely!
raise "Specs already loaded" if @specs
+ @remote = true
@sources.each { |s| s.remote! }
specs
end
@@ -101,7 +103,7 @@ module Bundler
end
# Run a resolve against the locally available gems
- Resolver.resolve(expanded_dependencies, index, source_requirements, @last_resolve)
+ @last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, @last_resolve)
end
end
end
@@ -200,7 +202,7 @@ module Bundler
end
resolve = SpecSet.new(converged)
- resolve = resolve.for(expand_dependencies(deps), @unlock[:gems])
+ resolve = resolve.for(expand_dependencies(deps, true), @unlock[:gems])
@last_resolve = resolve
end
@@ -215,14 +217,14 @@ module Bundler
end
def expanded_dependencies
- @expanded_dependencies ||= expand_dependencies(dependencies)
+ @expanded_dependencies ||= expand_dependencies(dependencies, @remote)
end
- def expand_dependencies(dependencies)
+ def expand_dependencies(dependencies, remote = false)
deps = []
dependencies.each do |dep|
dep.gem_platforms(@platforms).each do |p|
- deps << DepProxy.new(dep, p)
+ deps << DepProxy.new(dep, p) if remote || p == Gem::Platform.local.to_generic
end
end
deps
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 79d281126d..193b0f4307 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -79,6 +79,10 @@ module Bundler
SpecSet.new(materialized.compact)
end
+ def merge(set)
+ SpecSet.new(sorted + set.to_a)
+ end
+
private
def sorted
diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb
index 5c0f4eeb1a..8bb49073d4 100644
--- a/spec/runtime/platform_spec.rb
+++ b/spec/runtime/platform_spec.rb
@@ -60,6 +60,30 @@ describe "Bundler.setup with multi platform stuff" do
end
it "will add the resolve for the current platform" do
- pending
+ lockfile <<-G
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ nokogiri (1.4.2-java)
+ weakling (= 0.0.3)
+ weakling (0.0.3)
+
+ PLATFORMS
+ java
+
+ DEPENDENCIES
+ nokogiri
+ G
+
+ system_gems "nokogiri-1.4.2", "platform_specific-1.0-x86-darwin-100"
+
+ gemfile <<-G
+ Gem.platforms = [Gem::Platform::RUBY, Gem::Platform.new("x86-darwin-100")]
+ source "file://#{gem_repo1}"
+ gem "nokogiri"
+ gem "platform_specific"
+ G
+
+ should_be_installed "nokogiri 1.4.2", "platform_specific 1.0 x86-darwin-100"
end
end \ No newline at end of file
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index dfea0fafd2..6bcb42cb18 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -92,6 +92,11 @@ module Spec
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 MSWIN'"
end
+ build_gem "platform_specific" do |s|
+ s.platform = "x86-darwin-100"
+ s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 x86-darwin-100'"
+ end
+
build_gem "only_java" do |s|
s.platform = "java"
end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 6d3431ada5..b3bfc57054 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -33,8 +33,7 @@ module Spec
if opts[:lite_runtime]
setup = "require 'rubygems' ; require 'bundler/setup' ; Bundler.setup(#{groups})\n"
else
- setup = "require 'rubygems' ; "
- setup = "require 'bundler' ; Bundler.setup(#{groups})\n"
+ setup = "require 'rubygems' ; require 'bundler' ; Bundler.setup(#{groups})\n"
end
@out = ruby(setup + cmd, :expect_err => expect_err)