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

Adjust setup to new Ruby and asdf #297

Merged
merged 2 commits into from
Mar 1, 2022
Merged

Adjust setup to new Ruby and asdf #297

merged 2 commits into from
Mar 1, 2022

Conversation

schmijos
Copy link
Member

No description provided.

@schmijos schmijos requested review from sihu, coorasse and a team February 28, 2022 14:41
@schmijos schmijos self-assigned this Feb 28, 2022
Comment on lines -12 to +9
* Run `gem install bundler` to install Bundler.
You may have it already installed, but this command will make sure that you have the latest version.
* Run `gem update --system` to update Ruby's default gems (e.g. `bundler`).
Copy link
Member Author

Choose a reason for hiding this comment

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

bundler is a default gem sind Ruby 2.6.0

Copy link
Member

@sihu sihu left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -19,14 +15,21 @@ You can do this with `gem update rails`. Beware of beta versions.
You may want to choose a different database from Postgres, but most of the time that will be your choice.
If you do not need a DB you may rethink the fact that you may not need Rails at all :) Take a look at [Sinatra](http://www.sinatrarb.com/) or [Angular](https://angular.io/)

* Switch your local Ruby to the fresh one: `asdf local ruby latest` to populate a `.tool-versions` file
and delete any `.ruby-version` or `.nvmrc` files generated by Rails.
Copy link
Member Author

Choose a reason for hiding this comment

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

Rails setups should not generate .nvmrc files. I still leave the hint.

* Load the Ruby version automatically in the fresh project's `Gemfile` by adding this:

```ruby File.read(File.join(__dir__, '.ruby-version'))```
```rb
ruby File.read(File.join(__dir__, '.tool-versions'))[/ruby\s(.*)/, 1].strip
Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about completely dropping this and replacing it by

ruby '~> 3.1.0'

since patch level updates never were a problem since Ruby 1.9.3. But I then thought, that we always want to go through the CI on a version change. So I now read the more complicated .tool-versions file.

Copy link
Member

Choose a reason for hiding this comment

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

If Heroku and Semaphore are ok, I am ok 👍

Copy link
Member

Choose a reason for hiding this comment

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

FYI, There'd also be a way to configure asdf to use the .ruby-version file:
https://github.com/asdf-vm/asdf-ruby#migrating-from-another-ruby-version-manager
Still using .ruby-version maybe is easier since Heroku etc. already know it (maybe they also look at .tool-versions, I haven't checked 🤷). But it would reduce the complexity of that line for sure

Copy link
Member Author

Choose a reason for hiding this comment

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

@lukasbischof the assumption that Heroku knows about it is wrong. Heroku looks at the Gemfile.

Copy link
Member

@coorasse coorasse left a comment

Choose a reason for hiding this comment

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

I have to be honest: switching away from standards "ruby-version" and "nvmrc" to go towards an asdf specific format, still does not convince me fully. I didn't find in the protocol why we decided in favour of that: https://docs.google.com/document/d/1kqig4ITDiSciXu6mGtIg8b0bUsqQXjNl8De6gu5Y3Hg/edit#heading=h.22jutnjr8ybt

Maybe we could have it documented there?

* Load the Ruby version automatically in the fresh project's `Gemfile` by adding this:

```ruby File.read(File.join(__dir__, '.ruby-version'))```
```rb
ruby File.read(File.join(__dir__, '.tool-versions'))[/ruby\s(.*)/, 1].strip
Copy link
Member

Choose a reason for hiding this comment

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

If Heroku and Semaphore are ok, I am ok 👍

@coorasse
Copy link
Member

coorasse commented Mar 1, 2022

Question: why not using asdf and keep the ruby-version and nvmrc files? 🤔

@schmijos
Copy link
Member Author

schmijos commented Mar 1, 2022

Question: why not using asdf and keep the ruby-version and nvmrc files? 🤔

Why would you not want to have a single file with all virtual env dependencies in it?

@schmijos
Copy link
Member Author

schmijos commented Mar 1, 2022

There are two arguments against using .tool-versions right now:

  • SemaphoreCI setup would need adjustment.
  • dependabot doesn't read it

So I roll-back this part. Still nothing speaks against using asdf.

@schmijos schmijos merged commit 14e5620 into master Mar 1, 2022
@schmijos schmijos deleted the asdf branch March 1, 2022 16:32
@rnestler
Copy link
Member

rnestler commented Mar 8, 2022

@schmijos @coorasse As part of looking into the CI cache issue we discussed in wg-engineering I'd also suggest to keep .ruby-version and set legacy_version_file = yes in ~/.asdfrc.

@coorasse
Copy link
Member

coorasse commented Mar 8, 2022

It's a bit annoying that they call it legacy. 😆

@rnestler
Copy link
Member

rnestler commented Mar 8, 2022

It's a bit annoying that they call it legacy. laughing

Yes it makes you feel bad for using it 😉

Edit: Rust had something similar: A lint called bad_style which then got an alias which is less insulting: rust-lang/rust#41646

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

Successfully merging this pull request may close these issues.

None yet

5 participants