aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/source.rb1
-rw-r--r--spec/install/gems_spec.rb11
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/platforms.rb15
4 files changed, 26 insertions, 3 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 42eb6bc5..656e2d1f 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -43,6 +43,7 @@ module Bundler
index = Index.new
Bundler.ui.info "Source: Fetching remote index for `#{uri}`... "
(main_specs + prerelease_specs).each do |name, version, platform|
+ next unless Gem::Platform.match(platform)
spec = RemoteSpecification.new(name, version, platform, @uri)
spec.source = self
index << spec
diff --git a/spec/install/gems_spec.rb b/spec/install/gems_spec.rb
index 320a6d7f..55a298d1 100644
--- a/spec/install/gems_spec.rb
+++ b/spec/install/gems_spec.rb
@@ -117,10 +117,15 @@ describe "gemfile install with gem sources" do
should_be_installed "rack 1.0.0", "activesupport 2.3.5"
end
- it "does not hit the remote source if the gemfile can be satisfied locally" do
- # system_gems "activesupport-2.3.2"
+ it "installs gems for the correct platform" do
+ Gem.platforms = [rb]
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "platform_specific"
+ G
- pending
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
+ out.should == '1.0.0 RUBY'
end
describe "with extra sources" do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e73841c2..35f17985 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -20,6 +20,7 @@ Spec::Runner.configure do |config|
config.include Spec::Matchers
config.include Spec::Path
config.include Spec::Rubygems
+ config.include Spec::Platforms
original_wd = Dir.pwd
original_gem_home = ENV['GEM_HOME']
@@ -35,6 +36,7 @@ Spec::Runner.configure do |config|
end
config.after :each do
+ Gem.platforms = nil
Dir.chdir(original_wd)
ENV['GEM_HOME'] = ENV['GEM_PATH'] = original_gem_home
end
diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb
new file mode 100644
index 00000000..2598488b
--- /dev/null
+++ b/spec/support/platforms.rb
@@ -0,0 +1,15 @@
+module Spec
+ module Platforms
+ def rb
+ Gem::Platform::RUBY
+ end
+
+ def java
+ Gem::Platform.new [nil, "java", nil]
+ end
+
+ def linux
+ Gem::Platform.new ['x86', 'linux', nil]
+ end
+ end
+end \ No newline at end of file