Created
March 21, 2018 14:23
-
-
Save ideasasylum/3a29d6c016ba4f98e454345f7df10012 to your computer and use it in GitHub Desktop.
Stupid rake task to randomly pick one outdated gem
This file contains 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 characters
require 'open3' | |
require 'rainbow' | |
desc "Upgrade gems" | |
namespace :upgrade do | |
desc "Find a random gem to update" | |
task :bingo => :environment do | |
cmd = 'bundle outdated' | |
stdout, stderr, status = Open3.capture3(cmd) | |
outdated_gem = stdout.lines.grep(/ \* .*/).sample | |
gemname = outdated_gem.match(/ \* (\w*).*/)[1] | |
puts Rainbow("Selecting a dirty old gem for you to polish...") | |
puts Rainbow("1. Create a branch called upgrade-#{gemname}") | |
puts Rainbow("2. Find the Github page for #{gemname} and read the CHANGELOG") | |
puts Rainbow('3. Update the gem to the highest version possible without upgrading Ruby or Rails') | |
puts Rainbow(" bundle update #{gemname}").green | |
puts Rainbow('4. Update any required gems') | |
puts Rainbow('5. Merge into staging once the specs pass') | |
puts Rainbow("6. If, at #{(Time.now + 30.minutes).strftime('%H %M')} the specs still aren\'t passing, write it up in Trello").yellow | |
puts Rainbow('=================================================').red | |
print Rainbow(outdated_gem.to_s).red | |
puts Rainbow('=================================================').red | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment