Skip to content

Instantly share code, notes, and snippets.

@benr75
Created July 19, 2011 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benr75/1093222 to your computer and use it in GitHub Desktop.
Save benr75/1093222 to your computer and use it in GitHub Desktop.
Create gem install command list (not mine found it somewhere on the internet)
#!/usr/bin/perl -w
# We're strict
use strict;
# Get list of installed gems
my @gems = qx(gem list);
chomp(@gems);
# Create commands
foreach my $gem (@gems)
{
# Match gem and versions
$gem =~ m/(\S+)\s\((.+)\)/i;
# Gem name
$gem = $1;
# Save them into array
my @gem_versions = split(/,/, $2);
# Print out commands
foreach (@gem_versions)
{
# Remove all whitespaces
$_ =~ s/^\s+//;
print "sudo gem install $gem --version=$_ --no-ri --no-rdoc\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment