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



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

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

Instance Method Details

#to_sObject Also known as: message



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

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