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
# ___ ___ ___ ___ ___ ___ ___ ___ | |
# /\ \ /\ \ /\__\ /\ \ /\ \ /\ \ /\__\ |\__\ | |
# /::\ \ /::\ \ /::| | /::\ \ /::\ \ /::\ \ /:/ / |:| | | |
# /:/\:\ \ /:/\:\ \ /:|:| | /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/ / |:| | | |
# /:/ \:\ \ /::\~\:\ \ /:/|:|__|__ /::\~\:\ \ /::\~\:\ \ /:/ \:\__\ /:/ / ___ |:|__|__ | |
# /:/__/_\:\__/:/\:\ \:\__/:/ |::::\__\ /:/\:\ \:\__/:/\:\ \:\__/:/__/ \:|__/:/__/ /\______/::::\__\ | |
# \:\ /\ \/__\:\~\:\ \/__\/__/~~/:/ / \/_|::\/:/ \:\~\:\ \/__\:\ \ /:/ \:\ \ /:/ \::::/~~/~ | |
# \:\ \:\__\ \:\ \:\__\ /:/ / |:|::/ / \:\ \:\__\ \:\ /:/ / \:\ /:/ / ~~|:|~~| | |
# \:\/:/ / \:\ \/__/ /:/ / |:|\/__/ \:\ \/__/ \:\/:/ / \:\/:/ / |:| | | |
# \::/ / \:\__\ /:/ / |:| | \:\__\ \::/__/ \::/ / |:| | | |
# \/__/ \/__/ \/__/ \|__| \/__/ ~~ \/__/ \|__| | |
# | |
# Simple script to remove all installed gems | |
# without having to type gem uninstall 'gem_name' | |
# for each one of them | |
# | |
# Usage: | |
# gem list | ruby remove_all_gems.rb | |
# | |
# Notes: | |
# you might get some warning in the form of cannot | |
# remove default gem | |
ARGF.readlines[1..-1].each do |line| | |
gem = line.split(' ') | |
puts "Trying to remove #{gem[0]}" | |
output = `gem uninstall --executables --all --force #{gem[0].gsub(/\(|\)/, "")} 2>&1` | |
puts output unless (output.to_s =~ /because it is a default gem/) | |
end | |
puts "Gems removed / check status with gem list" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment