# class Puppet::ModuleTool::Errors::NoVersionsSatisfyError

### Public Class Methods

new(options) click to toggle source
Calls superclass method Puppet::Error.new

    # File lib/puppet/module_tool/errors/shared.rb, line 4
    def initialize(options)
      @requested_name    = options[:requested_name]
      @requested_version = options[:requested_version]
      @installed_version = options[:installed_version]
      @dependency_name   = options[:dependency_name]
      @conditions        = options[:conditions]
      @action            = options[:action]

      super "Could not #{@action} '#{@requested_name}' (#{vstring}); module '#{@dependency_name}' cannot satisfy dependencies"
    end

### Public Instance Methods

multiline() click to toggle source

    # File lib/puppet/module_tool/errors/shared.rb, line 15
    def multiline
      same_mod = @requested_name == @dependency_name

      message = []
      message << "Could not #{@action} module '#{@requested_name}' (#{vstring})"
      message << "  No version of '#{@dependency_name}' will satisfy dependencies"
      message << "    You specified '#{@requested_name}' (#{v(@requested_version)})" if same_mod
      message += @conditions.select { |c| c[:module] != :you }.sort_by { |c| c[:module] }.map do |c|
        "    '#{c[:module]}' (#{v(c[:version])}) requires '#{@dependency_name}' (#{v(c[:dependency])})"
      end
      message << "    Use `puppet module #{@action} --force` to #{@action} this module anyway" if same_mod
      message << "    Use `puppet module #{@action} --ignore-dependencies` to #{@action} only this module" unless same_mod

      message.join("\n")
    end