From 72604a7ebb0a77c1af46c4f52a6ebb626d1f8cb8 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sun, 3 Jan 2021 14:24:46 -0600 Subject: [PATCH] Add List All Installable Rails Versions as a Rails til --- README.md | 3 ++- rails/list-all-installable-rails-versions.md | 28 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 rails/list-all-installable-rails-versions.md diff --git a/README.md b/README.md index f0e3927..fed73f5 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/rails/list-all-installable-rails-versions.md b/rails/list-all-installable-rails-versions.md new file mode 100644 index 0000000..658f154 --- /dev/null +++ b/rails/list-all-installable-rails-versions.md @@ -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)