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


179
180
181
# File 'lib/berkshelf/errors.rb', line 179

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

Instance Method Details

#to_sObject


183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/berkshelf/errors.rb', line 183

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