Exception: Berkshelf::MismatchedCookbookName

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

Instance Method Summary collapse

Methods inherited from BerkshelfError

status_code

Constructor Details

#initialize(location, cached_cookbook) ⇒ MismatchedCookbookName

Returns a new instance of MismatchedCookbookName.

Parameters:



151
152
153
154
# File 'lib/berkshelf/errors.rb', line 151

def initialize(location, cached_cookbook)
  @location = location
  @cached_cookbook = cached_cookbook
end

Instance Method Details

#to_sObject



156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/berkshelf/errors.rb', line 156

def to_s
  [
    "In your Berksfile, you have:",
    "",
    "  cookbook '#{@location.name}'",
    "",
    "But that cookbook is actually named '#{@cached_cookbook.cookbook_name}'",
    "",
    "This can cause potentially unwanted side-effects in the future",
    "",
    "NOTE: If you don't explicitly set the `name` attribute in the metadata, the name of the directory will be used!",
  ].join("\n")
end