Last active
May 1, 2018 20:10
-
-
Save mattolenik/472a24907d9181b809bfcf382b7edc7c to your computer and use it in GitHub Desktop.
Install and use a new gem inside a Vagrantfile
This file contains 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
gem_dir = "#{Dir.home}/.vagrant.d/gems/#{RUBY_VERSION}" | |
begin | |
name = "inifile" | |
version = "3.0.0" | |
Gem::Specification.find_by_name(name, version) | |
rescue Gem::LoadError | |
require "rubygems/dependency_installer" | |
installer = Gem::DependencyInstaller.new(:document => [], :install_dir => gem_dir) | |
installer.install(name, version) | |
end | |
require "#{gem_dir}/gems/#{name}-#{version}/lib/#{name}.rb" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment