[DRE-maint] Bug#700754: redmine: Redmine does not work with ruby 1.9.x
Jan Losinski
losinski at wh2.tu-dresden.de
Sun Feb 17 00:21:09 UTC 2013
Hi
* Jérémy Lal <kapouer at melix.org> [2013-02-17 00:54]:
> I need to know if the patch you're referring to won't
> screw redmine with ruby1.8.
You're right, ruby is such a mess ...
It can be wrapped using a DateTime.respond_to?(:parse). This will return
false for 1.8 and true for 1.9:
% irb1.9.1
irb(main):001:0> require 'date'
=> true
irb(main):002:0> DateTime.respond_to?(:parse)
=> true
% irb1.8
irb(main):001:0> require 'date'
=> true
irb(main):002:0> DateTime.respond_to?(:parse)
=> true
irb(main):003:0>
Simply use DateTime.parse if it responds, parsedate else. It's ugly but
thats ruby.
> Is there a simple way to reproduce this bug ? As this
> stage of debian freeze, it won't be accepted unless
> it is obvious and testable.
Its easily testable within an irb console. Also the upstream uses it
(and we don't have to repeat their copy/paste errors that lead to more
than one commit). Its also obvious: replace all occurencies of parsedate
with the if/else thing or put it in a method and use it at this places.
The second makes it also easy to write unittests for it.
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20130217/f512028b/attachment-0001.pgp>
More information about the Pkg-ruby-extras-maintainers
mailing list