Module Listen::DependencyManager
In: lib/listen/dependency_manager.rb

The dependency-manager offers a simple DSL which allows classes to declare their gem dependencies and load them when needed. It raises a user-friendly exception when the dependencies can‘t be loaded which has the install command in the message.

Methods

Classes and Modules

Class Listen::DependencyManager::Error

Constants

GEM_LOAD_MESSAGE = <<-EOS.gsub(/^ {6}/, '') Missing dependency '%s' (version '%s')! EOS .gsub(/^ {6}/, '')
GEM_INSTALL_COMMAND = <<-EOS.gsub(/^ {6}/, '') Please run the following to satisfy the dependency: gem install --version '%s' %s EOS .gsub(/^ {6}/, '')
BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '') Please add the following to your Gemfile to satisfy the dependency: gem '%s', '%s' EOS .gsub(/^ {6}/, '')
Dependency = Struct.new(:name, :version)

Public Class methods

Adds a loaded dependency to a list so that it doesn‘t have to be loaded again by another classes.

@param [Dependency] dependency

Returns whether the dependency is alread loaded or not.

@param [Dependency] dependency @return [Boolean]

Clears the list of loaded dependencies.

Initializes the extended class.

@param [Class] the class for which some dependencies must be managed

Public Instance methods

Returns whether all the dependencies has been loaded or not.

@return [Boolean]

Registers a new dependency.

@param [String] name the name of the gem @param [String] version the version of the gem

Loads the registered dependencies.

@raise DependencyManager::Error if the dependency can‘t be loaded.

[Validate]