Skip to content

Instantly share code, notes, and snippets.

@cymen
Created June 10, 2012 06:08
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 cymen/2904087 to your computer and use it in GitHub Desktop.
Save cymen/2904087 to your computer and use it in GitHub Desktop.
#!/usr/bin/php -q
<?php
$list = shell_exec("gem list");
foreach (split("\n", $list) as $line)
{
$entries = split(" ", $line);
$program = $entries[0];
if (strlen($program) == 0)
continue;
$versions = split(",", substr($line, strpos($line, "(") + 1, strpos($line, ")") - (strpos($line, "(") + 1)));
foreach ($versions as $version)
{
$version = trim($version);
echo "gem install $program -v $version", "\n";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment