[PATCH] update aeolus-image to support both ruby 1.8 and 1.9
Jason Guiditta
jguiditt at redhat.com
Tue Apr 17 14:20:50 UTC 2012
On 17/04/12 15:53 +0200, Michal Fojtik wrote:
>On 04/17/12, Mo Morsi wrote:
>
>Hi,
>
>> diff --git a/Rakefile b/Rakefile
>> index e43f22b..59cb58b 100644
>> --- a/Rakefile
>> +++ b/Rakefile
>> @@ -19,7 +19,7 @@ require 'rubygems/package_task'
>> require 'rdoc/task'
>> require 'rake/testtask'
>> require 'rspec/core/rake_task'
>> -require 'rake/rpmtask'
>> +require './rake/rpmtask'
>
>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.
-j
>--
>Michal Fojtik
>Sr. Software Engineer, Deltacloud API (http://deltacloud.org)
More information about the aeolus-devel
mailing list