]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
RubyGems obsoleted *and* b0rked all_load_path, try to work around it
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 4 Mar 2012 20:16:46 +0000 (21:16 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 4 Mar 2012 20:16:46 +0000 (21:16 +0100)
lib/rbot/load-gettext.rb

index d45263e1c2d53de2df2333419c88527242a16c21..ba9b09babb8687fd4ecddf669ffdc372e0dcac9d 100644 (file)
@@ -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.