Skip to content

Commit

Permalink
Patch #27951
Browse files Browse the repository at this point in the history
git-svn-id: http://rubygems.rubyforge.org/svn/trunk@2488 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
drbrain committed Apr 21, 2010
1 parent cffcce3 commit 5b69677
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -6,6 +6,8 @@
bug #3102 by Aaron Patterson.
* lib/rubygems/remote_fetcher.rb: Avoid deprecated API for URI. Ruby
bug #3103 by Aaron Patterson.
* lib/rubygems/platform.rb: Add platform support for IronRuby. Patch
#27951 by Will Green.

2010-04-19 Eric Hodel <drbrain@segment7.net>

Expand Down
3 changes: 3 additions & 0 deletions lib/rubygems/platform.rb
Expand Up @@ -70,6 +70,8 @@ def initialize(arch)
when /hpux(\d+)/ then [ 'hpux', $1 ]
when /^java$/, /^jruby$/ then [ 'java', nil ]
when /^java([\d.]*)/ then [ 'java', $1 ]
when /^dotnet$/ then [ 'dotnet', nil ]
when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
when /linux/ then [ 'linux', $1 ]
when /mingw32/ then [ 'mingw32', nil ]
when /(mswin\d+)(\_(\d+))?/ then
Expand Down Expand Up @@ -148,6 +150,7 @@ def =~(other)
when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
when /^i\d86-linux/ then ['x86', 'linux', nil ]
when 'java', 'jruby' then [nil, 'java', nil ]
when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
Expand Down
19 changes: 19 additions & 0 deletions test/test_gem_platform.rb
Expand Up @@ -30,6 +30,9 @@ def test_initialize
'hppa2.0w-hpux11.31' => ['hppa2.0w', 'hpux', '11'],
'java' => [nil, 'java', nil],
'jruby' => [nil, 'java', nil],
'universal-dotnet' => ['universal', 'dotnet', nil],
'universal-dotnet2.0' => ['universal', 'dotnet', '2.0'],
'universal-dotnet4.0' => ['universal', 'dotnet', '4.0'],
'powerpc-aix5.3.0.0' => ['powerpc', 'aix', '5'],
'powerpc-darwin7' => ['powerpc', 'darwin', '7'],
'powerpc-darwin8' => ['powerpc', 'darwin', '8'],
Expand Down Expand Up @@ -227,6 +230,22 @@ def test_equals_tilde
util_set_arch 'java'
assert_match 'java', Gem::Platform.local
assert_match 'jruby', Gem::Platform.local

util_set_arch 'universal-dotnet2.0'
assert_match 'universal-dotnet', Gem::Platform.local
assert_match 'universal-dotnet-2.0', Gem::Platform.local
refute_match 'universal-dotnet-4.0', Gem::Platform.local
assert_match 'dotnet', Gem::Platform.local
assert_match 'dotnet-2.0', Gem::Platform.local
refute_match 'dotnet-4.0', Gem::Platform.local

util_set_arch 'universal-dotnet4.0'
assert_match 'universal-dotnet', Gem::Platform.local
refute_match 'universal-dotnet-2.0', Gem::Platform.local
assert_match 'universal-dotnet-4.0', Gem::Platform.local
assert_match 'dotnet', Gem::Platform.local
refute_match 'dotnet-2.0', Gem::Platform.local
assert_match 'dotnet-4.0', Gem::Platform.local

util_set_arch 'powerpc-darwin'
assert_match 'powerpc-darwin', Gem::Platform.local
Expand Down

0 comments on commit 5b69677

Please sign in to comment.