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

Update "Ruby gems" article with aliases #99

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions content/authors/authors.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,9 @@
"Anjali Goyal": {
"avatar": "anjali_goyal.jpg",
"role": "Senior QA Engineer - Customer Success"
},
"Nathan Wong": {
"avatar": "nathan.jpg",
"role": "Principal Mobile Engineer - R&D"
}
}
Binary file added content/authors/avatars/nathan.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 37 additions & 6 deletions content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![](assets/the_better_way_ruby_gems.png)

Authors: Arthur Alves
Authors: Arthur Alves, Nathan Wong

Check warning on line 7 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L7

[Google.Colons] ': A' should be in lowercase.
Raw output
{"message": "[Google.Colons] ': A' should be in lowercase.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 7, "column": 8}}}, "severity": "WARNING"}
Date: 2023-09-29
Category: mobile

Expand All @@ -31,7 +31,7 @@

**_Versions specified here are illustrative. Choose your versions carefully in accordance with your team._**

#### **1.** Multiple Ruby versions.
### 1. Multiple Ruby versions.

Check warning on line 34 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L34

[Google.Headings] '1. Multiple Ruby versions.' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] '1. Multiple Ruby versions.' should use sentence-style capitalization.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 34, "column": 5}}}, "severity": "WARNING"}

Check warning on line 34 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L34

[Google.HeadingPunctuation] Don't put a period at the end of a heading.
Raw output
{"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 34, "column": 5}}}, "severity": "WARNING"}

Check warning on line 34 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L34

[write-good.TooWordy] 'Multiple' is too wordy.
Raw output
{"message": "[write-good.TooWordy] 'Multiple' is too wordy.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 34, "column": 8}}}, "severity": "WARNING"}

Check warning on line 34 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L34

[Google.HeadingPunctuation] Don't put a period at the end of a heading.
Raw output
{"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 34, "column": 29}}}, "severity": "WARNING"}

**1.1** Install RBENV

Expand Down Expand Up @@ -123,7 +123,7 @@

**_Later, if you want to change the version, make sure it’s installed with `rbenv` and run the `local` command again, i.e: `rbenv local 3.1.2`._**

#### **2.** Using Ruby Gems.
### 2. Using Ruby Gems.

Check warning on line 126 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L126

[Google.Headings] '2. Using Ruby Gems.' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] '2. Using Ruby Gems.' should use sentence-style capitalization.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 126, "column": 5}}}, "severity": "WARNING"}

Check warning on line 126 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L126

[Google.HeadingPunctuation] Don't put a period at the end of a heading.
Raw output
{"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 126, "column": 5}}}, "severity": "WARNING"}

Check warning on line 126 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L126

[Google.HeadingPunctuation] Don't put a period at the end of a heading.
Raw output
{"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 126, "column": 22}}}, "severity": "WARNING"}

You’ve managed to have multiple versions of Ruby and set different versions for different repositories. Now, we’re set to use Ruby Gems.

Expand Down Expand Up @@ -165,7 +165,7 @@
**_`Gemfile.lock` should also be committed._**


##### **3.** Running your tools.
### 3. Running your tools.

Check warning on line 168 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L168

[Google.HeadingPunctuation] Don't put a period at the end of a heading.
Raw output
{"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 168, "column": 5}}}, "severity": "WARNING"}

Check warning on line 168 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L168

[Google.HeadingPunctuation] Don't put a period at the end of a heading.
Raw output
{"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 168, "column": 25}}}, "severity": "WARNING"}

By now your project has a locked version of Ruby, which everyone can install without conflicting with other setups/projects. And you have most of the tools you need, such as Cocoapods and Fastlane, installed in a similar manner, as Ruby Gems.

Expand All @@ -185,7 +185,6 @@
bundle exec fastlane <YOUR-LANE>
```

--

You can make this easier by creating an alias in your `~/.zshrc` or `~/.bashrc` file:

Expand All @@ -198,4 +197,36 @@
```bash
bx pod install
bx fastlane <YOUR-LANE>
```
```

## Using Ruby aliases

Check warning on line 202 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L202

[Google.Headings] 'Using Ruby aliases' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Using Ruby aliases' should use sentence-style capitalization.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 202, "column": 4}}}, "severity": "WARNING"}

When aligning Ruby versions across a team, or with a CI platform that you don't have full control over,
using explicit versions in the `.ruby-version` file may result in unexpected build failures.

One way to mitigate this is by configuring version aliases. An aliased version allows us to specify a minor

Check warning on line 207 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L207

[Google.We] Try to avoid using first-person plural like 'us'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'us'.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 207, "column": 87}}}, "severity": "WARNING"}
version in the `.ruby-version` file (eg. `3.2`) - then each engineer's machine would define an alias from
this version to the patch version that they have installed locally (`3.2.1`, `3.2.2` or `3.2.3`).

Aliases can be configured on a machine by using the [rbenv-aliases](https://github.com/tpope/rbenv-aliases) plugin for rbenv.

Check warning on line 211 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L211

[write-good.Passive] 'be configured' may be passive voice. Use active voice if you can.
Raw output
{"message": "[write-good.Passive] 'be configured' may be passive voice. Use active voice if you can.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 211, "column": 13}}}, "severity": "WARNING"}

```
mkdir -p "$(rbenv root)/plugins"
git clone https://github.com/tpope/rbenv-aliases.git \
"$(rbenv root)/plugins/rbenv-aliases"
rbenv alias --auto
```

This will automatically configure aliases for each minor version to the most recent patch version, and

Check warning on line 220 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L220

[Google.Will] Avoid using 'will'.
Raw output
{"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 220, "column": 6}}}, "severity": "WARNING"}
update `rbenv` so that future installed versions will update any aliases where appropriate.

Check warning on line 221 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L221

[Google.Will] Avoid using 'will'.
Raw output
{"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 221, "column": 50}}}, "severity": "WARNING"}

You can then update the `.ruby-version` file with the aliased version:

```
rbenv local 3.2
```

There are some negatives to this approach: by not pinning specific versions, we may start to observe different

Check failure on line 229 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L229

[write-good.ThereIs] Don't start a sentence with 'There are'.
Raw output
{"message": "[write-good.ThereIs] Don't start a sentence with 'There are'.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 229, "column": 1}}}, "severity": "ERROR"}

Check warning on line 229 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L229

[Google.We] Try to avoid using first-person plural like 'we'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'we'.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 229, "column": 78}}}, "severity": "WARNING"}
behaviour if aliasing to different ruby versions on different machines. Using the command `rbenv install` will

Check warning on line 230 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L230

[Google.Will] Avoid using 'will'.
Raw output
{"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 230, "column": 107}}}, "severity": "WARNING"}
also no longer work when `.ruby-version` points to an aliased version - it's necessary to explicitly
provide the Ruby version that should be installed.

Check warning on line 232 in content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md#L232

[write-good.Passive] 'be installed' may be passive voice. Use active voice if you can.
Raw output
{"message": "[write-good.Passive] 'be installed' may be passive voice. Use active voice if you can.", "location": {"path": "content/posts/2023/09/29/the-better-way-with-ruby-gems/post.md", "range": {"start": {"line": 232, "column": 38}}}, "severity": "WARNING"}
Loading