Module: Toys::StandardMixins::Gems::ClassMethods

Defined in:
lib/toys/standard_mixins/gems.rb

Overview

This module extends the tool class when you include the Gems mixin, so that the gems and gem directives defined in this module are available.

Instance Method Summary collapse

Instance Method Details

#gem(name, *requirements, **options) ⇒ :activated, ...

Activate the given gem. If it is not present, attempt to install it (or inform the user to update the bundle).

Parameters:

  • name (String)

    Name of the gem

  • requirements (String...)

    Version requirements

  • options (keywords)

    Additional options to pass to the Utils::Gems constructor

Returns:

  • (:activated)

    if the gem was activated

  • (:installed)

    if the gem was installed and activated

  • (false)

    if the gem had already been activated

Raises:

  • (ActivationFailedError)

    if activation or install failed



115
116
117
# File 'lib/toys/standard_mixins/gems.rb', line 115

def gem(name, *requirements, **options)
  gems.with(**options).activate(name, *requirements)
end

#gemsToys::Utils::Gems

Returns a tool-wide instance of Utils::Gems.

Returns:



96
97
98
# File 'lib/toys/standard_mixins/gems.rb', line 96

def gems
  @__default_gems_util
end