Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Better "not a cookbook" errors #566

Merged
merged 2 commits into from
Oct 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chef-dk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Gem::Specification.new do |gem|

gem.add_dependency "solve", "~> 2.0", ">= 2.0.1"

gem.add_dependency "cookbook-omnifetch", "~> 0.2"
gem.add_dependency "cookbook-omnifetch", "~> 0.2", ">= 0.2.2"

gem.add_dependency "diff-lcs", "~> 1.0"
gem.add_dependency "paint", "~> 1.0"
Expand Down
8 changes: 8 additions & 0 deletions lib/chef-dk/policyfile/cookbook_location_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ def ==(other)
other.source_options == source_options
end

def to_s
# Note, this may appear in exceptions
s = "Cookbook '#{name}'"
s << " #{version_constraint}"
s << " #{source_options}" unless source_options.empty?
s
end

def mirrors_canonical_upstream?
[:git, :github, :artifactserver].include?(source_type)
end
Expand Down
5 changes: 5 additions & 0 deletions spec/unit/policyfile/cookbook_location_specification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
expect(cookbook_location_spec.source_options_for_lock).to eq(lock_data)
end

it "converts to a readable string with all relevant info" do
expected_s = "Cookbook 'my_cookbook' >= 0.0.0"
expect(cookbook_location_spec.to_s).to eq(expected_s)
end

describe "fetching and querying a cookbook" do

before do
Expand Down