[PATCH] update aeolus-image to support both ruby 1.8 and 1.9

Mo Morsi mmorsi at redhat.com
Thu Apr 26 13:43:20 UTC 2012


On 04/17/2012 04:59 PM, Vít Ondruch wrote:
> Dne 17.4.2012 16:53, Michal Fojtik napsal(a):
>> On 04/17/12, Vít Ondruch wrote:
>>
>>>>> I found personally this change to use relate path very frustrating in
>>>>> Ruby
>>>>> 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to
>>>>> stop
>>>>> playing with $. variables:
>>>>>
>>>>> require_relative 'rake/rpmtask'
>>>>>
>>>>> In MRI1.8 there is no such method, but in Ruby you can just add it
>>>>> :-)
>>>>>
>>>>> unless Kernel.respond_to?(:require_relative)
>>>>> module Kernel
>>>>>    def require_relative(path)
>>>>>      require File.join(File.dirname(caller[0]), path.to_str)
>>>>>    end
>>>>> end
>>>>> end
>>>>>
>>>>> -- Michal
>>>>>
>>>> I like this approach, and woudl suggest we do the same - we may want
>>>> to consider a -compat package to hold this kind of stuff for ruby 1.8,
>>>> otherwise we end up with lots of projects duplicating this same block
>>>> of code.  Just a thought.
>>>>
>>>
>>> https://rubygems.org/gems/backports
>> Thanks Vit for this. Is there any chance to have this packaged? :-)
>>
>>
>
> Of course there is chance, if that is the preferred choice ...
>
> Vit

Yes that'd be the preferred alternative, this way we can just require
backports in our Rakefile and use require_relative

Until that's in Fedora and we can introduce the dependency would rather
just add the explicit path to the few places that need it as that seems
to be the quickest solution until we have the correct fix (using
backports). If this becomes problematic / out of hand as we start
testing things e2e on ruby 1.9 then we can look into temporarily
manually adding this method.

  -Mo



More information about the aeolus-devel mailing list