garybernhardt/selecta

Error: Ruby 1.9 or better requirement

brooksreese opened this issue · 10 comments

I am using RVM to manage my Ruby version. I am currently using Ruby 2.0 and have it set as default. When I run 'brew install selecta', the following error is returned:

selecta: Selecta requires Ruby 1.9 or better.
Error: An unsatisfied requirement failed this build.

This behavior is the same even if I switch to a new ruby version such as 2.1.

I'm guessing that you have Ruby 1.8.x installed via homebrew. If you uninstall that and install a Ruby 1.9, you should be OK.

We could simply remove the Ruby version check from the homebrew package, since it leads to false negatives like this. But it really does require 1.9, so I'm torn.

Let me know whether removing 1.8 from homebrew works. If so, this issue can be closed. If it comes up again, I'll find some way to avoid it. (Hopefully, this problem will disappear naturally as 1.8 does.)

I'm testing something similar but haven't come to a conclusion yet. I haven't ever used homebrew to manage my rubies (only RVM), so the default 1.8.7 is installed on my machine. I'm not quite sure if it has anything to do with the error above.

I'm going to do some research on this and I'll write back when I have a better handle on the situation (or more questions!)

I looked into several options over the weekend and I could not come to a solution other than to remove the 1.9 check. The installation workaround is to upgrade the base ruby on our systems (without brew, RVM, etc) to a version of 1.9 or higher - I have no idea why it's not grabbing the RUBY_VERSION that RVM is managing, but maybe homebrew runs in a new instance without loading my bash_profile so RVM's path files are skipped. This is just a theory as I haven't been able to trace it down yet.

Since the check is leading to false negatives, many people who adopt this project will be presented with an error message that leads them in the wrong direction. I really think it would be best to keep the check but display a more detailed error.

Here's an example of the change I'm referring to, we could probably make an even better error message than this. Also, notice I changed the ruby --version check and replaced with RUBY_VERSION.

satisfy do
ruby --version =~ /ruby (\d.\d).\d/
$1.to_f >= 1.9
end

def message
"Selecta requires Ruby 1.9 or better."
end

to

satisfy do
RUBY_VERSION >= '1.9'
end

def message
"Selecta requires Ruby 1.9 or better as your base system ruby."
end

I'm surprised that you have Ruby 1.8 on your PATH by default. I think that OS X started shipping with 1.9 as of... Lion maybe? I'd recommend figuring out how to get rid of that 1.8; I bet that it will continue to cause you trouble.

However, I think that we should just remove the requirement entirely. Selecta will run with whichever Ruby is on $PATH, which means that switching Rubies with rvm etc. can make it suddenly start or stop working. A static check at install time just doesn't make sense.

It seems like you've done the basic setup to modify homebrew recipes, so you can test recipe changes. (I haven't done that.) If so, can you submit a Homebrew PR removing Ruby19Dependency entirely? If you haven't done the setup, I'll do it myself, but I may as well save the effort if you can do it in a few seconds. :)

certainly - I will take care of it tomorrow. I will be traveling most of the day so I will work on it in the afternoon.

I took out the 1.9 dependency check as we discussed, but I'm not sure how to test this project. Looking into this now before submitting a pull request. Here's the link to the commit - let me know if you have any thoughts of concerns.

https://github.com/brooksreese/homebrew/commit/fde969747bf73b9e0dd6fab8c7e5ecc003c2fada

Also, I'm not sure what to do with the following code block:

test do
system "#{bin}/selecta", "--version"
end

Seems right to me! That's exactly what I was going to do, but I didn't have homebrew set up for dev. If you can brew install selecta with that commit applied, I'd feel pretty confident.

Hey, check out this pull request. I'll close this issue as soon as it's resolved. Thanks!

Homebrew/legacy-homebrew#32121

@jacknagel suggested keeping the version check and edited my pull request in the following commit:

Homebrew/legacy-homebrew@8e8777b

I'm closing this issue but will follow up if I notice any more issues with the 1.9 dependency check when installing selecta on other machines.

Thanks! I hope that sorts it out.