summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2012-03-04 21:16:46 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2012-03-04 21:16:46 +0100
commit7a6221adf24e81ef1e47441bd848241adfa02ba6 (patch)
tree40883aec45c1d2c4eac407b57eeda3af0a141ee7
parentaf91a8059f8d8b1bd62b10fd9681dc93c2356d52 (diff)
RubyGems obsoleted *and* b0rked all_load_path, try to work around it
-rw-r--r--lib/rbot/load-gettext.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/rbot/load-gettext.rb b/lib/rbot/load-gettext.rb
index d45263e1..ba9b09ba 100644
--- a/lib/rbot/load-gettext.rb
+++ b/lib/rbot/load-gettext.rb
@@ -43,7 +43,29 @@ end
else
warning 'This version of ruby-gettext does not support non-cached mode; mo files are not reloaded when setting language'
end
- bindtextdomain 'rbot'
+
+ begin
+ bindtextdomain 'rbot'
+ rescue NoMethodError => e
+ error e
+ warning 'Trying to work around RubyGems/GetText incompatibility'
+ module ::Gem
+ def self.all_load_paths
+ result = []
+
+ Gem.path.each do |gemdir|
+ each_load_path all_partials(gemdir) do |load_path|
+ result << load_path
+ end
+ end
+
+ result
+ end
+ end
+ retry
+ end
+
+
module GetText
# patch for ruby-gettext 1.x to cope with anonymous modules used by rbot.