Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Mark Alexander <marka@pobox.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: Re: [sup-talk] Ruby 1.9 required for git next?
Date: Mon, 04 Jan 2010 13:58:45 -0500	[thread overview]
Message-ID: <1262631436-sup-2672@r50p> (raw)
In-Reply-To: <1262630674-sup-174@r50p>

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

Excerpts from Mark Alexander's message of Mon Jan 04 13:49:31 -0500 2010:
> ./lib/sup/maildir.rb:210: warning: encoding options not supported in 1.8:

The attached horrible hack fixes it for me.  There's probably
a better way, but I was desperate.

[-- Attachment #2: binary.patch --]
[-- Type: application/octet-stream, Size: 1201 bytes --]

diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
index 0852576..899625d 100644
--- a/lib/sup/maildir.rb
+++ b/lib/sup/maildir.rb
@@ -34,6 +34,12 @@ class Maildir < Source
     #is a worthwhile effort
     @mtimes = { 'cur' => Time.at(0), 'new' => Time.at(0) }.merge(mtimes || {})
     @dir_ids = { 'cur' => [], 'new' => [] }
+    if RUBY_VERSION < "1.9"
+      @bin = ''
+    else
+      @bin = ':BINARY'
+    end
+
   end
 
   def file_path; @dir end
@@ -59,7 +65,7 @@ class Maildir < Source
         File.stat(tmp_path)
       rescue Errno::ENOENT #this is what we want.
         begin
-          File.open(tmp_path, 'wb:BINARY') do |f|
+          File.open(tmp_path, "wb#{@bin}") do |f|
             yield f #provide a writable interface for the caller
             f.fsync
           end
@@ -207,7 +213,7 @@ private
   def with_file_for id
     fn = @ids_to_fns[id] or raise OutOfSyncSourceError, "No such id: #{id.inspect}."
     begin
-      File.open(fn, 'rb:BINARY') { |f| yield f }
+      File.open(fn, "rb#{@bin}") { |f| yield f }
     rescue SystemCallError, IOError => e
       raise FatalSourceError, "Problem reading file for id #{id.inspect}: #{fn.inspect}: #{e.message}."
     end

[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

  reply	other threads:[~2010-01-04 18:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 18:49 Mark Alexander
2010-01-04 18:58 ` Mark Alexander [this message]
2010-01-04 19:00 ` Rich Lane
2010-01-04 19:32   ` Ben Walton
2010-01-04 19:47     ` Rich Lane
2010-01-04 20:02       ` Ben Walton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1262631436-sup-2672@r50p \
    --to=marka@pobox.com \
    --cc=sup-talk@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox