Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Bug fix: Construct proper URLs to download gems for platforms like JRuby
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary authored and Carlhuda committed Dec 10, 2009
1 parent 4be41eb commit 9b834f6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/bundler/remote_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions spec/bundler/fetcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions spec/support/builders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9b834f6

Please sign in to comment.