On 01/21 11:18, Lawrence Teo wrote: > According to the RubyMail NEWS file at > https://github.com/matta/rubymail/blob/master/NEWS , this library is > supposed to be usable with Ruby 1.9. However, when used with Ruby 1.9, > it breaks one of my scripts that uses Net::SMTP to send a message > created using RubyMail. > > A modified snippet of the test script is as follows, where if you run > it with Ruby 1.9, you will get a NoMethodError exception. > > [BEGIN] > #! /usr/local/bin/ruby19 > > require 'rubygems' > require 'rmail' > require 'net/smtp' > > msg = RMail::Message.new > msg.header["To"] = "b...@example.com" > msg.header["Subject"] = "Test subject" > msg.body = "This is just a test" > > begin > Net::SMTP.start("smtp.example.com", 25, "example.net") do |smtp| > smtp.send_message msg, "al...@example.net", [ "b...@example.com" ] > end > rescue Exception => e > puts "#{e.class} #{e}" > end > [END] > > This is because smtp.send_message causes RubyMail's message.rb to call > String.each, but the String class in Ruby 1.9 no longer has the each() > method. The following diff patches the message.rb to fix this issue. > The fix is backwards compatible with Ruby 1.8, since Ruby 1.8's String > does have an each() method. > > I have also changed my email address in the port's Makefile. > > If this looks ok, could a developer please commit this?
I don't have an objection to this. However, the regression tests don't appear to work in ruby 1.9 mode, even after modifying the Makefile to get them to run. Can you look into this? Also, this library was last updated in January 2008, which is probably why it isn't 1.9 compatible. 1.9.1 wasn't released until January 2009, and wasn't library compatible with 1.9, which is why ruby 1.9.3 still installs files into /usr/local/lib/ruby/1.9.1. Even if you can get rmail working in 1.9 mode, you may want to consider switching to the mail gem instead. Jeremy Here's the patch for the Makefile: Index: Makefile =================================================================== RCS file: /cvs/ports/mail/ruby-rmail/Makefile,v retrieving revision 1.10 diff -u -p -r1.10 Makefile --- Makefile 16 Sep 2011 10:31:22 -0000 1.10 +++ Makefile 22 Jan 2012 05:58:57 -0000 @@ -3,12 +3,12 @@ COMMENT= Ruby library to create and parse MIME messages DISTNAME= rmail-1.0.0 -REVISION = 6 +REVISION = 7 CATEGORIES= mail HOMEPAGE= http://github.com/matta/rubymail -MAINTAINER= Lawrence Teo <lteo.openb...@calyptix.com> +MAINTAINER= Lawrence Teo <l...@lteo.net> # BSD PERMIT_PACKAGE_CDROM= Yes @@ -20,7 +20,7 @@ MODULES= lang/ruby CONFIGURE_STYLE=ruby gem -do-regress: - @cd ${WRKBUILD} && ${RUBY} test/runtests.rb +MODRUBY_REGRESS= ruby +MODRUBY_REGRESS_TARGET= -I. test/runtests.rb .include <bsd.port.mk>