seL4 / docs

This is the source of the seL4 docs.
https://docs.sel4.systems
16 stars 52 forks source link

Add a suitable .ruby-version #229

Closed bbrcknl closed 5 months ago

bbrcknl commented 7 months ago

The doc site currently uses some old Jekyll plugins that only support Ruby version 2.

The .ruby-version file works with rvm and rbenv to force the use of a suitable Ruby version. Version 2.7.8 is the last version of Ruby 2, which is now past end-of-life.

Even for folks who don't use rvm or rbenv, the .ruby-version file is a useful indicator of which version of Ruby to use.

Indanz commented 7 months ago

What is the advantage of using .ruby-version compared to specifying it in the Gemfile?

bbrcknl commented 7 months ago

What is the advantage of using .ruby-version compared to specifying it in the Gemfile?

@mbrcknl Can you pls comment

mbrcknl commented 7 months ago

What is the advantage of using .ruby-version compared to specifying it in the Gemfile?

Ah, I did not realise that a Gemfile could specify a Ruby version. In that case, it would be worth adding a ruby specification there, with a less rigid specification, e.g. ruby "~> 2.7" (or a lower version if it's known to work).

Even so, the Gemfile ruby version is just an assertion that fails if the currently active ruby is outside the spec. Whereas .ruby-version actually selects the given version to be the active one if you're using rbenv or rvm to manage your Ruby installations. So they're probably both useful. I'll work with @bbrcknl to update the PR.

Indanz commented 7 months ago

Perhaps keep the new file and add ruby file: ".ruby-version", to get the best of both.

lsf37 commented 5 months ago

Perhaps keep the new file and add ruby file: ".ruby-version", to get the best of both.

I played around with this locally a bit and there is a catch: specifying the ruby version in the Gemfile makes it an error if a different version is used, which means the change would break current CI. I also got an error message for 2.7.8 -- it seems to not recognise itself (Your Ruby version is 2.7.8, but your Gemfile specified (no version), whereas is fails correctly when run from a different ruby version.)

It'd be possible, of course, (and maybe better) to specify the ruby version in CI manually and make sure that it is the one in .ruby-version, but that is a slightly larger change, and I still haven't figured out how to get around the self recognition error.

I suspect we should upgrade ruby to a more recent version, make sure everything works well with that, and then specify it in the Gemfile as you suggest + update the build instructions.