Skip to content

Commit

Permalink
Use full path to load .ruby-version in Gemfile (#6748)
Browse files Browse the repository at this point in the history
Some tools (in my case it's the VS Code Ruby extension) attempt to load the `Gemfile` when running in directories other than the project root. When this happens, `Gemfile` can't load `.ruby-version`, since it's not in the directory it's expecting. This leads to errors from tools complaining about missing `.ruby-version` files. 

This commit updates the `Gemfile` to always explicitly load `.ruby-version` from the same directory `Gemfile` is in.

[skip changelog]
  • Loading branch information
matthinz committed Aug 15, 2022
1 parent f72ee7f commit f7eab89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }

ruby "~> #{File.read('.ruby-version').strip}"
ruby "~> #{File.read(File.join(__dir__, '.ruby-version')).strip}"

gem 'rails', '~> 7.0.0'

Expand Down

0 comments on commit f7eab89

Please sign in to comment.