Last active
October 5, 2016 08:39
-
-
Save renier/5d8db4d7c1995fcab5b0 to your computer and use it in GitHub Desktop.
libraries/helpers.rb
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
module GemHelper | |
GEMS = [{ name: 'my_gem', version: '~> 0.0.2' }] | |
def self.install_dependencies | |
GemHelper::GEMS.each do |gem| | |
version = Gem::Requirement.create gem[:version] | |
installed = Gem::Specification.each.any? do |spec| | |
gem[:name] == spec.name && version.satisfied_by?(spec.version) | |
end | |
next if installed | |
Gem::DependencyInstaller.new.install gem[:name], version | |
end | |
end | |
end | |
Gem.sources << 'https://my.additional.ruby.server.com/' | |
GemHelper.install_dependencies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment