Skip to content

Instantly share code, notes, and snippets.

@bamanzi
Forked from anonymous/bundle-package-fix-missing.sh
Last active December 18, 2015 22:29
Show Gist options
  • Save bamanzi/5855068 to your computer and use it in GitHub Desktop.
Save bamanzi/5855068 to your computer and use it in GitHub Desktop.
# 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
# Note: it would fail on packages like 'libv8-3.11.8.13-x86_64-linux.gem', which you can handle it manually
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