Class: Checkup::Dependency
- Inherits:
-
Object
- Object
- Checkup::Dependency
- Defined in:
- lib/checkup/dependency.rb
Overview
Small dependency loader, so we don’t have to require all possible gems in the Gemfile
Class Method Summary collapse
Class Method Details
.all ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/checkup/dependency.rb', line 6 def self.all @all ||= { 'mail' => { :require => 'mail', :version => '>= 2.4.0', :for => 'Sending Emails (Mail Notifier)' }, 'httparty' => { :require => 'httparty', :version => '>= 0', :for => 'Http up check' } } end |
.load(name) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/checkup/dependency.rb', line 21 def self.load (name) begin gem(name, all[name][:version]) require(all[name][:require]) rescue LoadError Logger.error Errors::Dependency::LoadError.new(<<-EOS) Dependency missing Dependency required for: #{all[name][:for]} To install the gem, issue the following command: > gem install #{name} -v '#{all[name][:version]}' Please try again after installing the missing dependency. EOS exit 1 end end |