diff options
author | Carl Lerche <carllerche@mac.com> | 2010-01-31 18:02:02 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-01-31 18:02:02 -0800 |
commit | 32e72a45581d47466f2013659675bb427a5daf93 (patch) | |
tree | 8bc32ac2b9df5e64ff840e0408fac17e27fc2245 | |
parent | 7c15c17dc4680cbb8a367eb7aa605b072cf6d3d5 (diff) | |
download | bundler-32e72a45581d47466f2013659675bb427a5daf93.tar.gz |
Pick the correct platform when installing gems
-rw-r--r-- | lib/bundler/source.rb | 1 | ||||
-rw-r--r-- | spec/install/gems_spec.rb | 11 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 | ||||
-rw-r--r-- | spec/support/platforms.rb | 15 |
4 files changed, 26 insertions, 3 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 42eb6bc5bd..656e2d1fb3 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 320a6d7f0e..55a298d150 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 e73841c20b..35f179850d 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 0000000000..2598488b74 --- /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 |