Exception: Berkshelf::MismatchedCookbookName

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

Instance Method Summary collapse

Methods inherited from BerkshelfError

set_status_code

Constructor Details

#initialize(dependency, cached_cookbook) ⇒ MismatchedCookbookName

Returns a new instance of MismatchedCookbookName.

Parameters:

  • dependency (Dependency)

    the dependency with the expected name

  • cached_cookbook (CachedCookbook)

    the cached_cookbook with the mismatched name


120
121
122
123
# File 'lib/berkshelf/errors.rb', line 120

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

Instance Method Details

#to_sObject


125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/berkshelf/errors.rb', line 125

def to_s
  out =  "In your Berksfile, you have:\n"
  out << "\n"
  out << "  cookbook '#{@dependency.name}'\n"
  out << "\n"
  out << "But that cookbook is actually named '#{@cached_cookbook.cookbook_name}'\n"
  out << "\n"
  out << "This can cause potentially unwanted side-effects in the future.\n"
  out << "\n"
  out << "NOTE: If you do not explicitly set the 'name' attribute in the "
  out << "metadata, the name of the directory will be used instead. This "
  out << "is often a cause of confusion for dependency solving."
  out
end