Skip to content

Commit 72604a7

Browse files
committed
Add List All Installable Rails Versions as a Rails til
1 parent e06e35a commit 72604a7

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
1212

13-
_992 TILs and counting..._
13+
_993 TILs and counting..._
1414

1515
---
1616

@@ -625,6 +625,7 @@ _992 TILs and counting..._
625625
- [Hash Slicing](rails/hash-slicing.md)
626626
- [Ignore Poltergeist JavaScript Errors](rails/ignore-poltergeist-javascript-errors.md)
627627
- [Inspect Previous Changes To ActiveRecord Object](rails/inspect-previous-changes-to-activerecord-object.md)
628+
- [List All Installable Rails Versions](rails/list-all-installable-rails-versions.md)
628629
- [List The Enqueued Jobs](rails/list-the-enqueued-jobs.md)
629630
- [Log SQL Queries Executed By ActiveRecord](rails/log-sql-queries-executed-by-activerecord.md)
630631
- [Mark A Migration As Irreversible](rails/mark-a-migration-as-irreversible.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# List All Installable Rails Versions
2+
3+
_Here's a [screencast](https://www.youtube.com/watch?v=IizkvqGLkhU) in case you
4+
want to watch instead of read._
5+
6+
I [was curious](https://twitter.com/jbrancha/status/1345467867479875584?s=20)
7+
what versions of Rails were remotely available to be installed with `gem`. On
8+
its own, `gem list rails` will show all _locally_ installed gems that
9+
partially match `rails`. That'll include gems like `rspec-rails` and
10+
`sprockets-rails`.
11+
12+
First, the `--exact` flag can be added to narrow down the results to an exact
13+
match of `rails`.
14+
15+
Then, the `--remote` flag can be included to request `gem` look for remote
16+
versions. That is, versions available on the rubygems server.
17+
18+
Lastly, the `--all` flag can be included to fetch all versions instead of only
19+
the latest version.
20+
21+
Putting it all together:
22+
23+
```bash
24+
$ gem list rails --exact --remote --all
25+
rails (6.1.0, 6.0.3.4, 6.0.3.3, ... 0.9.0, 0.8.5, 0.8.0)
26+
```
27+
28+
[source](https://stackoverflow.com/a/9146057/535590)

0 commit comments

Comments
 (0)