carpentries / styles

Styles for The Carpentries lessons. No README to avoid merge conflicts with lessons. Demo 👇
https://carpentries.github.io/lesson-example
Other
84 stars 96 forks source link

Python invokes native ruby, not bundle ruby #547

Closed reid-a closed 3 years ago

reid-a commented 3 years ago

https://github.com/carpentries/styles/blob/ec29c6b1793ed0af52b4c858a0c7a4911722caf1/bin/util.py#L118

The Ruby invoked by the Python tools called from the Makefile runs a different Ruby than when Ruby is called directly from the Makefile.

For example, the "serve" target runs a multi-stage workflow that populates the bundle with the required gems, and then runs jekyll.

The Python code just calls ruby via Popen.

These executables therefore run in different environments, and can have inconsistent behavior, which is hard to debug.

Recommend changing the ruby invocation on the line above to bundle exec ruby.

reid-a commented 3 years ago

Clarifying since it's already caused some confusion (on the PR): It's not that the versions of ruby being run are different, it's that their environments are different. When Ruby is called from the makefile (e.g. the "make serve" target), it runs in the bundle context, but when it's called from Python (e.g. the "make lesson-check-all" target), it's called from the shell, without the bundle context.

Changing the Python to use "bundle exec ruby" would make the ruby invocations consistent, and facilitate debugging the site.