Reputation: 318
I am working on a project that is adding a couple of features to a fragile and not well written Rails 2.3 app. I was trying to install just one gem, but I made a mistake when I ran 'gem install' and it updated 29 gems, including some of the Rails gems!
I know I can manually remove each new gem version, but I was wondering if there was an option to roll back the gem installation and undo all 29 updates. I am using rubygems 1.4.2 and do not have the option to upgrade.
Upvotes: 2
Views: 1072
Reputation: 6516
Had this accident today... I just had to write a short script to fix it:
#!/bin/sh
while read line; do
package=`echo $line | awk '{print $3}' | sed 's/\([a-z0-9_-]*\)-.*/\1/'`
version=`echo $line | awk '{print $3}' | sed 's/[a-z0-9_-]*-\(.*\)/\1/'`
gem uni $package -v $version
done < accident
accident
is just the output of the renegade install:
Successfully installed builder-3.0.0
Successfully installed activemodel-3.2.6
Successfully installed rack-1.4.1
Successfully installed rack-cache-1.2
Successfully installed rack-test-0.6.1
Upvotes: 1