Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Check Ruby Version in ml.sh bat #305

Closed
garyvidal opened this issue Nov 13, 2014 · 5 comments
Closed

Check Ruby Version in ml.sh bat #305

garyvidal opened this issue Nov 13, 2014 · 5 comments
Assignees
Milestone

Comments

@garyvidal
Copy link

May resolve some issues if you just check for which version of Ruby is running before executing the ml command to ruby and it error out.

@dmcassel
Copy link
Collaborator

Given how common 1.8.7 still is in the wild, my preference is to catch the errors where they happen. I think there are only a small number of places where it matters. Ruby is flexible enough to allow for catching errors on imports, which is pretty cool.

Can't remember, where are the dependencies on 1.9.3+? Not showing a typed password on the command line and...?

@rlouapre
Copy link
Contributor

How about just a warning if the version does not match the required version?

@grtjn
Copy link
Contributor

grtjn commented Nov 14, 2014

The file ml.rb actually contains a version check somewhere near the top. But that only gets triggered for Ruby version < 1.8.7. We could either raise that number to 1.9.3, or add a second case for versions between 1.9.3 and 1.8.7.

Password prompt is one. I am sure I have seen at least one other explicit catch, but can't find it right now. Next to that I did notice on the demo servers, which are running 1.8.7 out of the box, that the JSON parsing of responses for bootstrap and such break, but that is only to pretty print the response.

My general impression is that Ruby is pretty resilient, and we are hardly using any features that are not in 1.8.7. One major concern is though that we are not explicitly testing against 1.8.7, and I am not even sure we actually test against 1.9.3. I am running 2.0.0 myself.

I'd vote for increasing that number and warn that Roxy hasn't been tested against older version. It likely mostly work, but no guarantees, etc etc..

@dmcassel
Copy link
Collaborator

I did a pull request warning people that some features won't work with Ruby 1.8.7. A quick test shows that when run with 1.8.7, response messages aren't parsed.

[dcassel@ml8 roxy-dmc]$ ./ml local wipe

WARNING!!!
Ruby version 1.9.3 is the oldest supported version. You are running
Ruby 1.8.7. Some features may not work. You are encouraged to
upgrade to Ruby 1.9.3+.

Wiping MarkLogic setup for your project from localhost...
ERROR: undefined method `body=' for #<Net::HTTPOK 200 OK readbody=true>
ERROR: ./deploy/lib/server_config.rb:533:in `wipe'deploy/lib/ml.rb:144:in `send'deploy/lib/ml.rb:144

The above shows the warning that comes with the PR I submitted -- you'll see that with basically every command you run. Likewise, that error message will be common. Bootstrap and wipe do work, but they complain. Hopefully that will be enough to prompt people to upgrade.

@dmcassel dmcassel self-assigned this Nov 25, 2014
@dmcassel dmcassel added this to the 1.7.1 milestone Nov 25, 2014
@paxtonhare
Copy link
Contributor

If we want to be nice we can easily fix these errors for older Ruby versions.

A quick google led me to this:

puts res.body if res.response_body_permitted?

^ that would take care of the:
ERROR: undefined method body=' for #<Net::HTTPOK 200 OK readbody=true> ERROR: ./deploy/lib/server_config.rb:533:inwipe'deploy/lib/ml.rb:144:in `send'deploy/lib/ml.rb:144

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants