Froze rails gems
[depot.git] / vendor / rails / actionmailer / lib / action_mailer / vendor / tmail-1.2.3 / tmail / require_arch.rb
1 #:stopdoc:
2 require 'rbconfig'
3
4 # Attempts to require anative extension.
5 # Falls back to pure-ruby version, if it fails.
6 #
7 # This uses Config::CONFIG['arch'] from rbconfig.
8
9 def require_arch(fname)
10 arch = Config::CONFIG['arch']
11 begin
12 path = File.join("tmail", arch, fname)
13 require path
14 rescue LoadError => e
15 # try pre-built Windows binaries
16 if arch =~ /mswin/
17 require File.join("tmail", 'mswin32', fname)
18 else
19 raise e
20 end
21 end
22 end
23
24
25 # def require_arch(fname)
26 # dext = Config::CONFIG['DLEXT']
27 # begin
28 # if File.extname(fname) == dext
29 # path = fname
30 # else
31 # path = File.join("tmail","#{fname}.#{dext}")
32 # end
33 # require path
34 # rescue LoadError => e
35 # begin
36 # arch = Config::CONFIG['arch']
37 # path = File.join("tmail", arch, "#{fname}.#{dext}")
38 # require path
39 # rescue LoadError
40 # case path
41 # when /i686/
42 # path.sub!('i686', 'i586')
43 # when /i586/
44 # path.sub!('i586', 'i486')
45 # when /i486/
46 # path.sub!('i486', 'i386')
47 # else
48 # begin
49 # require fname + '.rb'
50 # rescue LoadError
51 # raise e
52 # end
53 # end
54 # retry
55 # end
56 # end
57 # end
58 #:startdoc: