Created
July 26, 2019 16:46
-
-
Save damiann/f4659633578af31303982724e658cf3d to your computer and use it in GitHub Desktop.
Install missing gems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def install_missing_gems(&block) | |
yield | |
rescue LoadError => e | |
gem_name = e.message.split('--').last.strip | |
install_command = 'gem install ' + gem_name | |
system(install_command) or exit(1) | |
Gem.clear_paths | |
require gem_name | |
retry | |
end | |
install_missing_gems do | |
require 'ffi-icu' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment