Skip to content

Instantly share code, notes, and snippets.

Created June 25, 2013 00:52
Show Gist options
  • Save anonymous/5855048 to your computer and use it in GitHub Desktop.
Save anonymous/5855048 to your computer and use it in GitHub Desktop.
batch install missing packages reported by `bundle package`
# batch install missing packages reported by `bundle package`
# When `bundle package', it might complain: "Could not find charlock_holmes-0.6.9.1.gem for installation",
# You have to run `gem install charlock_holmes -v 0.6.9.1' and run `bundle package` again
# And it might complain another package missing, then you have to run `gem install foobar -v xxxxx`
# Again, and again. Thus I have this little script
while true; do
result=`bundle package | grep "^Could not find"`
if [ "foo$result" == foo ]; then
break
fi
gem=`echo "$result" | cut -d" " -f 4`
pkg=`echo $gem | sed 's/-[0-9].*//'`
ver=`echo $gem | sed 's/.*-//'| sed 's/.gem//'`
echo gem install $pkg -v $ver
gem install $pkg -v $ver
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment