The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Rubygems plugin for Typo

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Florian Frank

Posts: 48
Nickname: ffrank
Registered: Dec, 2005

Florian Frank is a humanoid life-form, living on the third planet of the solar system.
Rubygems plugin for Typo Posted: Dec 19, 2005 5:46 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Florian Frank.
Original Post: Rubygems plugin for Typo
Feed Title: The Rubylution
Feed URL: http://rubylution.ping.de/xml/rss/feed.xml
Feed Description: The Rubylution is a weblog (mainly) about Ruby Programming.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Florian Frank
Latest Posts From The Rubylution

Advertisement

I just made a new sidebar plugin for Typo (http://typo.leetsoft.com), which powers my blog. You can see the result on the right sidebar.

It's so nice to be able to have multiple instances of the same plugin. The only problem with my plugin is, that rubygems does a stupid thing: It includes a 'rubygems/open-uri.rb' file that includes a copy of the 'open-uri.rb' file, that comes with Ruby's standard library. The Gems RemoteInstaller requires it, and I had some strange cases of infinite recursion, because the Standard lib 'open-uri' is also required by Typo.

This is probably done to be compatible to earlier versions of Ruby, which didn't include 'open-uri.rb'. I patched Rubygems to make this a bit more sane:

--- remote_installer.rb.bak     2005-11-12 18:17:16.330519355 +0100
+++ remote_installer.rb 2005-11-12 18:17:41.877160601 +0100
@@ -114,7 +114,11 @@
     # Read the data from the (source based) URI, but if it is a
     # file:// URI, read from the filesystem instead.
     def open_uri_or_path(uri, &block)
-      require 'rubygems/open-uri'
+      begin
+        require 'open-uri'
+      rescue LoadError
+        require 'rubygems/open-uri'
+      end
       if is_file_uri(uri)
         open(get_file_uri_path(uri), &block)
       else

I hope this patch will be applied to Rubygems.

Update: It turns out, that the copying of the original 'open-uri.rb' was done to work around an early bug in the early 1.8.0. versions of ruby. The fix seems to be, just to require 'open-uri', because it had been fixed since this version.

Read: Rubygems plugin for Typo

Topic: Building a Ruby news aggregator Previous Topic   Next Topic Topic: Who will use Ruby?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use