##// END OF EJS Templates
svn propset "svn:eol-style" native test/integration/repositories_git_test.rb...
svn propset "svn:eol-style" native test/integration/repositories_git_test.rb git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9629 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9346:5e57a1a9d947
r9446:255a84878d18
Show More
require_arch.rb
57 lines | 1.2 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Merged rails-3.2 branch....
r9346 #:stopdoc:
require 'rbconfig'
# Attempts to require anative extension.
# Falls back to pure-ruby version, if it fails.
#
# This uses Config::CONFIG['arch'] from rbconfig.
def require_arch(fname)
arch = Config::CONFIG['arch']
begin
path = File.join("tmail", arch, fname)
require path
rescue LoadError => e
# try pre-built Windows binaries
if arch =~ /mswin/
require File.join("tmail", 'mswin32', fname)
else
raise e
end
end
end
# def require_arch(fname)
# dext = Config::CONFIG['DLEXT']
# begin
# if File.extname(fname) == dext
# path = fname
# else
# path = File.join("tmail","#{fname}.#{dext}")
# end
# require path
# rescue LoadError => e
# begin
# arch = Config::CONFIG['arch']
# path = File.join("tmail", arch, "#{fname}.#{dext}")
# require path
# rescue LoadError
# case path
# when /i686/
# path.sub!('i686', 'i586')
# when /i586/
# path.sub!('i586', 'i486')
# when /i486/
# path.sub!('i486', 'i386')
# else
# begin
# require fname + '.rb'
# rescue LoadError
# raise e
# end
# end
# retry
# end
# end
# end
#:startdoc: