Should .rvmrc files be used in ruby gems
I am currently looking at upgrading a gem to Rails 3, some work has already put in and the gem now supports Rails 3 with Ruby 1.9.2. The fork also includes an .rvmrc file which specifies ruby 1.9.2. Should gems use .rvmrc files to 开发者_Go百科specify a ruby version when they can be compatible with multiple versions of ruby? When I try to install the gem on ree from ruby gems the gem complains that I need ruby 1.9.2. Is this because of the .rvmrc file?
Don't add .rvmrc to your gem.
I forgot one and my users started complaining: the whole stuff didn't work because of ruby versions incompatibilities...
A workaround would be to load your gem content only if the current Ruby version is ok.
You'd prepend your main class with a:
if RUBY_VERSION >= 1.9
精彩评论