Exception: Berkshelf::DependencyNotFound

Inherits:
BerkshelfError show all
Defined in:
lib/berkshelf/errors.rb

Instance Method Summary collapse

Methods inherited from BerkshelfError

set_status_code

Constructor Details

#initialize(names) ⇒ DependencyNotFound

Returns a new instance of DependencyNotFound.

Parameters:

  • names (String, Array<String>)

    the list of cookbook names that were not defined



196
197
198
# File 'lib/berkshelf/errors.rb', line 196

def initialize(names)
  @names = Array(names)
end

Instance Method Details

#to_sObject Also known as: message



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/berkshelf/errors.rb', line 200

def to_s
  if @names.size == 1
    "Dependency '#{@names.first}' was not found. Please make sure it is " \
    "in your Berksfile, and then run `berks install` to download and " \
    "install the missing dependencies."
  else
    out = "The following dependencies were not found:\n"
    @names.each do |name|
      out << "  * #{name}\n"
    end
    out << "\n"
    out << "Please make sure they are in your Berksfile, and then run "
    out << "`berks install` to download and install the missing "
    out << "dependencies."
    out
  end
end