Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): Update ruby install instructions in environment setup readme #11714

Closed
wants to merge 4 commits into from

Conversation

MajorLift
Copy link
Contributor

@MajorLift MajorLift commented Oct 9, 2024

Description

The current ruby install instructions in the "Environment Setup" readme are vague, and may cause gem to be run with the system root installation.

Screenshot 2024-10-09 at 9 13 29 AM

https://consensys.slack.com/archives/C02U025CVU4/p1728496388117329

This commit updates the instructions with commands that fix this issue.

Related issues

Manual testing steps

Screenshots/Recordings

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

github-actions bot commented Oct 9, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@MajorLift MajorLift force-pushed the jongsun/docs/241009-ruby-install-instructions branch from f29329d to 8a84df2 Compare October 9, 2024 18:57
@MajorLift MajorLift added No QA Needed Apply this label when your PR does not need any QA effort. needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) area-documentation No E2E Smoke Needed If the PR does not need E2E smoke test run labels Oct 9, 2024
@MajorLift MajorLift marked this pull request as ready for review October 9, 2024 19:01
@MajorLift MajorLift requested a review from a team as a code owner October 9, 2024 19:01
@MajorLift MajorLift requested review from a team October 9, 2024 19:42
@MajorLift MajorLift changed the title chore: Update ruby install instructions in environment setup readme chore(docs): Update ruby install instructions in environment setup readme Oct 10, 2024
mikesposito
mikesposito previously approved these changes Oct 17, 2024
docs/readme/environment.md Outdated Show resolved Hide resolved
@joaoloureirop
Copy link
Contributor

It is expected that a MetaMask contributor picks a version manager of their choice, and follows the version manager documentation to install and configure it on their system.

rbenv is mentioned as an example of a ruby version manager

We should keep from being prescriptive on how to configure tools that are not maintained by us.

@MajorLift
Copy link
Contributor Author

MajorLift commented Oct 17, 2024

@joaoloureirop Would it help to add language emphasizing that the rbenv commands are examples? Or perhaps we could add more links to sections within the rbenv readme?

The primary target of this readme section probably isn't developers who have already set up ruby version managers themselves and don't need the instructions. Shouldn't it be a priority to unblock non-users of ruby by using the most obvious and unambiguous language possible?

@legobeat
Copy link
Contributor

legobeat commented Oct 17, 2024

FWIW there is also the option of the repository Dockerfile:

# build image with bundled node/ruby/etc
$ podman build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t localhost/mm-mobile-builder -f scripts/docker/Dockerfile .

# run shell in container
$ podman run --rm -it --user $(id -u):$(id -g) --userns=keep-id:uid=$(id -u),gid=$(id -g) -v "$(pwd)":/app -w /app -v ~/.yarn:/home/node/.yarn -v ~/.cache/yarn:/home/node/.cache/yarn mm-mobile-build:debian bash

# run ruby directly
$ podman run --rm -it --user $(id -u):$(id -g) --userns=keep-id:uid=$(id -u),gid=$(id -g) -v "$(pwd)":/app -w /app mm-mobile-build:debian ruby --version

(taken to the next level: https://github.com/legobeat/l7-devenv)

Shouldn't it be a priority to unblock non-users of ruby by using the most obvious and unambiguous language possible?

I think it should also be a priority to steer developers towards secure solution and setups they can control. (No shade on rbenv or using it the proposed way)

I do think there are risks with the approach, though, specifically considering the undeterministic mess that CocoaPods have become.. By steering towards a specific blessed setup, we kind of take responsibility for that being Good Enough.

So kind of agree with @joaoloureirop

Would it help to add language emphasizing that the rbenv commands are examples? Or perhaps we could add more links to sections within the rbenv readme?

Both sound like nice improvements to me!

@joaoloureirop
Copy link
Contributor

joaoloureirop commented Oct 18, 2024

@joaoloureirop Would it help to add language emphasizing that the rbenv commands are examples? Or perhaps we could add more links to sections within the rbenv readme?

We could expand this section to offer better guidance to new contributors unfamiliar with the tool.

The primary target of this readme section probably isn't developers who have already set up ruby version managers themselves and don't need the instructions. Shouldn't it be a priority to unblock non-users of ruby by using the most obvious and unambiguous language possible?

The concern is with new contributors getting familiar with this tool since it will require intervention every time our .ruby-version changes.

We want to help new contributors as much as possible, and in this case, the best help is redirecting them to the official documentation.

For example, if a new contributor decides to use the version manager mentioned in our docs they can follow the hyperlink provided and go through the installation guide, which is only two steps when using a package manager (brew install rbenv && rbenv init)

The most important part that is often overlooked is to set up the shell to load the version manager.

Down the road when intervention is needed (installing a new ruby version, rehashing, removing...), the official documentation is the best help they can get.

@MajorLift MajorLift force-pushed the jongsun/docs/241009-ruby-install-instructions branch from 6c506f6 to 7e51112 Compare October 18, 2024 14:25
@MajorLift MajorLift force-pushed the jongsun/docs/241009-ruby-install-instructions branch from 7e51112 to 385a936 Compare October 18, 2024 14:26
Comment on lines +24 to +33
It is recommended to install a ruby version manager, and use it to install the ruby version defined in the file `.ruby-version`.

Install ruby version defined in the file `.ruby-version`
For example, the following commands will [install `rbenv`](https://github.com/rbenv/rbenv?tab=readme-ov-file#installation) and use it to [install the configured ruby version](https://github.com/rbenv/rbenv#installing-ruby-versions):

```bash
brew install rbenv
rbenv init
rbenv install
rbenv local # if installation is successful, this will print the installed ruby version.
```
Copy link
Contributor Author

@MajorLift MajorLift Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaoloureirop @legobeat Thanks for the feedback! I understand the need to avoid endorsing a specific version manager, but feel like the reservations around providing instructions...

it will require intervention every time our .ruby-version changes.
Down the road when intervention is needed (installing a new ruby version, rehashing, removing...), the official documentation is the best help they can get.

... might apply to any external package we don't manage but provide instructions for in our readmes.

I attempted a rewrite but I'm not sure how well it addresses your concerns. If either of you have suggestions around adding stronger disclaimer language or editing/removing the additions I'd be happy to apply them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... might apply to any external package we don't manage but provide instructions for in our readmes.

Instructions should be provided in our readmes when the configuration differs from the default or when the official docs miss the installation/configuration guide.
Other than that, official docs should be the single source of truth.

the node version manager section is as vague as the ruby version manager section for the same reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the added value here that the official docs don't already provide?

Copy link
Contributor Author

@MajorLift MajorLift Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Providing immediate, explicit, unambiguous instructions would hopefully serve as a better first line of defense against troubleshooting threads like these, some of them quite huge:

If our internal developers (myself included) have this much trouble with the current instructions for this step I don't think the situation will be much better for external contributors.

In the end I guess this comes down to the question of what's a higher priority for a readme: being correct or being helpful.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.54%. Comparing base (b0ef1a7) to head (385a936).
Report is 52 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11714      +/-   ##
==========================================
+ Coverage   54.27%   54.54%   +0.27%     
==========================================
  Files        1711     1743      +32     
  Lines       38712    39317     +605     
  Branches     4738     4870     +132     
==========================================
+ Hits        21010    21446     +436     
- Misses      16253    16376     +123     
- Partials     1449     1495      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Oct 18, 2024

@MajorLift
Copy link
Contributor Author

Closing as wont-fix.

@MajorLift MajorLift closed this Nov 13, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 13, 2024
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-documentation No E2E Smoke Needed If the PR does not need E2E smoke test run No QA Needed Apply this label when your PR does not need any QA effort. team-wallet-framework
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants