Permalink
Browse files

Bug fix: Construct proper URLs to download gems for platforms like JRuby

  • Loading branch information...
brynary authored and Carlhuda committed Dec 10, 2009
1 parent 4be41eb commit 9b834f6c9d3e0c7ae8f3d64d7b28c707516e1e01
Showing with 21 additions and 1 deletion.
  1. +4 −1 lib/bundler/remote_specification.rb
  2. +13 −0 spec/bundler/fetcher_spec.rb
  3. +4 −0 spec/support/builders.rb
@@ -32,7 +32,10 @@ def __swap__(spec)
private
def _remote_uri
- "#{@source_uri}/quick/Marshal.4.8/#{@name}-#{@version}.gemspec.rz"
+ # "#{@source_uri}/quick/Marshal.4.8/#{@name}-#{@version}.gemspec.rz"
+ tuple = [@name, @version, @platform]
+ tuple = tuple - [nil, 'ruby', '']
+ "#{@source_uri}/quick/Marshal.4.8/#{tuple.join("-")}.gemspec.rz"
end
def _remote_specification
@@ -110,6 +110,19 @@ def linux ; Gem::Platform.new ['x86', 'linux', nil] ; end
out.should == "1.0.0 JAVA"
end
+ it "finds the java one when only Java is there" do
+ Gem.platforms = [rb, java]
+
+ install_manifest <<-Gemfile
+ clear_sources
+ source "file://#{gem_repo1}"
+ gem "only_java"
+ Gemfile
+
+ out = run_in_context "Bundler.require_env ; puts ONLY_JAVA"
+ out.should == "1.0"
+ end
+
it "raises GemNotFound if no gem for corect platform exists when gem dependencies are tied to specific sources" do
Gem.platforms = [rb]
system_gems "platform_specific-1.0-java" do
View
@@ -53,6 +53,10 @@ def build_repo1
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 RUBY'"
end
+ build_gem "only_java" do |s|
+ s.platform = "java"
+ end
+
build_gem "very-simple"
build_gem "very-simple-prerelease", "1.0.pre"

0 comments on commit 9b834f6

Please sign in to comment.