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

Upgrade Ruby versions in ruby Gemfile guide. #1439

Merged
merged 1 commit into from
Jan 23, 2025
Merged
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
14 changes: 8 additions & 6 deletions source/guides/gemfile_ruby.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ ruby 'RUBY_VERSION', :engine => 'ENGINE', :engine_version => 'ENGINE_VERSION',
:patchlevel => 'RUBY_PATCHLEVEL'
~~~

If you wanted to use JRuby 1.6.7 using Ruby 1.9.3, you would simply do the following:
If you wanted to use JRuby 9.4.10.0 using Ruby 3.1.4, you would simply do the following:

~~~ruby
ruby '1.9.3', :engine => 'jruby', :engine_version => '1.6.7'
ruby '3.1.4', :engine => 'jruby', :engine_version => '9.4.10.0'
~~~

It's also possible to restrict the patchlevel of the Ruby used by doing the following:

~~~ruby
ruby '1.9.3', :patchlevel => '448'
ruby '3.3.6', :patchlevel => '108'
~~~

If you wish to derive your Ruby version from a version file (i.e. `.ruby-version`),
Expand All @@ -35,12 +35,14 @@ ruby file: ".ruby-version"
The version file should conform to any of the following formats:

- `3.1.2` (`.ruby-version`)
- `ruby-3.1.2` (`.ruby-version`)
- `ruby 3.1.2` ([`.tool-versions`](https://asdf-vm.com/manage/configuration.html#tool-versions))
- `ruby = '3.1.2'` ([`mise.toml`](https://mise.jdx.dev/dev-tools/))

Bundler will make checks against the current running Ruby VM to make sure it matches what is specified in the `Gemfile`. If things don't match, Bundler will raise an Exception explaining what doesn't match.

~~~
Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3
Your Ruby version is 3.3.7, but your Gemfile specified 3.4.1
~~~

Both `:engine` and `:engine_version` are optional.
Expand All @@ -49,7 +51,7 @@ When `:engine` is used, `:engine_version` must also be specified.
Using the `platform` command with the `--ruby` flag, you can see what `ruby` directive is specified in the `Gemfile`.

~~~
ruby 1.9.3 (jruby 1.6.7)
ruby 3.1.4p0 (jruby 9.4.10.0)
~~~

<a href="/man/bundle-platform.1.html" class="btn btn-primary">Learn More: bundle platform</a>
Expand All @@ -60,7 +62,7 @@ Version operators for specifying a Ruby version are also available.
The set of supported version operators is that of Rubygems (`gem` version operators). (ie. `<`, `>`, `<=`, `>=`, `~>`, `=`)

~~~ruby
ruby '~> 2.3.0'
ruby '~> 3.3.0'
~~~

<a href="https://guides.rubygems.org/patterns/#declaring-dependencies" class="btn btn-primary">Learn More: Version Operators</a>