diff --git a/lib/chef/taste/cli.rb b/lib/chef/taste/cli.rb index df11257..65e40e7 100644 --- a/lib/chef/taste/cli.rb +++ b/lib/chef/taste/cli.rb @@ -38,6 +38,8 @@ class Cli < Thor def check dependencies = DependencyChecker.check Display.print(dependencies) + rescue NotACookbookError + puts "The path is not a cookbook path".red end end end diff --git a/lib/chef/taste/dependency_checker.rb b/lib/chef/taste/dependency_checker.rb index 8d7523b..3d456ba 100644 --- a/lib/chef/taste/dependency_checker.rb +++ b/lib/chef/taste/dependency_checker.rb @@ -40,7 +40,7 @@ class << self # @raise NotACookbook the current/given path is not a cookbook # def check(path = Dir.pwd) - raise NotACookbook, "Path is not a cookbook" unless File.exists?(File.join(path, 'metadata.rb')) + raise NotACookbookError, "Path is not a cookbook" unless File.exists?(File.join(path, 'metadata.rb')) ridley = Ridley::Chef::Cookbook::Metadata.from_file(File.join(path, 'metadata.rb')) dependencies = ridley.dependencies.map do |name, version| diff --git a/lib/chef/taste/errors.rb b/lib/chef/taste/errors.rb index 188f7ed..002fa2b 100644 --- a/lib/chef/taste/errors.rb +++ b/lib/chef/taste/errors.rb @@ -27,6 +27,6 @@ module Chef module Taste # The current/given path is not a cookbook # - class NotACookbook < StandardError; end + class NotACookbookError < StandardError; end end end