1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add List All Installable Rails Versions as a Rails til

This commit is contained in:
jbranchaud
2021-01-03 14:24:46 -06:00
parent e06e35ab4b
commit 72604a7ebb
2 changed files with 30 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
_992 TILs and counting..._
_993 TILs and counting..._
---
@@ -625,6 +625,7 @@ _992 TILs and counting..._
- [Hash Slicing](rails/hash-slicing.md)
- [Ignore Poltergeist JavaScript Errors](rails/ignore-poltergeist-javascript-errors.md)
- [Inspect Previous Changes To ActiveRecord Object](rails/inspect-previous-changes-to-activerecord-object.md)
- [List All Installable Rails Versions](rails/list-all-installable-rails-versions.md)
- [List The Enqueued Jobs](rails/list-the-enqueued-jobs.md)
- [Log SQL Queries Executed By ActiveRecord](rails/log-sql-queries-executed-by-activerecord.md)
- [Mark A Migration As Irreversible](rails/mark-a-migration-as-irreversible.md)

View File

@@ -0,0 +1,28 @@
# List All Installable Rails Versions
_Here's a [screencast](https://www.youtube.com/watch?v=IizkvqGLkhU) in case you
want to watch instead of read._
I [was curious](https://twitter.com/jbrancha/status/1345467867479875584?s=20)
what versions of Rails were remotely available to be installed with `gem`. On
its own, `gem list rails` will show all _locally_ installed gems that
partially match `rails`. That'll include gems like `rspec-rails` and
`sprockets-rails`.
First, the `--exact` flag can be added to narrow down the results to an exact
match of `rails`.
Then, the `--remote` flag can be included to request `gem` look for remote
versions. That is, versions available on the rubygems server.
Lastly, the `--all` flag can be included to fetch all versions instead of only
the latest version.
Putting it all together:
```bash
$ gem list rails --exact --remote --all
rails (6.1.0, 6.0.3.4, 6.0.3.3, ... 0.9.0, 0.8.5, 0.8.0)
```
[source](https://stackoverflow.com/a/9146057/535590)