Last active
June 16, 2022 01:24
-
-
Save juno/fe5a5886be16aa26fa96449c9a7886d5 to your computer and use it in GitHub Desktop.
Revisions
-
juno revised this gist
Jun 16, 2022 . No changes.There are no files selected for viewing
-
juno revised this gist
Jun 16, 2022 . No changes.There are no files selected for viewing
-
juno created this gist
Jun 16, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ ## Usage ```console $ asdf list ruby 2.7.4 2.7.5 2.7.6 3.0.3 3.1.2 3.2.0-preview1 $ update-rubygems-bundler ----> Start rubygems and bundler update Current Ruby version: 3.1.2 Target Ruby versions: 2.7.4, 2.7.5, 2.7.6, 3.0.3, 3.1.2, 3.2.0-preview1 ----> 2.7.4: Updating ruby gems and bundler Done. ----> 2.7.5: Updating ruby gems and bundler Done. ----> 2.7.6: Updating ruby gems and bundler Done. ----> 3.0.3: Updating ruby gems and bundler Done. ----> 3.1.2: Updating ruby gems and bundler Done. ----> 3.2.0-preview1: Updating ruby gems and bundler Done. ``` that's all. 🎉 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/usr/bin/env ruby require "shellwords" puts "----> Start rubygems and bundler update" # store current ruby version current_version = `asdf current ruby | cut -w -f 2`.strip puts " Current Ruby version: #{current_version}" # update rubygems and bundler for each installed versions versions = `asdf list ruby`.split("\n").map(&:strip) puts " Target Ruby versions: #{versions.join(", ")}" versions.each do |version| puts "----> #{version}: Updating ruby gems and bundler" `asdf global ruby #{version.shellescape}` `gem update --system` puts " Done." end # restore ruby version `asdf global ruby #{current_version.shellescape}`